-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[TypeInfo] Fix handling ConstFetchNode
#60820
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
[TypeInfo] Fix handling ConstFetchNode
#60820
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Hmm, this is not the right fix :( |
38d6ac6
to
526b002
Compare
526b002
to
6e237a9
Compare
Changed implementation from returning |
Constants are not even restricted to scalars in recent PHP versions. The right fix would involve looking at the fetched constants. |
ConstFetchNode
6e237a9
to
48f648b
Compare
I've updated implementation |
4173b66
to
606a4ab
Compare
606a4ab
to
3d5c90d
Compare
I'm not sure how to fix the failing serializer test. For me it looks like that it's an invalid test, because it defines |
3d5c90d
to
2ac811b
Compare
I'm not sure how to fix property info though, as test passes for me locally |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failures are because symfony/property-info
requires either:
symfony/type-info:^7.1
(low-deps)symfony/type-info:7.4-dev
(high-deps)
Both of these are not including your change (7.4-dev will once this PR will be merged I guess).
But for the low-deps, Maybe you can add a condition? Something like:
if (class_exists(NullableType::class)) { // <- this class was introduced in 7.2
yield ['f', Type::union(Type::string(), Type::null())];
} else {
yield ['f', null];
}
src/Symfony/Component/TypeInfo/Tests/TypeResolver/StringTypeResolverTest.php
Outdated
Show resolved
Hide resolved
But I don't know if we need to consider this as a BC break (as it was not a valid type anyway) 🤔 |
d520350
to
ec86f71
Compare
Thanks, updated |
src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php
Outdated
Show resolved
Hide resolved
ec86f71
to
6f49fc6
Compare
For the lowest-deps job, I suggest instead bumping the min version of type-info in property-info to use |
Agreed, this will make things much more easier. |
6f49fc6
to
78c60fe
Compare
Thank you, both |
7729498
to
6440799
Compare
src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php
Outdated
Show resolved
Hide resolved
d0fdf06
to
03cc607
Compare
Thank you @norkunas. |
I cannot upgrade to 7.3 because I get: