Optimized the code of Hyperf\Watcher\Ast\RewriteClassNameVisitor::leaveNode.

This commit is contained in:
@长久同学 2024-09-26 10:38:18 +08:00 committed by GitHub
parent 1bf6f9cd0c
commit db8ce5901e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -3,6 +3,7 @@
## Optimized
- [#7082](https://github.com/hyperf/hyperf/pull/7082) Optimized the code of `Hyperf\Database\Query\Grammars\Grammar::compileUpdate`.
- [#7084](https://github.com/hyperf/hyperf/pull/7084) Optimized the code of `Hyperf\Watcher\Ast\RewriteClassNameVisitor::leaveNode`.
# v3.1.42 - 2024-09-25

View File

@ -27,7 +27,7 @@ class RewriteClassNameVisitor extends NodeVisitorAbstract
case $node instanceof Node\Stmt\Namespace_:
$this->metadata->namespace = $node->name->toCodeString();
return $node;
case $node instanceof Node\Stmt\Class_ || $node instanceof Node\Stmt\Enum_:
case ($node instanceof Node\Stmt\Class_ || $node instanceof Node\Stmt\Enum_) && $node->name:
$className = $node->name->name;
$this->metadata->className = $className;
return $node;