| Total Complexity | 3 |
| Total Lines | 24 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | final class ConstantRemoved implements ClassBased |
||
| 14 | { |
||
| 15 | public function compare(ReflectionClass $fromClass, ReflectionClass $toClass) : Changes |
||
| 16 | { |
||
| 17 | Assert::that($fromClass->getName())->same($toClass->getName()); |
||
| 18 | |||
| 19 | $removedMethods = array_diff_key( |
||
| 20 | $this->accessibleConstants($fromClass), |
||
| 21 | $this->accessibleConstants($toClass) |
||
| 22 | ); |
||
| 23 | |||
| 24 | return Changes::fromArray(array_values(array_map(function (ReflectionClassConstant $constant) use ($fromClass) : Change { |
||
| 25 | return Change::removed( |
||
| 26 | sprintf('Constant %s::%s was removed', $fromClass->getName(), $constant->getName()), |
||
| 27 | true |
||
| 28 | ); |
||
| 29 | }, $removedMethods))); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** @return ReflectionClassConstant[] */ |
||
| 33 | private function accessibleConstants(ReflectionClass $class) : array |
||
| 37 | }); |
||
| 38 | } |
||
| 39 | } |