-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[Serializer] [PropertyAccessor] Ignore non-collection interface generics #52699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
What about considering this as an improvement and merging into 6.4? Then we can do the BC break in 7.0. |
|
It also means that it won't be supported in 6.3 and 7.0 (supposing that the |
a170c98 to
788659f
Compare
788659f to
a59732f
Compare
a59732f to
eaac5c8
Compare
eaac5c8 to
7f06cac
Compare
7f06cac to
487b24c
Compare
487b24c to
9ecc19d
Compare
9ecc19d to
7b0d86b
Compare
7b0d86b to
e31aeeb
Compare
|
Thank you @mtarld. |
|
@mtarld I have merged these changes up to the |
This PR was merged into the 7.1 branch. Discussion ---------- [PropertyInfo] Fix generics related test | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | | License | MIT Update tests accordingly to #52699 (in the same way as the legacy tests). Commits ------- 9245561 [PropertyInfo] Fix generics related test
|
HI, since that we're observing a
|
… (mtarld) This PR was merged into the 5.4 branch. Discussion ---------- [PropertyInfo] Handle collection in PhpStan same as PhpDoc | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | Fix #52699 (comment) | License | MIT On #52699, a [comment](#52699 (comment)) suggested to support classes that inherit from collection classes (such as doctrine collections for example). This has been done for PHPDoc, but not in PHPStan. This PR adds this missing behavior to PHPStan (and adds the missing PHPDoc related test). Commits ------- f098683 [PropertyInfo] Handle collection in PhpStan same as PhpDoc
PhpDocExtractorandPhpStanDocExtractorare following an old version of PSR-5 with used to define collections as the following:But, it does conflict with non-collection generics.
This issue will automatically be solved if the
TypeInfois merged in Symfony. But for older versions (<7.1 at least), it needs a fix.I was not able to find a proper bug fix without introducing a BC break, so this PR proposes to opt-on the "non-collection generics" parsing, such asstcClass<int>for example.To opt-out from parsing these generics, it'll be required to setignore_docblock_genericsin the context. And this key/value will become obsolete as soon as theTypeInfois introduced.I'm not sure how to proceed though, should we only merge it in 5.4, and 6.3 supposing that theTypeInfomight be merged in 7.x? Should we document it only in these branches?EDIT: I finally ignored PHPDoc generics that aren't well known collection generic types so that the process will fall back to other resolvers (such as reflection resolver for example)