Completed
Push — to-be-a-hat-or-not-to-be-kuhwa ( 7c7f7b...b72886 )
by Kamil
20:35
created

SyliusPromotionExtension::overwriteCouponFactory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
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\PromotionBundle\DependencyInjection;
13
14
use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension;
15
use Sylius\Component\Resource\Factory\Factory;
16
use Symfony\Component\Config\FileLocator;
17
use Symfony\Component\DependencyInjection\ContainerBuilder;
18
use Symfony\Component\DependencyInjection\Definition;
19
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
20
use Symfony\Component\DependencyInjection\Parameter;
21
use Symfony\Component\DependencyInjection\Reference;
22
23
/**
24
 * @author Saša Stamenković <[email protected]>
25
 */
26
final class SyliusPromotionExtension extends AbstractResourceExtension
27
{
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function load(array $config, ContainerBuilder $container)
32
    {
33
        $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...
34
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
35
36
        $this->mapFormValidationGroupsParameters($config, $container);
37
38
        $loader->load('services.xml');
39
        $loader->load(sprintf('services/integrations/%s.xml', $config['driver']));
40
41
        $this->registerResources('sylius', $config['driver'], $config['resources'], $container);
42
43
        $container
44
            ->getDefinition('sylius.form.type.promotion_action')
45
            ->replaceArgument(1, new Reference('sylius.registry_promotion_action'))
46
        ;
47
        $container
48
            ->getDefinition('sylius.form.type.promotion_rule')
49
            ->replaceArgument(1, new Reference('sylius.registry_promotion_rule_checker'))
50
        ;
51
    }
52
}
53