On Wed, Apr 29, 2020 at 10:56 AM Benjamin Eberlei <kont...@beberlei.de>
wrote:

>
>
> On Wed, Apr 29, 2020 at 9:47 AM Nicolas Grekas <
> nicolas.grekas+...@gmail.com> wrote:
>
>> > I think it might be best to apply to "both" and provide an isPromoted()
>> > method on both ReflectionParameter and ReflectionProperty. Any code that
>> > wishes to validate the allowed positions of an attribute can then skip
>> > properties/parameters that report isPromoted() as true, to avoid
>> reporting
>> > false positives.
>> >
>>
>> That sounds good. Deal on my side.
>>
>
> Just to mention, any approach here potentially conflicts with anything we
> consider for potential target validation on attributes, i.e. declaring for
> an attribute that it is only allowed on a property OR an argument.
>
> At the point constructor promotion happens, we can also not look into the
> attribute to see if its target=property or target=parameter, because this
> would require triggering autoloader.
>

Does it really conflict though? Can't the target validation just ignore
invalid attributes when promotion is involved (or rather, only check that
the attribute is valid for either property or parameter, but not
necessarily both of them)?

Nikita

Reply via email to