Skip to content

Possible BC break in nested array annotations with @NestedAnnotation #418

@TomasVotruba

Description

@TomasVotruba

Hi everyone!

Thanks for adding #402 , it's a life saver with PHP 8 and migration to attributes 👏

I've been exploring one weird bug we had in our code base:

/**
 * @MainAnnotation(
 *     @NestedAnnotation('one'),
 *     @NestedAnnotation('two'),
 * )
 */

What is the problem?

This code returns 1 or 2 NestedAnnotation annitatons, depending if @NamedArgumentConstructor is used above NestedAnnotation.


It should fixed in userland like this:

 /**
- * @MainAnnotation(
+ * @MainAnnotation({
  *     @NestedAnnotation('one'),
  *     @NestedAnnotation('two'),
- * )
+ * })
 */

But at the moment it's a BC break, only first annotation is included. I think this BC breaks should not happen and there should be always 2 instances of NestedAnnotation regardless use of @NamedArgumentConstructor.

I'm looking into it 🙂 Any feedback appreciated 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions