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

SkipTraitBasedErrors::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 2
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Roave\BackwardCompatibility\DetectChanges\BCBreak\TraitBased;
6
7
use Roave\BackwardCompatibility\Change;
8
use Roave\BackwardCompatibility\Changes;
9
use Roave\BetterReflection\Reflection\ReflectionClass;
10
use Throwable;
11
12
final class SkipTraitBasedErrors implements TraitBased
13
{
14
    /** @var TraitBased */
15
    private $next;
16
17
    public function __construct(TraitBased $next)
18
    {
19
        $this->next = $next;
20
    }
21
22
    public function __invoke(ReflectionClass $fromTrait, ReflectionClass $toTrait) : Changes
23
    {
24
        try {
25
            return $this->next->__invoke($fromTrait, $toTrait);
26
        } catch (Throwable $failure) {
27
            return Changes::fromList(Change::skippedDueToFailure($failure));
28
        }
29
    }
30
}
31