Skip to content

Commit

Permalink
Fix return type for union type with intersection
Browse files Browse the repository at this point in the history
  • Loading branch information
deguif committed Oct 4, 2022
1 parent 1124276 commit c67273f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Proxy/ProxyGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,10 @@ private function formatType(
if ($type instanceof ReflectionUnionType) {
return implode('|', array_map(
function (ReflectionType $unionedType) use ($method, $parameter) {
if ($unionedType instanceof ReflectionIntersectionType) {
return '(' . $this->formatType($unionedType, $method, $parameter) . ')';
}

return $this->formatType($unionedType, $method, $parameter);
},
$type->getTypes()
Expand Down

0 comments on commit c67273f

Please sign in to comment.