chore(meta): ignore abstracts in the autoloader (Fixes #1671) (#1686)

This commit is contained in:
Pieter Willekens
2025-02-27 20:19:11 +01:00
committed by GitHub
parent 09623f216c
commit d567978ebe
+10 -1
View File
@@ -192,10 +192,19 @@ class MetaCommand extends Command
*/
protected function registerClassAutoloadExceptions(): callable
{
$autoloader = function ($class) {
$aliases = array_filter([...$this->getAbstracts(), 'config'], fn ($abstract) => !str_contains($abstract, '\\'));
$autoloader = function ($class) use ($aliases) {
// ignore aliases as they're meant to be resolved elsewhere
if (in_array($class, $aliases, true)) {
return;
}
throw new \ReflectionException("Class '$class' not found.");
};
spl_autoload_register($autoloader);
return $autoloader;
}