Completed
Push — final-forms ( 80b973...cafa21 )
by Kamil
35:41 queued 17:05
created

SyliusLocaleExtension::prepend()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
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 Sylius\Bundle\LocaleBundle\DependencyInjection;
13
14
use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension;
15
use Symfony\Component\Config\FileLocator;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
18
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
19
use Symfony\Component\DependencyInjection\Reference;
20
21
/**
22
 * @author Paweł Jędrzejewski <[email protected]>
23
 */
24
final class SyliusLocaleExtension extends AbstractResourceExtension
25
{
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function load(array $config, ContainerBuilder $container)
30
    {
31
        $config = $this->processConfiguration($this->getConfiguration($config, $container), $config);
0 ignored issues
show
Documentation introduced by
$this->getConfiguration($config, $container) is of type object|null, but the function expects a object<Symfony\Component...ConfigurationInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
32
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
33
34
        $this->registerResources('sylius', $config['driver'], $config['resources'], $container);
35
36
        $loader->load('services.xml');
37
38
        $container->setParameter('sylius_locale.locale', $config['locale']);
39
40
        $container->findDefinition('sylius.repository.locale')->setLazy(true);
41
    }
42
}
43