Description
The following code:
<?php
class X {
const A = '1';
}
$c = 'b';
isset(X::{$c});
Resulted in this (valid) output:
atal error: Cannot use isset() on the result of an expression (you can use "null !== expression" instead)
but I cannot use null !== X::{$c}, which also yields a Fatal Error.
With a constant, this message should recommend using 'defined()' instead, or on top of the current recommendation.
PHP Version
Tested on PHP 8.5, but any version since 8.3
Operating System
Not applicable.
Description
The following code:
Resulted in this (valid) output:
but I cannot use
null !== X::{$c}, which also yields a Fatal Error.With a constant, this message should recommend using 'defined()' instead, or on top of the current recommendation.
PHP Version
Operating System
Not applicable.