Re: docBlock Parser RFC
| From: | Gustavo Lopes | Date: | Thu, 16 Sep 2010 22:34:40 +0000 |
| Subject: | Re: docBlock Parser RFC | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-49739@lists.php.net to get a copy of this message | ||
On Thu, 16 Sep 2010 21:56:04 +0100, Chad Fulton <chadfulton@gmail.com> wrote:
Based on comments from the annotations thread, I have created a docBlock parser RFC at http://wiki.php.net/rfc/docblockparser This RFC does not deal with annotations per se, but only with the idea of adding a function to the Reflection extension which would parse docBlocks according to a set docBlock syntax into a simple associative array containing three elements: short description, long description, and an array of tags. This is only meant to aid meta-data retrieval for classes and does not automatically instantiate anything objects.Pointless. Well, this will maybe speedup and standardize the usage of doc comments, but it's very far from what we could do with real annotations. By real annotations, I mean something the engine would recognize and that we could use in the future to implement AOP functionality with annotations or to implement other new features in the future, e.g.: class A {
@ReadOnly
public $var;
@PropertyGetter("virtualPropertyName")
public function baz() { }
@ClassInvariant
public static function bar() { }
@InstanceInvariant
public function foo() { }
/**
* A closure that could be called as if it were a non-static method
* and which would be automatically rebound.
* @var Closure
*/
@MethodClosure("staticMethod" => false, "rebind" => true)
public static $clos;
@Before("self::whatever", instance=true) /* Or @After, or @Around */
@Log("entering foobar") /* user-defined specialization of Before */
@Precondition(...)
public function foobar() {}
}
The current implementation would not allow any of this, but at least it opened way. A doc comment parser...
--
Gustavo Lopes