vimeo/psalm

Emit an issue when using coalesce operator if the first operand can't be null

Open

#7,101 opened on Dec 8, 2021

View on GitHub
 (10 comments) (0 reactions) (0 assignees)PHP (668 forks)batch import
Help wantedenhancement

Repository metrics

Stars
 (5,369 stars)
PR merge metrics
 (Avg merge 3d 12h) (5 merged PRs in 30d)

Description

https://psalm.dev/r/154ffd42b2

/** @var string $q */
$a = explode(',', $q);

return $a[0] ?? '';

Should've resulted in TypeDoesNotContainNull but not.

Compare with:

https://3v4l.org/pgbW6

Contributor guide