-
Notifications
You must be signed in to change notification settings - Fork 7.9k
GH-19153: Validate #[\Attribute]
targets
#19154
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
GH-19153: Validate #[\Attribute]
targets
#19154
Conversation
Targeting master for the same reason as #15733 did - this adds a new error where previously there wasn't one until you tried to make use of the attribute, at which point ReflectionAttribute::newInstance() would complain that you can't instantiate a trait/enum/interface/abstract class |
I plan to merge this in a few days if there are no objections |
The implementation looks correct. I'm not sure whether a short e-mail to internals@ is warranted, since this could break working code. https://3v4l.org/8Lih3#v8.4.10 |
Discussion at https://news-web.php.net/php.internals/128229 |
6f57d75
to
012b0f9
Compare
Do not allow #[\Attribute] on traits, interfaces, enums, or abstract classes.
012b0f9
to
ce3a659
Compare
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.
This should probably also be in UPGRADING, since it's technically a breaking change.
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.
Done, 6280dfc
Do not allow
#[\Attribute]
on traits, interfaces, enums, or abstract classes.