Skip to content

Commit

Permalink
fix ReturnTypePass for nikic/php-parser 4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
AegirLeet authored and bobthecow committed Jun 9, 2024
1 parent 65e6a8b commit 2df7c5c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/CodeCleaner/ReturnTypePass.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,14 @@ private function typeName(Node $node): string
return \strtolower($node->type->name);
}

if ($node instanceof Identifier || $node instanceof Name) {
if ($node instanceof Identifier) {
return \strtolower($node->name);
}

if ($node instanceof Name) {
return $node->toLowerString();
}

throw new \InvalidArgumentException('Unable to find type name');
}
}

0 comments on commit 2df7c5c

Please sign in to comment.