vimeo/psalm

Prevent comparison of null

Open

#6869 aperta il 9 nov 2021

Vedi su GitHub
 (6 commenti) (1 reazione) (0 assegnatari)PHP (668 fork)batch import
Help wantedenhancement

Metriche repository

Star
 (5369 star)
Metriche merge PR
 (Merge medio 3g 12h) (5 PR mergiate in 30 g)

Descrizione

With code like https://psalm.dev/r/890c56e8d0 (or a more complicated equivalent) I think it's often easy to forget to consider the case where the variable is null.

It might be useful for Psalm to emit an issue to stop comparisons with nullable values, and force the programmer to handle the null explicitly as a special case.

Guida contributor