- 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 in classes Active 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.
- Status changed to Needs review
3 days ago 1:13pm 6 May 2025 - ๐ช๐ธSpain fjgarlin
The failing tests in the CI are mostly unrelated to the changes here, and defo not a blocker.
This is how it's rendered in the tests:
The code looks good and it opens the door to some of the other critical issues.
RTBC. -
fjgarlin โ
committed 9fadb27a on 2.x authored by
ghost of drupal past โ
Issue #3449634 by ghost of drupal past, fjgarlin, avpaderno: Attributes...
-
fjgarlin โ
committed 9fadb27a on 2.x authored by
ghost of drupal past โ
- ๐ช๐ธSpain fjgarlin
Merged as this will unblock some other critical issues. We can create follow-ups if needed.
This will go with the next deployment round to api.drupal.org.
Thanks so much!