Skip to content

Commit 45a52ce

Browse files
herndlmondrejmirtes
authored andcommittedOct 6, 2024·
Simplify preserveKeys TrinaryLogic creation in 2 extensions
1 parent e2654b7 commit 45a52ce

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed
 

‎src/Type/Php/ArrayChunkFunctionReturnTypeExtension.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ public function getTypeFromFunctionCall(FunctionReflection $functionReflection,
4444
}
4545

4646
$preserveKeysType = isset($functionCall->getArgs()[2]) ? $scope->getType($functionCall->getArgs()[2]->value) : new ConstantBooleanType(false);
47-
$preserveKeys = (new ConstantBooleanType(true))->isSuperTypeOf($preserveKeysType);
4847

49-
return $arrayType->chunkArray($lengthType, $preserveKeys);
48+
return $arrayType->chunkArray($lengthType, $preserveKeysType->isTrue());
5049
}
5150

5251
}

‎src/Type/Php/ArrayReverseFunctionReturnTypeExtension.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ public function getTypeFromFunctionCall(FunctionReflection $functionReflection,
3636
}
3737

3838
$preserveKeysType = isset($functionCall->getArgs()[1]) ? $scope->getType($functionCall->getArgs()[1]->value) : new ConstantBooleanType(false);
39-
$preserveKeys = (new ConstantBooleanType(true))->isSuperTypeOf($preserveKeysType);
4039

41-
return $type->reverseArray($preserveKeys);
40+
return $type->reverseArray($preserveKeysType->isTrue());
4241
}
4342

4443
}

0 commit comments

Comments
 (0)
Please sign in to comment.