Failed Conditions
Pull Request — 0.3 (#11)
by jean
15:05
created

RemoveUnconfigurableStepCompilerPass::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Darkilliant\ProcessBundle\DependencyInjection\CompilerPass;
6
7
use Darkilliant\ImportBundle\Normalizer\EntityNormalizer;
0 ignored issues
show
Bug introduced by
The type Darkilliant\ImportBundle...alizer\EntityNormalizer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Darkilliant\ImportBundle\Persister\DoctrinePersister;
9
use Darkilliant\ImportBundle\Step\ArrayTargetResolverStep;
10
use Darkilliant\ImportBundle\Step\DoctrinePersisterStep;
11
use Darkilliant\ImportBundle\Step\LoadObjectNormalizedStep;
12
use Darkilliant\ImportBundle\Step\LoadObjectStep;
13
use Darkilliant\ImportBundle\TargetResolver\ArrayTargetResolver;
14
use Darkilliant\ImportBundle\TargetResolver\DoctrineTargetResolver;
15
use Darkilliant\ProcessBundle\Filter\ValidatorFilter;
16
use Darkilliant\ProcessBundle\Step\ValidateObjectStep;
17
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
18
use Symfony\Component\DependencyInjection\ContainerBuilder;
19
use Symfony\Component\Validator\Validator\ValidatorInterface;
20
21
/**
22
 * @internal
23
 */
24
class RemoveUnconfigurableStepCompilerPass implements CompilerPassInterface
25
{
26
    public function process(ContainerBuilder $container)
27
    {
28
        // Service depends of validator
29
        if (!$container->hasDefinition('validator')) {
30
            $container->removeDefinition(ValidateObjectStep::class);
31
            $container->removeDefinition(ValidatorFilter::class);
32
        }
33
    }
34
}
35