| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass) : Changes |
||
| 21 | { |
||
| 22 | $removedAncestors = array_merge( |
||
| 23 | array_diff($fromClass->getInterfaceNames(), $toClass->getInterfaceNames()) |
||
| 24 | ); |
||
| 25 | |||
| 26 | if (! $removedAncestors) { |
||
|
|
|||
| 27 | return Changes::empty(); |
||
| 28 | } |
||
| 29 | |||
| 30 | return Changes::fromList(Change::removed( |
||
| 31 | sprintf( |
||
| 32 | 'These ancestors of %s have been removed: %s', |
||
| 33 | $fromClass->getName(), |
||
| 34 | json_encode($removedAncestors) |
||
| 35 | ), |
||
| 36 | true |
||
| 37 | )); |
||
| 40 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.