Skip to content

Commit d567978

Browse files
authored
chore(meta): ignore abstracts in the autoloader (Fixes #1671) (#1686)
1 parent 09623f2 commit d567978

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Console/MetaCommand.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,19 @@ protected function getAbstracts()
192192
*/
193193
protected function registerClassAutoloadExceptions(): callable
194194
{
195-
$autoloader = function ($class) {
195+
$aliases = array_filter([...$this->getAbstracts(), 'config'], fn ($abstract) => !str_contains($abstract, '\\'));
196+
197+
$autoloader = function ($class) use ($aliases) {
198+
// ignore aliases as they're meant to be resolved elsewhere
199+
if (in_array($class, $aliases, true)) {
200+
return;
201+
}
202+
196203
throw new \ReflectionException("Class '$class' not found.");
197204
};
205+
198206
spl_autoload_register($autoloader);
207+
199208
return $autoloader;
200209
}
201210

0 commit comments

Comments
 (0)