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

Add missing SpecifiedTypes for count and strlen identical expressions #1021

Conversation

herndlm
Copy link
Contributor

@herndlm herndlm commented Feb 16, 2022

Stumbled over this while debugging something in the webmozart-assert extension.

This adds missing SpecifiedTypes for count, sizeof and strlen expressions used via Identical.

E.g. count($list) === 1 would previously result in the sureType NonEmptyArrayType for $list. Now additionally it has a ConstantIntegerType with value 1 for count($list).
This is a tiny thing, but improved something in bug-2648.php and it should close phpstan/phpstan-webmozart-assert#68 if I'm not mistaken.

The first new test case in TypeSpecifierTestCase shows that it worked already for GreaterOrEqual before.

@herndlm herndlm marked this pull request as ready for review February 16, 2022 21:26
@ondrejmirtes ondrejmirtes merged commit e504c3f into phpstan:master Feb 23, 2022
@ondrejmirtes
Copy link
Member

Thank you!

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