Skip to content

Commit fa344e1

Browse files
committed
simplify
1 parent f8f3b2f commit fa344e1

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/Type/Constant/ConstantArrayTypeBuilder.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -313,15 +313,17 @@ public function getArray(): Type
313313
return new ConstantArrayType($keyTypes, $this->valueTypes, $this->nextAutoIndexes, $this->optionalKeys, $this->isList);
314314
}
315315

316-
$itemTypes = [];
317-
foreach ($this->valueTypes as $valueType) {
318-
if ($this->degradeClosures && $valueType instanceof ClosureType) {
319-
continue;
320-
}
321-
$itemTypes[] = $valueType;
322-
}
323316
if ($this->degradeClosures) {
317+
$itemTypes = [];
324318
$itemTypes[] = new CallableType();
319+
foreach ($this->valueTypes as $valueType) {
320+
if ($valueType instanceof ClosureType) {
321+
continue;
322+
}
323+
$itemTypes[] = $valueType;
324+
}
325+
} else {
326+
$itemTypes = $this->valueTypes;
325327
}
326328

327329
$array = new ArrayType(

0 commit comments

Comments
 (0)