| Conditions | 3 |
| Paths | 3 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 27 | public function process(ContainerBuilder $container): void |
||
| 28 | { |
||
| 29 | if (!$container->has('psysh.shell')) { |
||
| 30 | return; |
||
| 31 | } |
||
| 32 | |||
| 33 | $commands = []; |
||
| 34 | |||
| 35 | foreach ($container->findTaggedServiceIds('psysh.command') as $id => $attributes) { |
||
| 36 | // Workaround to avoid Psysh commands to be registered as regular console commands |
||
| 37 | // (conflict with service autoconfiguration as Psysh commands inherit from |
||
| 38 | // \Symfony\Component\Console\Command\Command as well |
||
| 39 | // Note that this compiler pass must run with a higher priority than |
||
| 40 | // AddConsoleCommandPass to be efficient. |
||
| 41 | $container->findDefinition($id)->clearTag('console.command'); |
||
| 42 | $commands[] = new Reference($id); |
||
| 43 | } |
||
| 44 | |||
| 45 | $shellRef = $container->findDefinition('psysh.shell'); |
||
| 46 | $shellRef->addMethodCall('addCommands', [$commands]); |
||
| 47 | } |
||
| 48 | } |
||
| 49 |