Completed
Push — master ( ab8175...d69783 )
by Kamil
15s
created

SuiteLoader::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
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\FixturesBundle\Loader;
13
14
use Sylius\Bundle\FixturesBundle\Fixture\FixtureInterface;
15
use Sylius\Bundle\FixturesBundle\Suite\SuiteInterface;
16
17
/**
18
 * @author Kamil Kokot <[email protected]>
19
 */
20
final class SuiteLoader implements SuiteLoaderInterface
21
{
22
    /**
23
     * @var FixtureLoaderInterface
24
     */
25
    private $fixtureLoader;
26
27
    /**
28
     * @param FixtureLoaderInterface $fixtureLoader
29
     */
30
    public function __construct(FixtureLoaderInterface $fixtureLoader)
31
    {
32
        $this->fixtureLoader = $fixtureLoader;
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function load(SuiteInterface $suite)
39
    {
40
        /**
41
         * @var FixtureInterface $fixture
42
         * @var array $fixtureOptions
43
         */
44
        foreach ($suite->getFixtures() as $fixture => $fixtureOptions) {
45
            $this->fixtureLoader->load($suite, $fixture, $fixtureOptions);
0 ignored issues
show
Documentation introduced by
$fixture is of type integer|string, but the function expects a object<Sylius\Bundle\Fix...xture\FixtureInterface>.

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...
46
        }
47
    }
48
}
49