PhpStorm " isset " bug!

PhpStorm for PHP 7 (PHP language level set to 7)

isset() doesn't recognize properly the new Array Constants.

const COLORS = [ 'RED' => 1, 'GREEN' => 2 ];
$mine = 'GREEN';

if ( isset( COLORS[ $mine ] )) echo "Yes.";
^Expected: variable

This is annoying since that gives an error, not a warning.



Comment actions Permalink

Reading further on the issue, is actually more generic, and harder to parse than a "simple" const variable.

Is it possible to fix the "const" case aside and ahead of the general case? 

That's easier IMO.

"const" is a variable declaration without a "$".
PhpStorm has to check its list of "const"s to check if the name has been declared, and allow that in "isset()" or "??".


Comment actions Permalink

come on!!! It's a very annoying mistake

Comment actions Permalink

This annoying mistake also annoys me.


Please sign in to leave a comment.