One thing to consider when annotations are classes is whether using an annotation should make the annotated class depend on the annotation classes it uses. In other words, would a missing annotation class produce an error? It doesn't in Java (at runtime, see http://stackoverflow.com/a/3567969) and I think they made the right choice on that (although you can't compare this directly to PHP due to the nature of compilation in Java, and it is still a compile error there).
Consider an entity class with Doctrine mappings in annotations. This class is still perfectly usable on its own without this persistence information (assuming you don't care about database persistence in such situations), just as it would be if the mapping information was in XML/YAML files instead. I don't think Doctrine should be a hard dependency of such a class. Of course the code that _reads_ the annotations still depends on the annotation classes it cares about. 2015-02-25 5:27 GMT+01:00 Larry Garfield <la...@garfieldtech.com>: > On 02/21/2015 03:35 PM, Pavel Kouřil wrote: >> >> >> I know you could wrap it in your code, but that would still mean there >> would probably be multiple implementations of Annotations in the >> "wild", instead of a good complete functionality in the language >> itself. >> >> I know PHP is not primarily an OOP language, but Annotations IMHO make >> sense as classes, so I don't see any reason why would it be bad to >> make them in that way. Also, making Annotations be classes won't >> magically turn PHP into a primarily OOP language? >> >> Regards >> Pavel Kouřil > > > If you look at the major projects and code in the wild, PHP is a primarily > OOP language and has been for years. It's multi-paradigm but OOP is the > dominant style in the wild today. > > And I think mapping annotations to classes is a fine idea, as it means I can > very easily document what a given annotations is for (it's a class, document > the class), extend it, and build meaningful functionality and defaults using > an already well-known syntax and convention. > > --Larry Garfield > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php