Skip to content
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

Add ReflectorWithAttributes interface with getFirstAttribute() and hasAttribute() #13224

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

ollieread
Copy link
Contributor

This is my first attempt at introducing the interface ReflectorWithAttributes which is implemented by the following classes:

  • ReflectionFunctionAbstract
  • ReflectionParameter
  • ReflectionClass
  • ReflectionProperty

The getAttributes() method present all of the above has been moved to this new interface, and the following methods have been added:

  • getFirstAttribute(?string $name = null, int $flags = 0): ?ReflectionAttribute
  • hasAttribute(?string $name = null, int $flags = 0): bool

I've tried to work with what is currently there, rather than replacing the current approach to attributes, but I can't speak for efficiency and such, so would appreciate any feedback.

This PR is an implementation of #8489, which was mentioned on the mailing list with little to no feedback.

@ollieread
Copy link
Contributor Author

I have absolutely no idea why the tests aren't passing on 3 of the 5 platforms, but I'll continue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant