Passed
Pull Request — master (#92)
by Marco
02:50
created

SkipInterfaceBasedErrors::__construct()   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 1
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\InterfaceBased;
6
7
use Roave\BackwardCompatibility\Change;
8
use Roave\BackwardCompatibility\Changes;
9
use Roave\BetterReflection\Reflection\ReflectionClass;
10
use Throwable;
11
12
final class SkipInterfaceBasedErrors implements InterfaceBased
13
{
14
    /** @var InterfaceBased */
15
    private $next;
16
17
    public function __construct(InterfaceBased $next)
18
    {
19
        $this->next = $next;
20
    }
21
22
    public function __invoke(ReflectionClass $fromInterface, ReflectionClass $toInterface) : Changes
23
    {
24
        try {
25
            return $this->next->__invoke($fromInterface, $toInterface);
26
        } catch (Throwable $failure) {
27
            return Changes::fromList(Change::skippedDueToFailure($failure));
28
        }
29
    }
30
}
31