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

Instantiator::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
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