Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed May 7, 2024
1 parent e13648e commit 19c8ce8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/Instrument/Transformer/SelfValueVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ public function enterNode(Node $node)
{
if ($node instanceof Namespace_) {
$this->namespace = !empty($node->name) ? $node->name->toString() : null;
} elseif ($node instanceof Class_) {
if ($node->name !== null) {
$this->className = new Name($node->name->toString());
}
} elseif ($node instanceof ClassMethod || $node instanceof Closure) {
if (isset($node->returnType)) {
$node->returnType = $this->resolveType($node->returnType);
Expand All @@ -115,7 +111,11 @@ public function enterNode(Node $node)
$type = $this->resolveClassName($type);
}
} elseif ($node instanceof ClassLike) {
$this->isInsideTraitOrEnum = $node instanceof Trait_ || $node instanceof Enum_;
if (! $node instanceof Trait_) {
$this->className = new Name($node->name->toString());
} else {
$this->className = null;
}
}

return null;
Expand All @@ -135,7 +135,7 @@ protected function resolveClassName(Name $name): Name
return $name;
}

if ($this->isInsideTraitOrEnum) {
if ($this->className === null) {
return $name;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ public function label(): string {
return static::getLabel($this);
}

public static function getLabel(self $value): string {
public static function getLabel(\Go\ParserReflection\Stub\BackedPhp81EnumHTTPStatusWithMethod $value): string {
return match ($value) {
self::OK => 'OK',
self::ACCESS_DENIED => 'Access Denied',
self::NOT_FOUND => 'Page Not Found',
\Go\ParserReflection\Stub\BackedPhp81EnumHTTPStatusWithMethod::OK => 'OK',
\Go\ParserReflection\Stub\BackedPhp81EnumHTTPStatusWithMethod::ACCESS_DENIED => 'Access Denied',
\Go\ParserReflection\Stub\BackedPhp81EnumHTTPStatusWithMethod::NOT_FOUND => 'Page Not Found',
};
}
}
Expand Down

0 comments on commit 19c8ce8

Please sign in to comment.