Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 52fb4de

Browse filesBrowse files
committed
[FrameworkBundle] Check for class existance before is_subclass_of
1 parent 053d67b commit 52fb4de
Copy full SHA for 52fb4de

File tree

1 file changed

+5
-0
lines changed
Filter options

1 file changed

+5
-0
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConsoleCommandPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConsoleCommandPass.php
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1515
use Symfony\Component\DependencyInjection\ContainerBuilder;
16+
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
1617

1718
/**
1819
* AddConsoleCommandPass.
@@ -38,6 +39,10 @@ public function process(ContainerBuilder $container)
3839

3940
$class = $container->getParameterBag()->resolveValue($definition->getClass());
4041
if (!is_subclass_of($class, 'Symfony\\Component\\Console\\Command\\Command')) {
42+
if (!class_exists($class, false)) {
43+
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
44+
}
45+
4146
throw new \InvalidArgumentException(sprintf('The service "%s" tagged "console.command" must be a subclass of "Symfony\\Component\\Console\\Command\\Command".', $id));
4247
}
4348
$container->setAlias('console.command.'.strtolower(str_replace('\\', '_', $class)), $id);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.