rfc:annotations

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rfc:annotations [2011/05/09 23:19]
guilhermeblanco Brought RFC up to date.
rfc:annotations [2017/09/22 13:28] (current)
Line 4: Line 4:
   * Date: 2010-08-24   * Date: 2010-08-24
   * Author: Guilherme Blanco <​guilhermeblanco@hotmail.com>,​ Pierrick Charron <​pierrick@php.net>​   * Author: Guilherme Blanco <​guilhermeblanco@hotmail.com>,​ Pierrick Charron <​pierrick@php.net>​
-  * Status: ​Ready for discussion+  * Status: ​Declined
   * First Published at: http://​wiki.php.net/​rfc/​annotations   * First Published at: http://​wiki.php.net/​rfc/​annotations
  
Line 18: Line 18:
   * **Doctrine** For Object-Relational mapping, examples: @Entity, @OneToOne, @Id, etc.   * **Doctrine** For Object-Relational mapping, examples: @Entity, @OneToOne, @Id, etc.
   * **Zend Framework Server classes** Used to automate mappings for XML-RPC, SOAP, etc.   * **Zend Framework Server classes** Used to automate mappings for XML-RPC, SOAP, etc.
-  * **FLOW3** for dependency injection and validation+  * **TYPO3** for dependency injection and validation
   * **Symfony2** for routing rules   * **Symfony2** for routing rules
   * **Others** One clear thing that comes to my mind is Validation, Functional Behavior injection (which could take advantage of [[rfc:​Traits]]),​ etc. Also, any Framework could take advantage of it somehow.   * **Others** One clear thing that comes to my mind is Validation, Functional Behavior injection (which could take advantage of [[rfc:​Traits]]),​ etc. Also, any Framework could take advantage of it somehow.
Line 108: Line 108:
  
 Annotations can be defined on classes, methods, properties, functions or function parameters. Annotations can be defined on classes, methods, properties, functions or function parameters.
-ReflectionAnnotation is an interface ​the must be implemented in order to accept an Annotation definition. +ReflectionAnnotation is an interface ​that must be implemented in order to accept an Annotation definition. 
-Once this class is extended, the subclass is ready to be used an an Annotation:+Once this class is extended, the subclass is ready to be used as an Annotation:
  
 <code php> <code php>
Line 144: Line 144:
     public $target;     public $target;
     ​     ​
-    public function __construct($url,​ $target)+    public function __construct($url,​ $target ​= null)
     {     {
         $this->​url = $url;         $this->​url = $url;
Line 153: Line 153:
 namespace App; namespace App;
  
-<​Annotation\Link(url="​http://​www.php.net", ​target="​_blank"​)>​+<​Annotation\Link("​http://​www.php.net",​ "​_blank"​)>​
 class PHPWebsite { class PHPWebsite {
     // ...     // ...
Line 232: Line 232:
 </​code>​ </​code>​
  
-Please notice that multiple instantiation of same Annotation is left intentionally for discussion. It can be supported.+Please notice that multiple instantiation of same Annotation is left intentionally for discussion. It could be supported.
 Also, the inheritance of Annotations is left for discussion too. This can be done by 2 different approaches: Also, the inheritance of Annotations is left for discussion too. This can be done by 2 different approaches:
  
Line 298: Line 298:
   * Possible usage of "​annotation"​ as keyword instead of an abstract class.   * Possible usage of "​annotation"​ as keyword instead of an abstract class.
   * Tokens for start/end. Currently it's "<"​ and ">"​.   * Tokens for start/end. Currently it's "<"​ and ">"​.
 +  * Nested Annotation declaration:​ <​Foo(<​Bar>​)>​ or <Foo(new Bar)> (this changes the EBNF if any change is agreed). Currently the supported one is: <​Foo(<​Bar>​)>​
   * Multiple instantiations of Annotation classes on a same block.   * Multiple instantiations of Annotation classes on a same block.
   * Inheritance of classes/​properties/​method and Annotations declarations.   * Inheritance of classes/​properties/​method and Annotations declarations.
Line 303: Line 304:
 ===== Patch ===== ===== Patch =====
  
-Ongoing.+Patch : [[http://​www.adoy.net/​php/​Annotations-v3.diff]]  
 + 
 +Tests : [[http://​www.adoy.net/​php/​Annotations-v3-tests.diff]]
  
 ===== Changelog ===== ===== Changelog =====
rfc/annotations.1304983169.txt.gz · Last modified: 2017/09/22 13:28 (external edit)