Completed
Push — master ( 57209e...689d32 )
by Tobias
96:45 queued 61:24
created

FileDumperBackupPass::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.9666
cc 2
nc 2
nop 1
1
<?php
2
3
/*
4
 * This file is part of the PHP Translation package.
5
 *
6
 * (c) PHP Translation team <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Translation\Bundle\DependencyInjection\CompilerPass;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\HttpKernel\Kernel;
17
18
/**
19
 * The FileDumper::setBackup is deprecated since Symfony 4.1.
20
 * This compiler pass assures our service definition remains unchanged for older symfony versions (3 or lower)
21
 * while keeping the latest version clean of deprecation notices.
22
 */
23
class FileDumperBackupPass implements CompilerPassInterface
24
{
25
    public function process(ContainerBuilder $container)
26
    {
27
        if (Kernel::MAJOR_VERSION >= 4) {
28
            return;
29
        }
30
31
        $definition = $container->getDefinition('php_translation.storage.xlf_dumper');
32
        $definition->addMethodCall('setBackup', [false]);
33
    }
34
}
35