doctrine / doctrine/annotations

Possible BC break in nested array annotations with @NestedAnnotation

Open
#418 16 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
6.7k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

Hi everyone!

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

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

```php
/**
* @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:

```diff
/**
- * @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 :slightly_smiling_face: Any feedback appreciated :+1:

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.