> A more robust alternative would be something along the same lines that
> Doctrine uses: Make annotations actual classes.

Just spitballing here - what if both approaches were supported, but
class-based annotations were prefixed with a special character (perhaps
"@") to differentiate them?  For example:

<<ArbitraryAnnotation("Hello world")>>
<<@ORM\Entity(table => "foo")>>
class Foo {
    // ...
}

namespace ORM;
class Entity implements \Attribute {
    // ...
}

$r = new ReflectionClass('ORM\Entity');
var_dump($r->getAttributes());

-----

array(2) {
    ["ArbitraryAnnotation"]=>
    string(11) "Hello world"
    ["ORM\Entity"] =>
    object(ORM\Entity)#1 (0) { ... }
}

-----

Again, I'm not necessarily advocating this - just throwing the idea out
there for discussion.

Regards,

Colin

Reply via email to