| Total Complexity | 3 |
| Total Lines | 22 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | final class ConstantRemoved implements ClassBased |
||
| 18 | { |
||
| 19 | public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass) : Changes |
||
| 20 | { |
||
| 21 | $removedConstants = array_diff_key( |
||
| 22 | $this->accessibleConstants($fromClass), |
||
| 23 | $this->accessibleConstants($toClass) |
||
| 24 | ); |
||
| 25 | |||
| 26 | return Changes::fromList(...array_values(array_map(static function (ReflectionClassConstant $constant) use ($fromClass) : Change { |
||
| 27 | return Change::removed( |
||
| 28 | sprintf('Constant %s::%s was removed', $fromClass->getName(), $constant->getName()), |
||
| 29 | true |
||
| 30 | ); |
||
| 31 | }, $removedConstants))); |
||
| 32 | } |
||
| 33 | |||
| 34 | /** @return ReflectionClassConstant[] */ |
||
| 35 | private function accessibleConstants(ReflectionClass $class) : array |
||
| 39 | }); |
||
| 40 | } |
||
| 42 |