Description
In PHP you can use classes and functions before they're declared, as long as they are parsed, like
<?php
f();
function f(){}
$o = new C();
class C{};
It was surprising that Enums cannot:
<?php
$o = e::a;
enum e{
case a;
}
https://3v4l.org/I99NU Resulted in this output:
Fatal error: Uncaught Error: Class "e" not found in php-wasm run script:2
Stack trace:
#0 {main}
thrown in php-wasm run script on line 2
So I wonder, is that intentional or not?
PHP Version
PHP 8.3.13
Operating System
No response