You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix nullsafe.neverNull false positive when the ?-> operand is nullable
$a?->b on the left of ??, or inside isset()/empty(), was reported as
redundant whenever $a?->b as a whole was nullable, without checking $a
itself. When $a is nullable the ?-> is what yields the null those
constructs handle, so it's required, and switching to -> as advised would
fatal at runtime.
Report only when the operand is never null, and recurse into a nullsafe
operand so an inner never-null link ($nonNull?->nullable?->x) is still
caught, matching NullsafePropertyFetchRule outside these contexts. Adds the
same treatPhpDocTypesAsCertain tip, and fixes the bug-7109 expectations
that had baked in the false positive.
Fixesphpstan/phpstan#14311
0 commit comments