Skip to content

Fix false positives on a nullable enum property under null coalesce#11878

Open
eyupcanakman wants to merge 1 commit into
vimeo:6.xfrom
eyupcanakman:fix/enum-value-coalesce-isset-11171
Open

Fix false positives on a nullable enum property under null coalesce#11878
eyupcanakman wants to merge 1 commit into
vimeo:6.xfrom
eyupcanakman:fix/enum-value-coalesce-isset-11171

Conversation

@eyupcanakman

Copy link
Copy Markdown
Contributor

$foo->value (or ->name) on a nullable enum is treated as always-set under ??, so psalm emits a false RedundantCondition and TypeDoesNotContainType. The enum value/name fetch replaced the node type with the case values, which dropped the null a nullable receiver carries inside isset. Real property fetches keep it. The fix combines with the existing node type the same way.

Fixes #11171

`$foo->value` (or `->name`) on a nullable enum is treated as always-set under `??`, so psalm emits a false `RedundantCondition` and `TypeDoesNotContainType`. The enum value/name fetch replaced the node type with the case values, which dropped the null a nullable receiver carries inside isset. Real property fetches keep it. The fix combines with the existing node type the same way.

Fixes vimeo#11171
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RedundantCondition on nullable enum is a false positive

1 participant