Skip to content

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

Open
phpstan/phpstan-src
#2926
@rasmus0201

Description

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions