Passed
Push — akeneo5 ( fc324e...9b9c46 )
by Pascal
04:49
created

TestKernel::getProjectDir()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Flagbit\Bundle\ProductClonerBundle\Test\Kernel;
6
7
require_once __DIR__.'/../../vendor/akeneo/pim-community-dev/src/Kernel.php';
8
9
use Kernel;
10
11
/**
12
 * Test kernel used for integration tests
13
 */
14
class TestKernel extends Kernel
15
{
16
    /**
17
     * {@inheritDoc}
18
     *
19
     * @return iterable
20
     */
21
    public function registerBundles(): iterable
22
    {
23
        $bundles = require __DIR__ . '/../../vendor/akeneo/pim-community-dev/config/bundles.php';
24
        $bundles += require __DIR__ . '/config/bundles.php';
25
26
        foreach ($bundles as $class => $envs) {
27
            if ($envs[$this->environment] ?? $envs['all'] ?? false) {
28
                yield new $class();
0 ignored issues
show
Bug Best Practice introduced by
The expression yield new $class() returns the type Generator which is incompatible with the return type mandated by Symfony\Component\HttpKe...face::registerBundles() of Symfony\Component\HttpKe...dleInterface[]|iterable.

In the issue above, the returned value is violating the contract defined by the mentioned interface.

Let's take a look at an example:

interface HasName {
    /** @return string */
    public function getName();
}

class Name {
    public $name;
}

class User implements HasName {
    /** @return string|Name */
    public function getName() {
        return new Name('foo'); // This is a violation of the ``HasName`` interface
                                // which only allows a string value to be returned.
    }
}
Loading history...
29
            }
30
        }
31
    }
32
33
    /**
34
     * {@inheritDoc}
35
     *
36
     * @return string
37
     */
38
    public function getRootDir(): string
39
    {
40
        return __DIR__;
41
    }
42
43
    /**
44
     * {@inheritDoc}
45
     *
46
     * @return string
47
     */
48
    public function getProjectDir(): string
49
    {
50
        return __DIR__;
51
    }
52
}
53