Skip to content

Commit f19b5fd

Browse files
committed
Fixed bug for class instance properties which are assignable
1 parent 5350d9b commit f19b5fd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/type/Type.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ abstract class Type implements OperatorMeta, FormulaPart {
2424
* Otherwise null.
2525
* @var array<Value>|null
2626
*/
27-
private ?array $restrictedValues;
27+
private ?array $restrictedValues = null;
2828

2929
public function __construct(?array $restrictedValues = null) {
3030
$this->restrictedValues = $restrictedValues;
@@ -128,7 +128,9 @@ public function getOperatorResultType(ImplementableOperator $operator, ?Type $ot
128128
$valueA = $this->restrictedValues[0];
129129
$valueB = $otherRestrictedValues[0];
130130
try {
131-
$type = $type->setRestrictedValues([$valueA->operate($operator, $valueB)]);
131+
if(!$type->isAssignable()) {
132+
$type = $type->setRestrictedValues([$valueA->operate($operator, $valueB)]);
133+
}
132134
} catch (FormulaRuntimeException) { // catch division by zero and similar
133135
$type = $type->setRestrictedValues(null);
134136
}

0 commit comments

Comments
 (0)