Skip to content

Commit 0b4b6cb

Browse files
committed
fix
1 parent 58dc99a commit 0b4b6cb

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/Analyser/TypeSpecifier.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,13 +457,13 @@ public function specifyTypesInCondition(
457457
) {
458458
$newScope = $scope->filterBySpecifiedTypes($result);
459459
$callType = $newScope->getType($expr->right);
460-
$newContext = TypeSpecifierContext::createTrue($callType);
460+
$newContext = TypeSpecifierContext::createTruthy($callType);
461461

462-
return $this->specifyTypesInCondition(
462+
$result = $result->unionWith($this->specifyTypesInCondition(
463463
$scope,
464464
$expr->right,
465465
$newContext,
466-
)->setRootExpr($expr);
466+
)->setRootExpr($expr));
467467
}
468468

469469
return $result;

src/Analyser/TypeSpecifierContext.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,19 @@ public static function createTrue(?Type $returnType = null): self
4545
return self::create(self::CONTEXT_TRUE, $returnType);
4646
}
4747

48-
public static function createTruthy(): self
48+
public static function createTruthy(?Type $returnType = null): self
4949
{
50-
return self::create(self::CONTEXT_TRUTHY);
50+
return self::create(self::CONTEXT_TRUTHY, $returnType);
5151
}
5252

5353
public static function createFalse(?Type $returnType = null): self
5454
{
5555
return self::create(self::CONTEXT_FALSE, $returnType);
5656
}
5757

58-
public static function createFalsey(): self
58+
public static function createFalsey(?Type $returnType = null): self
5959
{
60-
return self::create(self::CONTEXT_FALSEY);
60+
return self::create(self::CONTEXT_FALSEY, $returnType);
6161
}
6262

6363
public static function createNull(): self

0 commit comments

Comments
 (0)