Failed Conditions
Pull Request — new-parser-ast-metadata (#2)
by
unknown
02:08
created

Instantiator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 8
dl 0
loc 21
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A instantiate() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Annotations\Constructor\Instantiator;
6
7
use Doctrine\Annotations\Metadata\AnnotationMetadata;
8
9
final class Instantiator
10
{
11
    /** @var ConstructorInstantiatorStrategy */
12
    private $constructor;
13
14
    /** @var PropertyInstantiatorStrategy */
15
    private $property;
16
17 9
    public function __construct(ConstructorInstantiatorStrategy $constructor, PropertyInstantiatorStrategy $property)
18
    {
19 9
        $this->constructor = $constructor;
20 9
        $this->property    = $property;
21 9
    }
22
23 9
    public function instantiate(AnnotationMetadata $metadata, iterable $parameters) : object
24
    {
25 9
        if ($metadata->hasConstructor()) {
26 6
            return $this->constructor->construct($metadata, $parameters);
0 ignored issues
show
Bug introduced by
$parameters of type iterable is incompatible with the type array expected by parameter $parameters of Doctrine\Annotations\Con...orStrategy::construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

26
            return $this->constructor->construct($metadata, /** @scrutinizer ignore-type */ $parameters);
Loading history...
27
        }
28
29 9
        return $this->property->construct($metadata, $parameters);
0 ignored issues
show
Bug introduced by
$parameters of type iterable is incompatible with the type array expected by parameter $parameters of Doctrine\Annotations\Con...orStrategy::construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

29
        return $this->property->construct($metadata, /** @scrutinizer ignore-type */ $parameters);
Loading history...
30
    }
31
}
32