Skip to content

Commit 68da760

Browse files
committed
feat add is_int assertion
1 parent 043ed19 commit 68da760

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Type/Php/PregSplitDynamicReturnTypeExtension.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,17 @@ public function getTypeFromFunctionCall(FunctionReflection $functionReflection,
142142
foreach ($patternConstantTypes as $patternConstantType) {
143143
foreach ($subjectConstantTypes as $subjectConstantType) {
144144
foreach ($limits as $limit) {
145+
if (!is_int($limit)) {
146+
return null;
147+
}
145148
foreach ($flags as $flag) {
149+
if (!is_int($flag)) {
150+
return null;
151+
}
146152
$result = @preg_split($patternConstantType->getValue(), $subjectConstantType->getValue(), $limit, $flag);
147153
if ($result !== false) {
148154
$constantArray = ConstantArrayTypeBuilder::createEmpty();
149155
foreach ($result as $key => $value) {
150-
assert(is_int($key));
151156
if (is_array($value)) {
152157
$valueConstantArray = ConstantArrayTypeBuilder::createEmpty();
153158
$valueConstantArray->setOffsetValueType(new ConstantIntegerType(0), new ConstantStringType($value[0]));

0 commit comments

Comments
 (0)