[FrameworkBundle] Check for class existence before is_subclass_of
This commit is contained in:
parent
053d67bcab
commit
8a9e0f526d
@ -38,6 +38,10 @@ class AddConsoleCommandPass implements CompilerPassInterface
|
|||||||
|
|
||||||
$class = $container->getParameterBag()->resolveValue($definition->getClass());
|
$class = $container->getParameterBag()->resolveValue($definition->getClass());
|
||||||
if (!is_subclass_of($class, 'Symfony\\Component\\Console\\Command\\Command')) {
|
if (!is_subclass_of($class, 'Symfony\\Component\\Console\\Command\\Command')) {
|
||||||
|
if (!class_exists($class, false)) {
|
||||||
|
throw new \InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
|
||||||
|
}
|
||||||
|
|
||||||
throw new \InvalidArgumentException(sprintf('The service "%s" tagged "console.command" must be a subclass of "Symfony\\Component\\Console\\Command\\Command".', $id));
|
throw new \InvalidArgumentException(sprintf('The service "%s" tagged "console.command" must be a subclass of "Symfony\\Component\\Console\\Command\\Command".', $id));
|
||||||
}
|
}
|
||||||
$container->setAlias('console.command.'.strtolower(str_replace('\\', '_', $class)), $id);
|
$container->setAlias('console.command.'.strtolower(str_replace('\\', '_', $class)), $id);
|
||||||
|
Reference in New Issue
Block a user