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

PDO::quote() string|false - Strict comparison using === between string and false will always evaluate to false. #10512

Open
rasmus0201 opened this issue Jan 30, 2024 · 1 comment · May be fixed by phpstan/phpstan-src#2926
Labels
Milestone

Comments

@rasmus0201
Copy link

Bug report

When using the PDO::quote() method, which has a return signature of string|false phpstan will throw an error when checking if the returned value is false. This should be allowed, since the function can return false value.

If it weren't a strict check the return value '' (empty string) would trigger the if-condition in the playground linked.

Code snippet that reproduces the problem

https://phpstan.org/r/4a7accc9-ee76-4fc2-be27-4a23b12f4be6

Expected output

There should not be any errors.

Did PHPStan help you today? Did it make you happy in any way?

Amazing tool! Good job!

@ondrejmirtes
Copy link
Member

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

Successfully merging a pull request may close this issue.

2 participants