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
Take this example:
https://psalm.dev/r/8c3364a135
Failing the first if statement incorrectly assigns $value as null, ignoring the possibility that $value->isOne() evaluated to false.
$value
null
$value->isOne()
false
This is a regression, as it popped up when I upgraded from tag 4e177bf (last commit on the 5.x branch) to 9cf4f60 (current 5.8 state)
The text was updated successfully, but these errors were encountered:
I found these snippets:
<?php enum Val { case One; case Two; case Three; public function isOne():bool { return $this == static::One; } public function isTwo(): bool { return $this == static::Two; } public static function random(): ?static { return match (rand(1,5)) { 1 => static::One, 2 => static::Two, 3 => static::Three, default => null, }; } } $value = Val::random(); if ($value?->isOne()) { echo 'Solo'; } elseif ($value?->isTwo()) { echo 'In pairs'; } else { echo 'Grouped'; }
Psalm output (using commit 0af503a): ERROR: RedundantCondition - 29:11 - $value is null has already been asserted ERROR: NullReference - 29:20 - Cannot call method isTwo on null value ERROR: TypeDoesNotContainType - 29:11 - Type null for $value is always !null
Sorry, something went wrong.
Likely due to #9538
Well, no, that hasn't been tagged yet.
@bitwise-operators can you check on master?
master
#9457 could be related
No branches or pull requests
Take this example:
https://psalm.dev/r/8c3364a135
Failing the first if statement incorrectly assigns
$value
asnull
, ignoring the possibility that$value->isOne()
evaluated tofalse
.This is a regression, as it popped up when I upgraded from tag 4e177bf (last commit on the 5.x branch) to 9cf4f60 (current 5.8 state)
The text was updated successfully, but these errors were encountered: