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

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