-
Notifications
You must be signed in to change notification settings - Fork 650
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
InvalidArgument vs PossiblyFalseArgument #5790
Comments
I found these snippets: https://psalm.dev/r/47caf98787<?php
declare(strict_types=1);
function takesAString(string $s): void{
echo $s;
}
takesAString(true);
https://psalm.dev/r/0b9b837d1d<?php
declare(strict_types=1);
function takesAString(string $s): void{
echo $s;
}
takesAString(false);
|
It is intentional, although it could be clearer. The reason is that many internal functions return |
Shouldn't the false case be handled by the |
A method expecting a
string
, but passedtrue
outputs anInvalidArgument
:https://psalm.dev/r/47caf98787
Same thing, but now passed
false
outputs aPossiblyFalseArgument
:https://psalm.dev/r/0b9b837d1d
In this case
false
is not "possibly" false, it definitely is false.Is this intentional behavior or a bug?
(I would have expected an
InvalidArgument
error in the second case as well)The text was updated successfully, but these errors were encountered: