Skip to content

Commit

Permalink
Document assumptions
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Oct 6, 2020
1 parent e494dca commit 104c77a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ReflectionMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,13 @@ public function fromMethodReturnType(ReflectionMethod $method): Type
);
}

assert($returnType instanceof ReflectionUnionType);

$types = [];

foreach ($returnType->getTypes() as $type) {
assert($type instanceof ReflectionNamedType);

if ($type->getName() === 'self') {
$types[] = ObjectType::fromName(
$method->getDeclaringClass()->getName(),
Expand Down

0 comments on commit 104c77a

Please sign in to comment.