Completed
Push — chain-config-resolver-tests ( f53a81 )
by
unknown
16:09
created

DefaultScopeConfigResolverTest::getResolver()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace eZ\Bundle\EzPublishCoreBundle\Tests\DependencyInjection\Configuration\ConfigResolver;
10
11
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver\DefaultScopeConfigResolver;
12
use eZ\Publish\Core\MVC\ConfigResolverInterface;
13
14
class DefaultScopeConfigResolverTest extends ConfigResolverTest
15
{
16
    protected function getResolver(string $defaultNamespace = self::DEFAULT_NAMESPACE): ConfigResolverInterface
17
    {
18
        $configResolver = new DefaultScopeConfigResolver(
19
            $defaultNamespace
20
        );
21
        $configResolver->setContainer($this->containerMock);
0 ignored issues
show
Bug introduced by
It seems like $this->containerMock can also be of type object<PHPUnit\Framework\MockObject\MockObject>; however, Symfony\Component\Depend...reTrait::setContainer() does only seem to accept null|object<Symfony\Comp...ion\ContainerInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
22
23
        return $configResolver;
24
    }
25
26
    protected function getScope(): string
27
    {
28
        return 'default';
29
    }
30
}
31