Passed
Pull Request — master (#108)
by Marco
02:35
created

MultipleChecksOnAProperty::__invoke()   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 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased;
6
7
use Roave\BackwardCompatibility\Change;
8
use Roave\BackwardCompatibility\Changes;
9
use Roave\BetterReflection\Reflection\ReflectionProperty;
10
11
final class MultipleChecksOnAProperty implements PropertyBased
12
{
13
    /** @var PropertyBased[] */
14
    private $checks;
15
16
    public function __construct(PropertyBased ...$checks)
17
    {
18
        $this->checks = $checks;
19
    }
20
21
    public function __invoke(ReflectionProperty $fromProperty, ReflectionProperty $toProperty) : Changes
22
    {
23
        return Changes::fromIterator($this->multipleChecks($fromProperty, $toProperty));
24
    }
25
26
    /** @return iterable|Change[] */
27
    private function multipleChecks(ReflectionProperty $fromProperty, ReflectionProperty $toProperty) : iterable
28
    {
29
        foreach ($this->checks as $check) {
30
            yield from $check->__invoke($fromProperty, $toProperty);
0 ignored issues
show
Bug Best Practice introduced by
The expression YieldFromNode returns the type Generator which is incompatible with the documented return type iterable|Roave\BackwardCompatibility\Change[].
Loading history...
31
        }
32
    }
33
}
34