Use is_subclass_of instead of reflection

This commit is contained in:
Ener-Getick 2016-01-16 14:49:05 +01:00
parent 8d7b19fbbe
commit 5af5d06f2e
1 changed files with 1 additions and 2 deletions

View File

@ -37,8 +37,7 @@ class AddConsoleCommandPass implements CompilerPassInterface
}
$class = $container->getParameterBag()->resolveValue($definition->getClass());
$r = new \ReflectionClass($class);
if (!$r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command')) {
if (!is_subclass_of($class, 'Symfony\\Component\\Console\\Command\\Command')) {
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);