1
0
mirror of https://github.com/php/phd.git synced 2026-03-23 22:52:05 +01:00

Modify autoloader signature per spl_autoload_register docs

https://www.php.net/manual/en/function.spl-autoload-register.php
This commit is contained in:
Anna Filina
2025-10-16 19:11:45 -04:00
committed by Tim Düsterhus
parent d2874c005c
commit ae9107bcd8

View File

@@ -8,7 +8,7 @@ class Autoloader
*/
private static array $package_dirs = [];
public static function autoload($name)
public static function autoload(string $name): void
{
// Only try autoloading classes we know about (i.e. from our own namespace)
if (strncmp('phpdotnet\phd\\', $name, 14) === 0) {
@@ -24,12 +24,10 @@ class Autoloader
fclose($fp);
require $file;
return false;
return;
}
trigger_error(vsprintf('Cannot find file for %s: %s', [$name, $file ?? $filename]), E_USER_ERROR);
}
return false;
}
/**