Skip to content
Merged

Fix CS #5990

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/Type/Php/ExplodeFunctionDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,18 @@ public function getTypeFromFunctionCall(

$limitType = isset($args[2]) ? $scope->getType($args[2]->value) : null;

if ($this->isDelimiterGuaranteedPresent($args, $scope) && ($limitType === null || IntegerRangeType::fromInterval(2, null)->isSuperTypeOf($limitType)->yes())) {
if (
$this->isDelimiterGuaranteedPresent($args, $scope)
&& ($limitType === null || IntegerRangeType::fromInterval(2, null)->isSuperTypeOf($limitType)->yes())
) {
$returnType = $this->createGuaranteedSplitType($returnValueType, $limitType);
} else {
$returnType = new IntersectionType([new ArrayType(IntegerRangeType::createAllGreaterThanOrEqualTo(0), $returnValueType), new AccessoryArrayListType()]);

if ($limitType === null || IntegerRangeType::fromInterval(0, null)->isSuperTypeOf($limitType)->yes()) {
if (
$limitType === null
|| IntegerRangeType::fromInterval(0, null)->isSuperTypeOf($limitType)->yes()
) {
$returnType = TypeCombinator::intersect($returnType, new NonEmptyArrayType());
}
}
Expand Down
Loading