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