Hi internals,

It is common for attributes to be used as markers, and just like a marker 
interface has no methods, such attributes don’t have any parameter.
Examples from Symfony:
- #[Ignore] indicating that a property should be skipped in a serialization 
contextl
- #[Exclude] telling the dependency injection container that a given class 
should be skipped from automatic service registration

From Doctrine ORM:
- #[Id] to tell which property of en entity class should be mapped as primary 
key

Those attributes are meant to opt in/out some behavior through detection only. 
But with the current API, such code needs to call `getAttributes()` while it 
doesn't care about the returned ReflectionAttribute instances.
Hence I’m wondering if we could add a `hasAttribute()` method to the reflectors 
that are targetable by attributes.

Does that make sense?
If it does, would I need to submit an RFC or would a pull request on php-src be 
enough?

Anyway, I’d be happy to work on the implementation as a first contribution to 
PHP.
Looking forward to your feedback.

Thanks.
Robin

—
Robin Chalas

Reply via email to