-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
phpstan/phpstan-src
#3884Labels
Milestone
Description
Bug report
In the following code $session = $sessionHandler->read('123'); PhpStan assumes that $session is string but it can be string or false according to PHP docs https://www.php.net/manual/en/sessionhandlerinterface.read.php
public SessionHandlerInterface::read(string $id): string|falsePhpStan generates the following error for this code:
if ($session === false) {
return null;
}Strict comparison using === between string and false will always evaluate to false.
Code snippet that reproduces the problem
https://phpstan.org/r/a1080965-9212-4b2a-af05-3ce9fa7734cc
Expected output
No errors.
Did PHPStan help you today? Did it make you happy in any way?
No response
Reactions are currently unavailable