Re: Re: [RFC] Constructor Property Promotion
| From: | Nicolas Grekas | Date: | Tue, 28 Apr 2020 15:56:11 +0000 |
| Subject: | Re: Re: [RFC] Constructor Property Promotion | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109883@lists.php.net to get a copy of this message | ||
>
> > I would expect attributes to apply only to the properties on my side.
>
> Parameter annotations could be interesting for dependency injection.
> Symfony currently has some DI magic through parameter names among
> other things. It might be nice to control these through annotations
> instead. This would be impossible or involve a lot of hackery and
> assumptions if the annotations aren't available on the parameters.
> Alternatively we might make this information available through
> reflection (like ReflectionParameter::getGeneratedProperty()) so you
> can look for the annotation there.
>
Sure, this could be considered.
But this doesn't contradict what I wrote:
if one uses constructor promotion, the then attributes should only go to
the properties to me.
If one wants to add attributes to parameters, then one would need to
opt-out from constructor promotion.
Nicolas