-
-
Notifications
You must be signed in to change notification settings - Fork 190
FEATURE: Support PHP8 attributes #2468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This is a reduced subset of #2404 that only contains the attributes support without changing any functionality |
kdambekalns
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good by reading, I like how the annotation implementations get simpler!
|
@albe - I also really like it ( as far as I understand it :) - would you take care of the failing psalm tests? |
skurfuerst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good by reading :) Great job! Instanciating annotations manually is a case I have never seen in the wild, so for me that's safe.
|
Regarding psalm, I guess we need to do a baseline update in master anyway before the release. I can take care on friday if it's not too late |
This allows to use all existing Annotations as PHP8 Attributes and makes the ReflectionService pick up attributes like annotations.
Hence all
is*AnnotatedWith()and*Annotation()methods will return attribute classes as if they were annotations.Note though, that this means a class that has both annotation and the equal attribute will behave as if all annotations were duplicated.
Also, in case you manually instanciated an Annotation class, you need to adjust to the changed constructor, which no longer takes a named array, but the list of actual properties.
In most cases instead of
new Flow\Inject($args)you can probably donew Flow\Inject(...$args)with PHP8 and named parameters.For Doctrine Annotations - see doctrine/orm#8266 which will be available with 2.9