Re: [PHP-DEV] Reflection*::hasAttribute()

2023-07-12 Thread Robin Chalas
> I think that would require an RFC. Alright, thanks. > To clarify, you're proposing to replace this: >count((new ReflectionClass(Beep::class))->getAttributes(Ignore::class)) == true >with >(new ReflectionClass(Beep::class))->hasAttribute(Ignore::class) > Right? Correct. > That doesn't seem lik

Re: [PHP-DEV] Reflection*::hasAttribute()

2023-07-12 Thread Benjamin Morel
> > I think that would require an RFC. > > To clarify, you're proposing to replace this: > > count((new ReflectionClass(Beep::class))->getAttributes(Ignore::class)) == > true > > with > > (new ReflectionClass(Beep::class))->hasAttribute(Ignore::class) > > Right? That doesn't seem like a huge impro

Re: [PHP-DEV] Reflection*::hasAttribute()

2023-07-12 Thread Larry Garfield
On Wed, Jul 12, 2023, at 3:25 AM, Robin Chalas wrote: > 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 i

[PHP-DEV] Reflection*::hasAttribute()

2023-07-11 Thread Robin Chalas
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 in