File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -386,7 +386,7 @@ function typeof($arg) {
386386 if ($ t instanceof \ReflectionUnionType) {
387387 $ union = [];
388388 foreach ($ t ->getTypes () as $ c ) {
389- $ union []= \lang \Type::forName (PHP_VERSION_ID >= 70100 ? $ c ->getName () : $ c -> __toString ());
389+ $ union []= \lang \Type::forName ($ c ->getName ());
390390 }
391391 $ signature []= new \lang \TypeUnion ($ union );
392392 } else {
@@ -397,7 +397,15 @@ function typeof($arg) {
397397 }
398398 }
399399 if ($ t = $ r ->getReturnType ()) {
400- $ return = \lang \Type::forName (PHP_VERSION_ID >= 70100 ? $ t ->getName () : $ t ->__toString ());
400+ if ($ t instanceof \ReflectionUnionType) {
401+ $ union = [];
402+ foreach ($ t ->getTypes () as $ c ) {
403+ $ union []= \lang \Type::forName ($ c ->getName ());
404+ }
405+ $ return = new \lang \TypeUnion ($ union );
406+ } else {
407+ $ return = \lang \Type::forName (PHP_VERSION_ID >= 70100 ? $ t ->getName () : $ t ->__toString ());
408+ }
401409 } else {
402410 $ return = \lang \Type::$ VAR ;
403411 }
You can’t perform that action at this time.
0 commit comments