SwagTestWithBundle   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 11
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getAdditionalBundles() 0 9 1
1
<?php declare(strict_types=1);
2
3
namespace SwagTestWithBundle;
4
5
use Shopware\Core\Framework\Parameter\AdditionalBundleParameters;
6
use Shopware\Core\Framework\Plugin;
7
use Shopware\Core\Framework\Test\Plugin\_fixture\bundles\FooBarBundle;
8
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
9
10
class SwagTestWithBundle extends Plugin
11
{
12
    public function getAdditionalBundles(AdditionalBundleParameters $parameters): array
13
    {
14
        require_once __DIR__ . '/../../../bundles/FooBarBundle.php';
15
16
        return [
0 ignored issues
show
Bug Best Practice introduced by
The expression return array(new Symfony...bundles\FooBarBundle()) returns the type array<integer,Shopware\C...Bundle\FrameworkBundle> which is incompatible with the return type mandated by Shopware\Core\Framework\...:getAdditionalBundles() of Shopware\Core\Framework\Bundle[].

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...
17
            // is already provided externally and should not be loaded
18
            new FrameworkBundle(),
19
            // is already provided by SwagTest and should not be loaded twice
20
            new FooBarBundle(),
21
        ];
22
    }
23
}
24