Test Failed
Push — adopt-factory ( 148ff1...ae50e8 )
by Alexander
05:07 queued 02:18
created

DependencyResolver::shouldCloneOnResolve()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Di;
6
7
use Psr\Container\ContainerExceptionInterface;
8
use Psr\Container\ContainerInterface;
9
use Psr\Container\NotFoundExceptionInterface;
10
use Yiisoft\Factory\DependencyResolverInterface;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Factory\DependencyResolverInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
12
/**
13
 * @internal
14
 */
15
final class DependencyResolver implements DependencyResolverInterface
16
{
17
    private ContainerInterface $container;
18
19
    public function __construct(ContainerInterface $container)
20
    {
21
        $this->container = $container;
22
    }
23
24
    /**
25
     * @param string $id
26
     *
27
     * @throws NotFoundExceptionInterface
28
     * @throws ContainerExceptionInterface
29
     *
30
     * @return mixed|object
31
     *
32
     * @psalm-suppress InvalidThrow
33
     */
34
    public function get($id)
35
    {
36
        return $this->container->get($id);
37
    }
38
39
    public function has($id): bool
40
    {
41
        return $this->container->has($id);
42
    }
43
44
    /**
45
     * @param string $id
46
     *
47
     * @throws NotFoundExceptionInterface
48
     * @throws ContainerExceptionInterface
49
     *
50
     * @return mixed|object
51
     *
52
     * @psalm-suppress InvalidThrow
53
     */
54
    public function resolve(string $id)
55
    {
56
        return $this->get($id);
57
    }
58
59
    public function shouldCloneOnResolve(): bool
60
    {
61
        return false;
62
    }
63
}
64