Skip to content

Commit 3c2488b

Browse files
committed
Add explicit callback for array_filter
1 parent 0087056 commit 3c2488b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/Type/ModelFetchedReturnTypeHelper.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,13 @@ private function getArrayReturnType(ClassReflection $classReflection, Scope $sco
108108
return new ConstantArrayType([], []);
109109
}
110110

111-
$fields = array_filter(array_map(
112-
static fn (Type $type) => current($type->getConstantStrings()),
113-
current($fieldsTypes)->getValueTypes()
114-
));
111+
$fields = array_filter(
112+
array_map(
113+
static fn (Type $type) => current($type->getConstantStrings()),
114+
current($fieldsTypes)->getValueTypes()
115+
),
116+
static fn (ConstantStringType|false $constantStringType): bool => $constantStringType !== false
117+
);
115118

116119
return new ConstantArrayType(
117120
$fields,

0 commit comments

Comments
 (0)