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
Next revisionBoth sides next revision
rfc:annotations-in-docblock [2011/05/11 18:39] guilhermeblancorfc:annotations-in-docblock [2011/05/12 18:12] guilhermeblanco
Line 1: Line 1:
-====== Request for Comments: How to write RFCs ======+====== Request for Comments: Annotations in DocBlock ======
  
   * Version: 1.0   * Version: 1.0
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.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1