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

SkipInterfaceBasedErrors   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 6 2
A __construct() 0 3 1
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