Total Complexity | 4 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
16 | final class PropertyScopeChanged implements PropertyBased |
||
17 | { |
||
18 | public function compare(ReflectionProperty $fromProperty, ReflectionProperty $toProperty) : Changes |
||
19 | { |
||
20 | $fromScope = $this->scopeAsString($fromProperty); |
||
21 | $toScope = $this->scopeAsString($toProperty); |
||
22 | |||
23 | if ($fromScope === $toScope) { |
||
24 | return Changes::new(); |
||
25 | } |
||
26 | |||
27 | return Changes::fromArray([ |
||
28 | Change::changed( |
||
29 | sprintf( |
||
30 | 'Property $%s of %s changed scope from %s to %s', |
||
31 | $fromProperty->getName(), |
||
32 | $fromProperty->getDeclaringClass()->getName(), |
||
33 | $fromScope, |
||
34 | $toScope |
||
35 | ), |
||
36 | true |
||
37 | ), |
||
38 | ]); |
||
39 | } |
||
40 | |||
41 | private function scopeAsString(ReflectionProperty $property) : string |
||
44 | } |
||
45 | } |
||
46 |