Description
The following code:
<?php
spl_autoload_register( function ( $class_name ) {
if ( $class_name === 'Foo' ) {
require __DIR__ . '/foo.php';
}
} );
try {
class_exists( Foo::class );
} catch ( Throwable $e ) {
echo 'catch' . PHP_EOL;
}
foo.php
Resulted in this output:
But I expected this output instead:
Change foo.php to
and you will get the expected output. It's not consistent/illogical that traits behave differently in this regard?
PHP Version
Operating System
No response