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