Skip to content

Commit bb3da26

Browse files
committed
UnionTypeHelper - prevent infinite recursion
1 parent b8a871d commit bb3da26

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Type/UnionTypeHelper.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ public static function sortTypes(array $types): array
109109
return self::compareStrings($a->describe(VerbosityLevel::value()), $b->describe(VerbosityLevel::value()));
110110
}
111111

112-
if ($a->isCallable()->yes() && $b->isCallable()->yes()) {
112+
if (
113+
($a instanceof CallableType || $a instanceof ClosureType)
114+
&& ($b instanceof CallableType || $b instanceof ClosureType)
115+
) {
113116
return self::compareStrings($a->describe(VerbosityLevel::value()), $b->describe(VerbosityLevel::value()));
114117
}
115118

0 commit comments

Comments
 (0)