Completed
Push — 1.2-symfony-4.0-application ( d46553...d27db6 )
by Kamil
22:00
created

WinzouStateMachinePass::process()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 5
nc 3
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler;
6
7
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
10
11
/**
12
 * Marks WinzouStateMachineBundle's services as public for compatibility with both Symfony 3.4 and 4.0+.
13
 *
14
 * @see https://github.com/winzou/StateMachineBundle/pull/44
15
 */
16
final class WinzouStateMachinePass implements CompilerPassInterface
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function process(ContainerBuilder $container): void
22
    {
23
        foreach (['sm.factory', 'sm.callback_factory', 'sm.callback.cascade_transition'] as $id) {
24
            try {
25
                $container->findDefinition($id)->setPublic(true);
26
            } catch (ServiceNotFoundException $exception) {}
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
Bug introduced by
The class Symfony\Component\Depend...erviceNotFoundException does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
27
        }
28
    }
29
}
30