[php-src] PR #13224: Add ReflectorWithAttributes interface with getFirstAttribute() and hasAttribute()
| From: | ollieread | Date: | Tue, 23 Jan 2024 11:35:00 +0000 |
| Subject: | [php-src] PR #13224: Add ReflectorWithAttributes interface with getFirstAttribute() and hasAttribute() | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-24872@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/13224
Author: ollieread
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.