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

TypeSpecifier: Narrow (string) $expr like $expr != '' #3387

Merged
merged 1 commit into from
Sep 2, 2024

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Sep 2, 2024

@ondrejmirtes
Copy link
Member

I think you can narrow all of them as != false.

Because here you missed '0' which is falsy.

@staabm
Copy link
Contributor Author

staabm commented Sep 2, 2024

I think you can narrow all of them as != false.

great suggestion. since we have already a better loose comparison of constant bools, this also leads to more precise results already :)

@staabm
Copy link
Contributor Author

staabm commented Sep 2, 2024

(I will de-duplicate the existing logic on the next PR, when currently open ones are merged)

@staabm staabm marked this pull request as ready for review September 2, 2024 08:04
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@ondrejmirtes ondrejmirtes merged commit 3d17f51 into phpstan:1.12.x Sep 2, 2024
489 of 500 checks passed
@ondrejmirtes
Copy link
Member

Thank you.

@staabm staabm deleted the cast3 branch September 2, 2024 17:38
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.

None yet

3 participants