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

Switch condition order to support PHP 8 #42

Merged
merged 2 commits into from
Dec 13, 2021
Merged

Conversation

jdreesen
Copy link
Contributor

In PHP 8, ReflectionType::isBuiltin() has been moved to ReflectionNamedType::isBuiltin() and thus should be called after asserting that it's a named type.

@mnapoli
Copy link
Member

mnapoli commented Nov 15, 2021

Any idea why it's currently working fine in PHP 8? I'm confused how it didn't break before

@jdreesen
Copy link
Contributor Author

jdreesen commented Nov 16, 2021

As ReflectionType is now abstract, $parameter->getType() will either return null (if there's no type), ReflectionNamedType (if it has one type) or ReflectionUnionType (if it has multiple types).

So it works fine as long as there are only "named" (single) types, but breaks for union types.

See: https://3v4l.org/baloT

@mnapoli
Copy link
Member

mnapoli commented Dec 13, 2021

Thank you!

@mnapoli mnapoli merged commit cd6d9f2 into PHP-DI:master Dec 13, 2021
@jdreesen jdreesen deleted the patch-1 branch December 13, 2021 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants