Hi internals,

It is common attributes to be used as markers. Just like a marker interface 
with 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 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, do I need to open an RFC for that feature or is a pull request 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
Principal Engineer @Les-Tilleuls.coop
03 66 72 43 94
ro...@les-tilleuls.coop
82 Rue Winston Churchill - 59160 Lomme

Reply via email to