Cannot use isset() on the result of an expression (you can use “null !== expression” instead)¶
Description¶
isset() is meant to check the existence of an data container, such as a variable, an array element, a property of an object. It is not meant to check if an expression is null, because it is not a data container.
Expressions are valid with isset within a data container, though.
Example¶
<?php
$a = 'a';
$b = 'b';
if (isset($a . $b)) {}
// recommended by the error itself
if ($a . $b !== null) {}
// expression are valid with isset within a data container
if (isset($array[$a . $b])) {}
if (isset(${$a . $b})) {}
?>
Solutions¶
Use a comparison to null with an expression.