Motivation:
I sometimes forget that the null-safe operator doesn't work like the coalesce operator. So I would do something like $array[$key]?->someProperty and assume it to work for undefined keys.
Description:
If EA can determine that $array is an array of types other than null, so a null isn't a possible value, then EA should show an error/warning for the syntax above and suggest to change it to ($array[$key] ?? null)?->someProperty instead.
Example
/** @var \SplFileInfo[] $files */
$files = [];
$key = 'foo';
$path = $files[$key]?->getPath();
Motivation:
I sometimes forget that the null-safe operator doesn't work like the coalesce operator. So I would do something like
$array[$key]?->somePropertyand assume it to work for undefined keys.Description:
If EA can determine that
$arrayis an array of types other thannull, so anullisn't a possible value, then EA should show an error/warning for the syntax above and suggest to change it to($array[$key] ?? null)?->somePropertyinstead.Example