-
Notifications
You must be signed in to change notification settings - Fork 696
Closed
Labels
Description
Hi.
Psalm 5.7.1
I got this error on a simple example.
<?php
$str = $argv[1] ?? '';
if(empty($str) || strlen($str) < 3) {
exit(1);
}
echo $str; // ERROR: [NoValue](https://psalm.dev/179) - 8:6 - All possible types for this argument were invalidated - This may be dead codehttps://psalm.dev/r/f12fbc1db8
The error disappeared when I removed the unnecessary "empty" check.
<?php
$str = $argv[1] ?? '';
if(strlen($str) < 3) {
exit(1);
}
echo $str;Reactions are currently unavailable