Completed
Push — master ( d81c19...f57266 )
by Kamil
20s
created

Bundle/FixturesBundle/Loader/SuiteLoader.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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
declare(strict_types=1);
13
14
namespace Sylius\Bundle\FixturesBundle\Loader;
15
16
use Sylius\Bundle\FixturesBundle\Fixture\FixtureInterface;
17
use Sylius\Bundle\FixturesBundle\Suite\SuiteInterface;
18
19
final class SuiteLoader implements SuiteLoaderInterface
20
{
21
    /**
22
     * @var FixtureLoaderInterface
23
     */
24
    private $fixtureLoader;
25
26
    /**
27
     * @param FixtureLoaderInterface $fixtureLoader
28
     */
29
    public function __construct(FixtureLoaderInterface $fixtureLoader)
30
    {
31
        $this->fixtureLoader = $fixtureLoader;
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function load(SuiteInterface $suite): void
38
    {
39
        /** @var FixtureInterface $fixture */
40
        /** @var array $fixtureOptions */
41
        foreach ($suite->getFixtures() as $fixture => $fixtureOptions) {
42
            $this->fixtureLoader->load($suite, $fixture, $fixtureOptions);
0 ignored issues
show
$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...
43
        }
44
    }
45
}
46