On Tue, Apr 14, 2020 at 3:04 PM Nicolas Grekas <nicolas.grekas+...@gmail.com>
wrote:

> Hi Benjamin,
>
> I have updated the RFC with much of the feedback received here, on Twitter
>> and Reddit.
>>
>> https://wiki.php.net/rfc/attributes_v2
>
>
> Thanks for the update and for giving this a try!
>
> I'm wondering about nested annotations: as you know, they're quite common
> in apps that use doctrine/annotation.
> How do you think these should be migrated to the new system?
>

Nested attributes are not supported in this step, because they might
interfere with potential changes to constant AST. Tyson dipped into that
topic a few weeks ago.

If constants were to allow something like const $foo = new Foo(); - then
this would automatically be available for attributes (they use the same
concept).

For now I suppose the approach would be to flatten the attributes, for
example:

@JoinTable(name="users_posts", joinColumns={@JoinColumn(name="id",
referencedColumnName="user_id"}, inverseJoinColumns={@JoinColumn(name="id",
"referencedColumnName="post_id"})

becomes:

<<JoinTable("users_posts")>>
<<JoinColumn("id", "user_id")>>
<<InverseJoinColumn("id", "post_id")>>

As you can see with this example, named arguments is another under
construction area in the language that would automatically spill its
benefits to attributes.

Think of this like scalar types in 7.0 that missed nullable, which was
added in 7.1.


> Nicolas
>

Reply via email to