We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 03309cb commit 4825926Copy full SHA for 4825926
src/type/CompoundType.php
@@ -50,7 +50,7 @@ public static function buildFromTypes(array $types): Type {
50
}
51
52
if(count($uniqueTypes) === 1) {
53
- return $uniqueTypes[0];
+ return $uniqueTypes[0]->setRestrictedValues(null);
54
} else {
55
return new CompoundType($uniqueTypes);
56
test/type/CompoundTypeTest.php
@@ -18,4 +18,9 @@ public function testTruthy(): void {
18
$formula = new Formula('var a = func(); a = 0; return a;', $scope);
19
$this->assertEquals(0, $formula->calculate()->toPHPValue());
20
21
+
22
+ public function testNoValueRestrictions(): void {
23
+ $formula = new Formula('true ? 1 : 2');
24
+ $this->assertNull($formula->getReturnType()->getRestrictedValues());
25
+ }
26
0 commit comments