|
@@ 88-96 (lines=9) @@
|
| 85 |
|
* @return void |
| 86 |
|
* @throws TypeConflictException |
| 87 |
|
*/ |
| 88 |
|
private function validateListDirectRedefinition(AllowsTypeIndication $child, AllowsTypeIndication $parent): void |
| 89 |
|
{ |
| 90 |
|
$isBrokenDirectRedefinition = $parent->isList() && ! $child->isList(); |
| 91 |
|
|
| 92 |
|
if ($isBrokenDirectRedefinition) { |
| 93 |
|
$error = \sprintf('The %s cannot be overridden by non-list, but %s given', $parent, $child); |
| 94 |
|
throw new TypeConflictException($error, $this->getCallStack()); |
| 95 |
|
} |
| 96 |
|
} |
| 97 |
|
|
| 98 |
|
/** |
| 99 |
|
* Checks the following situations: |
|
@@ 116-124 (lines=9) @@
|
| 113 |
|
* @return void |
| 114 |
|
* @throws TypeConflictException |
| 115 |
|
*/ |
| 116 |
|
private function validateListInverseRedefinition(AllowsTypeIndication $child, AllowsTypeIndication $parent): void |
| 117 |
|
{ |
| 118 |
|
$isBrokenInverseRedefinition = ! $parent->isList() && $child->isList(); |
| 119 |
|
|
| 120 |
|
if ($isBrokenInverseRedefinition) { |
| 121 |
|
$error = \sprintf('The %s cannot be overridden by list, but %s given', $parent, $child); |
| 122 |
|
throw new TypeConflictException($error, $this->getCallStack()); |
| 123 |
|
} |
| 124 |
|
} |
| 125 |
|
|
| 126 |
|
/** |
| 127 |
|
* @param AllowsTypeIndication|DependentDefinition $child |