- Issue created by @apaderno
- ๐จ๐ฆCanada Charlie ChX Negyesi ๐Canada
The question we need to first to answer is: what is the desired outcome here? I think the attribute class itself already has an api page because it is a class, after all. Everything marked with that attribute should have a reference to this page and vice versa much like it happens with annotations. I imagine there would be an object-type of
attribute
, and anattributes
reference type forbuildReferencesSection
/findReferences
. This is a fairly trivial affair, โจ Support for OO hooks implementations in classes Postponed shows how to parse attributes.A much more difficult question would be: what happens to the arguments of the attribute? The issue linked above definitely needs it -- perhaps it should special case for now and this issue should just store attributes as separate docblock entries and punt on argument processing. A followup would probably parse the arguments, use
https://github.com/nikic/PHP-Parser/blob/master/doc/component/Constant_expression_evaluation.markdown
and reference any classes and constants used here. - ๐จ๐ฆCanada Charlie ChX Negyesi ๐Canada
So this code parses and stores an attribute reference with less than 30 lines of code. This is a good start. Needs display and test.
This works for classes, function, methods, class constants, class properties. The next issue will be parameter attributes as used for autowiring for example. That's a bit more work because there's no docblock entry to piggyback on to currently.