Skip to content

Commit b42a610

Browse files
committed
Possibly generic handling of types?
1 parent 0234409 commit b42a610

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

build/gen_stub.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,12 @@ class Type {
415415

416416
public static function fromNode(Node $node): Type {
417417
if ($node instanceof Node\UnionType) {
418-
return new Type(array_map(['SimpleType', 'fromNode'], $node->types));
418+
$nestedTypeObjects = array_map(['Type', 'fromNode'], $node->types);
419+
$types = [];
420+
foreach ($nestedTypeObjects as $typeObject) {
421+
array_push($types, ...$typeObject->types);
422+
}
423+
return new Type($types);
419424
}
420425

421426
if ($node instanceof Node\NullableType) {

0 commit comments

Comments
 (0)