On 26/02/2022 09:09, Robert Landers wrote:
I'd like to propose and implement an RFC that would consider dropping the warning if and only if array access is the only test in ternary and short ternary (?:) operations but first I'd like to start a discussion to see if it is worth pursuing. I'd like to target PHP 8.2 or 8.3.
The warning comes from the array key being missing, not from being empty. There are many values which are empty which do not emit the warning.
If you want to provide a default should the array key be missing you want null coalesce.
$x = $array['foo'] ?? 'somethingelse'; -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php