| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | public function compare(ReflectionClassConstant $fromConstant, ReflectionClassConstant $toConstant) : Changes |
||
| 20 | { |
||
| 21 | $visibilityFrom = $this->propertyVisibility($fromConstant); |
||
| 22 | $visibilityTo = $this->propertyVisibility($toConstant); |
||
| 23 | |||
| 24 | // Works because private, protected and public are sortable: |
||
| 25 | if ($visibilityFrom <= $visibilityTo) { |
||
| 26 | return Changes::new(); |
||
| 27 | } |
||
| 28 | |||
| 29 | return Changes::fromArray([Change::changed( |
||
| 30 | sprintf( |
||
| 31 | 'Constant %s::%s visibility reduced from %s to %s', |
||
| 32 | $fromConstant->getDeclaringClass()->getName(), |
||
| 33 | $fromConstant->getName(), |
||
| 34 | $visibilityFrom, |
||
| 35 | $visibilityTo |
||
| 36 | ), |
||
| 37 | true |
||
| 38 | )]); |
||
| 54 |