OnlyProtectedMethodChanged::__invoke()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 2
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased;
6
7
use Roave\BackwardCompatibility\Changes;
8
use Roave\BetterReflection\Reflection\ReflectionMethod;
9
10
/**
11
 * Performs a method BC compliance check on methods that are protected
12
 */
13
final class OnlyProtectedMethodChanged implements MethodBased
14
{
15
    /** @var MethodBased */
16
    private $check;
17
18
    public function __construct(MethodBased $check)
19
    {
20
        $this->check = $check;
21
    }
22
23
    public function __invoke(ReflectionMethod $fromMethod, ReflectionMethod $toMethod) : Changes
24
    {
25
        if (! $fromMethod->isProtected()) {
26
            return Changes::empty();
27
        }
28
29
        return $this->check->__invoke($fromMethod, $toMethod);
30
    }
31
}
32