Skip to content

Commit 2c615a7

Browse files
committed
pass return type arround when re-creating context
1 parent 2587cc7 commit 2c615a7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Analyser/TypeSpecifier.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ private function specifyTypesForConstantBinaryExpression(
11761176
return $types->unionWith($this->specifyTypesInCondition(
11771177
$scope,
11781178
$exprNode,
1179-
$context->true() ? TypeSpecifierContext::createTrue() : TypeSpecifierContext::createTrue()->negate(),
1179+
$context->true() ? TypeSpecifierContext::createTrue($context->getReturnType()) : TypeSpecifierContext::createTrue($context->getReturnType())->negate(),
11801180
)->setRootExpr($rootExpr));
11811181
}
11821182

@@ -1976,7 +1976,7 @@ public function resolveEqual(Expr\BinaryOp\Equal $expr, Scope $scope, TypeSpecif
19761976
return $this->specifyTypesInCondition(
19771977
$scope,
19781978
$exprNode,
1979-
$context->true() ? TypeSpecifierContext::createFalsey() : TypeSpecifierContext::createFalsey()->negate(),
1979+
$context->true() ? TypeSpecifierContext::createFalsey($context->getReturnType()) : TypeSpecifierContext::createFalsey($context->getReturnType())->negate(),
19801980
)->setRootExpr($expr);
19811981
}
19821982

src/Type/Php/InArrayFunctionTypeSpecifyingExtension.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public function specifyTypes(FunctionReflection $functionReflection, FuncCall $n
147147
$specifiedTypes = $specifiedTypes->unionWith($this->typeSpecifier->create(
148148
$node->getArgs()[1]->value,
149149
new ArrayType(new MixedType(), $arrayValueType),
150-
TypeSpecifierContext::createTrue(),
150+
TypeSpecifierContext::createTrue($context->getReturnType()),
151151
$scope,
152152
));
153153
}

0 commit comments

Comments
 (0)