Skip to content
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

[PropertyInfo] Support union types through PhpDoc #45903

Closed
alex-dev opened this issue Mar 31, 2022 · 7 comments · Fixed by #48238
Closed

[PropertyInfo] Support union types through PhpDoc #45903

alex-dev opened this issue Mar 31, 2022 · 7 comments · Fixed by #48238

Comments

@alex-dev
Copy link
Contributor

alex-dev commented Mar 31, 2022

Description

Currently, symfony/property-info supports union types through ReflectionExtractor and PhpStanExtractor.
phpDocumentor/reflection also supports union type values (both as a type and in collection key/value).

If PhpDocExtractor is not deprecated, it should be updated to detect union type properly especially in collections.

@alexandre-daubois
Copy link
Contributor

@alex-dev
Copy link
Contributor Author

It doesn't seems to be supported in collections. Nor is there any test I could find.

@carsonbot
Copy link

Thank you for this suggestion.
There has not been a lot of activity here for a while. Would you still like to see this feature?

@carsonbot
Copy link

Hello? This issue is about to be closed if nobody replies.

@alex-dev
Copy link
Contributor Author

Would still be useful.

@carsonbot carsonbot removed the Stalled label Nov 12, 2022
@wouterj
Copy link
Member

wouterj commented Nov 12, 2022

Do you have time to submit a PR to add this, @alex-dev ?

@temp
Copy link

temp commented Nov 18, 2022

I opened #48238 with basic support for union types. It's a bit tricky, since cases that the phpstan extractor can differ can't be differentiated via the docblock types. That's why we had to unify cases $b and $c from the DummyUnionType.
Cases $d, $e, $f and $g can not be handled by the current underlying docblock structures, and are disabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants