Skip to content

Commit 8465440

Browse files
authored
Support enum for hyperf/constants. (#5499)
1 parent d91726b commit 8465440

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Aop/Ast.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Hyperf\Utils\Composer;
1515
use PhpParser\Node\Stmt\Class_;
16+
use PhpParser\Node\Stmt\Enum_;
1617
use PhpParser\Node\Stmt\Interface_;
1718
use PhpParser\Node\Stmt\Namespace_;
1819
use PhpParser\NodeTraverser;
@@ -62,7 +63,7 @@ public function parseClassByStmts(array $stmts): string
6263
if ($stmt instanceof Namespace_ && $stmt->name) {
6364
$namespace = $stmt->name->toString();
6465
foreach ($stmt->stmts as $node) {
65-
if (($node instanceof Class_ || $node instanceof Interface_) && $node->name) {
66+
if (($node instanceof Class_ || $node instanceof Interface_ || $node instanceof Enum_) && $node->name) {
6667
$className = $node->name->toString();
6768
break;
6869
}

0 commit comments

Comments
 (0)