rfc:annotations-in-docblock

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:annotations-in-docblock [2011/05/11 18:39] guilhermeblancorfc:annotations-in-docblock [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Request for Comments: How to write RFCs ======+====== Request for Comments: Annotations in DocBlock ======
  
   * Version: 1.0   * Version: 1.0
   * Date: 2011-05-11   * Date: 2011-05-11
   * Author: Guilherme Blanco <guilhermeblanco@hotmail.com>, Pierrick Charron <pierrick@php.net>   * Author: Guilherme Blanco <guilhermeblanco@hotmail.com>, Pierrick Charron <pierrick@php.net>
-  * Status: Under Discussion+  * Status: Inactive
   * First Published at: http://wiki.php.net/rfc/annotations-in-docblock   * First Published at: http://wiki.php.net/rfc/annotations-in-docblock
  
Line 60: Line 60:
  * Foo class.  * Foo class.
  *  *
- * @Entity {repositoryClass: "FooRepository"+ * @Entity {"repositoryClass": "FooRepository"
- * @Table  {name: "foos"}+ * @Table  {"name": "foos"}
  *  *
  * @author "Guilherme Blanco"  * @author "Guilherme Blanco"
Line 136: Line 136:
  
 Please notice that ReflectionParameter would now accept docblock to support Annotations. This is something that still needs to be discussed. Please notice that ReflectionParameter would now accept docblock to support Annotations. This is something that still needs to be discussed.
 +
 +===== Consuming =====
 +
 +<code php>
 +$reflClass = new \ReflectionClass('Foo');
 +var_dump($reflClass->getAnnotations());
 +
 +/*
 +array(3) {
 +  ["Entity"]=>
 +  object(ReflectionAnnotation)#1 (1) {
 +    ["value"]=>
 +    object(stdClass)#1 (1) {
 +      ["repositoryClass"]=>
 +      string(13) "FooRepository"
 +    }
 +  }
 +  ["Table"]=>
 +  object(ReflectionAnnotation)#2 (1) {
 +    ["value"]=>
 +    object(stdClass)#1 (1) {
 +      ["name"]=>
 +      string(4) "foos"
 +    }
 +  }
 +  ["author"]=>
 +  object(ReflectionAnnotation)#3 (1) {
 +    ["value"]=>
 +    string(16) "Guilherme Blanco"
 +  }
 +}
 +*/
 +</code>
  
 ===== Patch ===== ===== Patch =====
rfc/annotations-in-docblock.1305139192.txt.gz · Last modified: 2017/09/22 13:28 (external edit)