Top-level const declarations are not implemented:
phunkie > const GREETING = "hello"
Error: Evaluation error: Unsupported statement type: PhpParser\Node\Stmt\Const_
phunkie > GREETING
Error: Evaluation error: Undefined constant: GREETING
evaluateAst() has no Node\Stmt\Const_ branch, so it falls through to the catch-all at src/Functions/evaluation.php:286. define() and class constants both work; only the const keyword at statement level is missing.
This blocks acceptance coverage for three PHP 8.5 features, all of which are about what may now appear in a constant expression:
- closures in constant expressions -
const CB = static function () { return 42; };
- first-class callables in constant expressions -
const SL = strlen(...);
- casts in constant expressions -
const T = (int) 0.3;
and one more that needs the same statement type:
- attributes on global constants, including
#[\Deprecated] on a constant
Worth deciding how a redeclared constant should behave, since re-entering a line is normal in a REPL and PHP 8.5 deprecates constant redeclaration.
Top-level
constdeclarations are not implemented:evaluateAst()has noNode\Stmt\Const_branch, so it falls through to the catch-all atsrc/Functions/evaluation.php:286.define()and class constants both work; only theconstkeyword at statement level is missing.This blocks acceptance coverage for three PHP 8.5 features, all of which are about what may now appear in a constant expression:
const CB = static function () { return 42; };const SL = strlen(...);const T = (int) 0.3;and one more that needs the same statement type:
#[\Deprecated]on a constantWorth deciding how a redeclared constant should behave, since re-entering a line is normal in a REPL and PHP 8.5 deprecates constant redeclaration.