← All changes
|
vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php
+5
-2
3.0
→
3.5.9
View file →
| @@ -34,9 +34,9 @@ | ||
| 34 | 34 | * |
| 35 | 35 | * @param ErrorHandler|null $errorHandler Error handler |
| 36 | 36 | * @param array $options Options |
| 37 | 37 | */ |
| 38 | - public function __construct(ErrorHandler $errorHandler = null, array $options = []) { | |
| 38 | + public function __construct(?ErrorHandler $errorHandler = null, array $options = []) { | |
| 39 | 39 | $this->nameContext = new NameContext($errorHandler ?? new ErrorHandler\Throwing); |
| 40 | 40 | $this->preserveOriginalNames = $options['preserveOriginalNames'] ?? false; |
| 41 | 41 | $this->replaceNodes = $options['replaceNodes'] ?? true; |
| 42 | 42 | } |
| @@ -117,8 +117,11 @@ | ||
| 117 | 117 | foreach ($node->consts as $const) { |
| 118 | 118 | $this->addNamespacedName($const); |
| 119 | 119 | } |
| 120 | 120 | } else if ($node instanceof Stmt\ClassConst) { |
| 121 | + if (null !== $node->type) { | |
| 122 | + $node->type = $this->resolveType($node->type); | |
| 123 | + } | |
| 121 | 124 | $this->resolveAttrGroups($node); |
| 122 | 125 | } else if ($node instanceof Stmt\EnumCase) { |
| 123 | 126 | $this->resolveAttrGroups($node); |
| 124 | 127 | } elseif ($node instanceof Expr\StaticCall |
| @@ -160,9 +163,9 @@ | ||
| 160 | 163 | |
| 161 | 164 | return null; |
| 162 | 165 | } |
| 163 | 166 | |
| 164 | - private function addAlias(Stmt\UseUse $use, $type, Name $prefix = null) { | |
| 167 | + private function addAlias(Stmt\UseUse $use, int $type, ?Name $prefix = null) { | |
| 165 | 168 | // Add prefix for group uses |
| 166 | 169 | $name = $prefix ? Name::concat($prefix, $use->name) : $use->name; |
| 167 | 170 | // Type is determined either by individual element or whole use declaration |
| 168 | 171 | $type |= $use->type; |