We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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
$session = $sessionHandler->read('123');
$session
string
false
public SessionHandlerInterface::read(string $id): string|false
PhpStan generates the following error for this code:
if ($session === false) { return null; }
Strict comparison using === between string and false will always evaluate to false.
https://phpstan.org/r/a1080965-9212-4b2a-af05-3ce9fa7734cc
No errors.
No response
The text was updated successfully, but these errors were encountered:
Can be fixed here https://github.com/phpstan/phpstan-src/blob/c533a6e853245863f23313132f174151093d8d64/resources/functionMap.php#L10424
Sorry, something went wrong.
SessionHandlerInterface::read
Successfully merging a pull request may close this issue.
Bug report
In the following code
$session = $sessionHandler->read('123');
PhpStan assumes that$session
isstring
but it can bestring
orfalse
according to PHP docs https://www.php.net/manual/en/sessionhandlerinterface.read.phpPhpStan generates the following error for this code:
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
The text was updated successfully, but these errors were encountered: