8000 Extend from moved CompilerPass · symfony/symfony@e7f2763 · GitHub
[go: up one dir, main page]

Skip to content

Commit e7f2763

Browse files
committed
Extend from moved CompilerPass
1 parent 52e24c3 commit e7f2763

File tree

3 files changed

+7
-40
lines changed

3 files changed

+7
-40
lines changed

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

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
1313

14-
@trigger_error(sprintf('%s is deprecated as of 3.2 and will be removed in 4.0. Use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass instead.', AddConsoleCommandPass::class), E_USER_DEPRECATED);
14+
@trigger_error(sprintf('%s is deprecated since version 3.2 and will be removed in 4.0. Use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass instead.', AddConsoleCommandPass::class), E_USER_DEPRECATED);
1515

16-
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
17-
use Symfony\Component\DependencyInjection\ContainerBuilder;
18-
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
16+
use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass as BaseAddConsoleCommandPass;
1917

2018
/**
2119
* Registers console commands.
@@ -24,32 +22,6 @@
2422
*
2523
* @deprecated since version 3.2, to be removed in 4.0. Use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass instead.
2624
*/
27-
class AddConsoleCommandPass implements CompilerPassInterface
25+
class AddConsoleCommandPass extends BaseAddConsoleCommandPass
2826
{
29-
public function process(ContainerBuilder $container)
30-
{
31-
$commandServices = $container->findTaggedServiceIds('console.command');
32-
$serviceIds = array();
33-
34-
foreach ($commandServices as $id => $tags) {
35-
$definition = $container->getDefinition($id);
36-
37-
if ($definition->isAbstract()) {
38-
throw new InvalidArgumentException(sprintf('The service "%s" tagged "console.command" must not be abstract.', $id));
39-
}
40-
41-
$class = $container->getParameterBag()->resolveValue($definition->getClass());
42-
if (!is_subclass_of($class, 'Symfony\\Component\\Console\\Command\\Command')) {
43-
if (!class_exists($class, false)) {
44-
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
45-
}
46-
47-
throw new InvalidArgumentException(sprintf('The service "%s" tagged "console.command" must be a subclass of "Symfony\\Component\\Console\\Command\\Command".', $id));
48-
}
49-
$container->setAlias($serviceId = 'console.command.'.strtolower(str_replace('\\', '_', $class)), $id);
50-
$serviceIds[] = $definition->isPublic() ? $id : $serviceId;
51-
}
52-
53-
$container->setParameter('console.command.ids', $serviceIds);
54-
}
5527
}

src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConstraintValidatorsPass;
1515
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddValidatorInitializersPass;
16-
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConsoleCommandPass as LegacyAddConsoleCommandPass;
1716
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolPass;
1817
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolClearerPass;
1918
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ControllerArgumentValueResolverPass;
@@ -93,12 +92,7 @@ public function build(ContainerBuilder $container)
9392
$container->addCompilerPass(new ControllerArgumentValueResolverPass());
9493
$container->addCompilerPass(new CachePoolPass());
9594
$container->addCompilerPass(new CachePoolClearerPass(), PassConfig::TYPE_AFTER_REMOVING);
96-
97-
if (class_exists(AddConsoleCommandPass::class)) {
98-
$container->addCompilerPass(new AddConsoleCommandPass());
99-
} else {
100-
$container->addCompilerPass(new LegacyAddConsoleCommandPass());
101-
}
95+
$container->addCompilerPass(new AddConsoleCommandPass());
10296

10397
if ($container->getParameter('kernel.debug')) {
10498
$container->addCompilerPass(new UnusedTagsPass(), PassConfig::TYPE_AFTER_REMOVING);

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"require-dev": {
3535
"symfony/asset": "~2.8|~3.0",
3636
"symfony/browser-kit": "~2.8|~3.0",
37-
"symfony/console": "~2.8.8|~3.0.8|~3.1.2|~3.2",
37+
"symfony/console": "~3.2",
3838
"symfony/css-selector": "~2.8|~3.0",
3939
"symfony/dom-crawler": "~2.8|~3.0",
4040
"symfony/polyfill-intl-icu": "~1.0",
@@ -56,7 +56,8 @@
5656
},
5757
"conflict": {
5858
"phpdocumentor/reflection-docblock": "<3.0",
59-
"phpdocumentor/type-resolver": "<0.2.0"
59+
"phpdocumentor/type-resolver": "<0.2.0",
60+
"symfony/console": "<3.2"
6061
},
6162
"suggest": {
6263
"ext-apcu": "For best performance of the system caches",

0 commit comments

Comments
 (0)
0