Skip to content

Commit

Permalink
No root level sign "\" for self
Browse files Browse the repository at this point in the history
  • Loading branch information
koriym committed Sep 21, 2023
1 parent e996c92 commit c75a114
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/AopCodeGenMethodSignature.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,12 @@ public function getTypeString(?ReflectionType $type): string
$typeStr = '';

if ($type instanceof ReflectionNamedType) {
$typeStr = $type->isBuiltin() ? $type->getName() : '\\' . $type->getName();
/** @psalm-suppress TypeDoesNotContainType */
$typeStr = $type->isBuiltin() || $type->getName() === 'self' ? $type->getName() : '\\' . $type->getName();
} elseif (class_exists('ReflectionUnionType') && $type instanceof ReflectionUnionType) {
$types = array_map(static function (ReflectionNamedType $t) {
return $t->isBuiltin() ? $t->getName() : '\\' . $t->getName();
/** @psalm-suppress TypeDoesNotContainType */
return $t->isBuiltin() || $t->getName() === 'self' ? $t->getName() : '\\' . $t->getName();
}, (array) $type->getTypes());

return implode('|', $types);
Expand Down

0 comments on commit c75a114

Please sign in to comment.