|
11 | 11 |
|
12 | 12 | use Magento\SemanticVersionChecker\Helper\Node as NodeHelper; |
13 | 13 | use PhpParser\Node; |
| 14 | +use PhpParser\Node\Stmt\Enum_ as EnumNode; |
14 | 15 | use PhpParser\Node\Stmt\Class_ as ClassNode; |
15 | 16 | use PhpParser\Node\Stmt\ClassLike; |
16 | 17 | use PhpParser\Node\Stmt\ClassMethod; |
|
22 | 23 | use PhpParser\NodeVisitorAbstract; |
23 | 24 |
|
24 | 25 | /** |
25 | | - * Implements a visitor for `class`, `interface` and `trait` nodes that generates a dependency graph. |
| 26 | + * Implements a visitor for `class`, `interface`, `trait` and `enum` nodes that generates a dependency graph. |
26 | 27 | */ |
27 | 28 | class DependencyInspectionVisitor extends NodeVisitorAbstract |
28 | 29 | { |
@@ -94,8 +95,8 @@ public function enterNode(Node $node) |
94 | 95 | } |
95 | 96 |
|
96 | 97 | /** |
97 | | - * Handles Class, Interface, and Traits nodes. Sets currentClassLike entity and will populate extends, implements, |
98 | | - * and API information |
| 98 | + * Handles Class, Interface, Traits and Enum nodes. Sets currentClassLike entity and will populate extends, |
| 99 | + * implements, and API information |
99 | 100 | * |
100 | 101 | * @param ClassLike $node |
101 | 102 | * @return int|null |
@@ -135,6 +136,9 @@ private function handleClassLike(ClassLike $node) |
135 | 136 | case $node instanceof TraitNode: |
136 | 137 | $this->currentClassLike = $this->dependencyGraph->findOrCreateTrait((string)$namespacedName); |
137 | 138 | break; |
| 139 | + case $node instanceof EnumNode: |
| 140 | + $this->currentClassLike = $this->dependencyGraph->findOrCreateEnum((string)$namespacedName); |
| 141 | + break; |
138 | 142 | } |
139 | 143 | $this->currentClassLike->setIsApi($this->nodeHelper->isApiNode($node)); |
140 | 144 | return null; |
|
0 commit comments