Total Complexity | 5 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
16 | final class InterfaceBecameClass implements InterfaceBased |
||
17 | { |
||
18 | public function compare(ReflectionClass $fromClass, ReflectionClass $toClass) : Changes |
||
19 | { |
||
20 | if (! $this->isClass($toClass) || ! $fromClass->isInterface()) { |
||
21 | // checking whether a class became an interface is done in `ClassBecameInterface` |
||
22 | return Changes::new(); |
||
23 | } |
||
24 | |||
25 | return Changes::fromArray([Change::changed( |
||
26 | sprintf('Interface %s became a class', $fromClass->getName()), |
||
27 | true |
||
28 | ), |
||
29 | ]); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * According to the current state of the PHP ecosystem, we only have traits, interfaces and classes |
||
34 | */ |
||
35 | private function isClass(ReflectionClass $class) : bool |
||
38 | } |
||
39 | } |
||
40 |