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

Implement getConstantStrings() on Type #1979

Merged
merged 3 commits into from Dec 13, 2022

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Nov 7, 2022

@staabm staabm marked this pull request as ready for review November 7, 2022 15:37
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@staabm staabm force-pushed the const-strings branch 2 times, most recently from 86ed04f to e387570 Compare November 8, 2022 14:29
@staabm staabm force-pushed the const-strings branch 2 times, most recently from 21de8f4 to fac73f6 Compare November 11, 2022 08:54
@staabm staabm marked this pull request as draft November 19, 2022 10:21
@staabm staabm marked this pull request as ready for review November 19, 2022 10:54
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@ondrejmirtes ondrejmirtes merged commit 1b92af0 into phpstan:1.9.x Dec 13, 2022
@ondrejmirtes
Copy link
Member

Thank you!

@@ -93,6 +93,8 @@ public static function getConstantArrays(Type $type): array

/**
* @return ConstantStringType[]
*
* @deprecated Use PHPStan\Type\Type::getConstantStrings() instead
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@staabm The two methods don't work exactly the same (i.e. the new implementation for UnionType doesn't have $stopOnUnmatched equivalent). I think it causes a regression here: https://phpstan.org/r/33df1d6b-50e1-4aed-ac3b-bb5f1a8ac66b (constant string concat with int|null - the result shouldn't be a constant string).

Copy link
Contributor Author

@staabm staabm Dec 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx for the headsup. I will have a look.

I opened a issue for it: phpstan/phpstan#8568

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