On Mon, 28 Sep 2020 at 15:17, Nicolas Grekas <nicolas.grekas+...@gmail.com> wrote:
> I assume the 80% case is properties, because attributes did not have >> docblock annotations yet, that means this use-case isn't even possible at >> the moment. Yet annotations on properties are widespread (Doctrine ORM, >> symfony validator, ...). >> > > I'm 100% with Benjamin here, this is what will be the most useful to me > also. > To be clear, I don't have a strong opinion against yours, I'm just pointing out the fact that even though it might be useful, it might also be confusing and create yet another WTF moment in PHP for developers. Sure, it might make more sense to apply to the property. Sure, so far annotations weren't possible on parameters. But is that obvious to the average developer writing the attribute? A few years down the road, DI containers may have broad support for annotating parameters for injection. Will it still be obvious then that an attribute on a promoted property applies to the property only? I do agree that applying the attribute to both the property and the parameter will probably never be useful, though. So, throwing an exception and forcing the de-sugaring feels like the most sensible thing to do for me in this case! — Benjamin