MultipleChecksOnAClassConstant::multipleChecks()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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