Lines Matching refs:node
55 public function enterNode(Node $node) { argument
56 if ($node instanceof Stmt\Namespace_) {
57 $this->nameContext->startNamespace($node->name);
58 } elseif ($node instanceof Stmt\Use_) {
59 foreach ($node->uses as $use) {
60 $this->addAlias($use, $node->type, null);
62 } elseif ($node instanceof Stmt\GroupUse) {
63 foreach ($node->uses as $use) {
64 $this->addAlias($use, $node->type, $node->prefix);
66 } elseif ($node instanceof Stmt\Class_) {
67 if (null !== $node->extends) {
68 $node->extends = $this->resolveClassName($node->extends);
71 foreach ($node->implements as &$interface) {
75 $this->resolveAttrGroups($node);
76 if (null !== $node->name) {
77 $this->addNamespacedName($node);
79 $node->namespacedName = null;
81 } elseif ($node instanceof Stmt\Interface_) {
82 foreach ($node->extends as &$interface) {
86 $this->resolveAttrGroups($node);
87 $this->addNamespacedName($node);
88 } elseif ($node instanceof Stmt\Enum_) {
89 foreach ($node->implements as &$interface) {
93 $this->resolveAttrGroups($node);
94 $this->addNamespacedName($node);
95 } elseif ($node instanceof Stmt\Trait_) {
96 $this->resolveAttrGroups($node);
97 $this->addNamespacedName($node);
98 } elseif ($node instanceof Stmt\Function_) {
99 $this->resolveSignature($node);
100 $this->resolveAttrGroups($node);
101 $this->addNamespacedName($node);
102 } elseif ($node instanceof Stmt\ClassMethod
103 || $node instanceof Expr\Closure
104 || $node instanceof Expr\ArrowFunction
106 $this->resolveSignature($node);
107 $this->resolveAttrGroups($node);
108 } elseif ($node instanceof Stmt\Property) {
109 if (null !== $node->type) {
110 $node->type = $this->resolveType($node->type);
112 $this->resolveAttrGroups($node);
113 } elseif ($node instanceof Node\PropertyHook) {
114 foreach ($node->params as $param) {
118 $this->resolveAttrGroups($node);
119 } elseif ($node instanceof Stmt\Const_) {
120 foreach ($node->consts as $const) {
123 } elseif ($node instanceof Stmt\ClassConst) {
124 if (null !== $node->type) {
125 $node->type = $this->resolveType($node->type);
127 $this->resolveAttrGroups($node);
128 } elseif ($node instanceof Stmt\EnumCase) {
129 $this->resolveAttrGroups($node);
130 } elseif ($node instanceof Expr\StaticCall
131 || $node instanceof Expr\StaticPropertyFetch
132 || $node instanceof Expr\ClassConstFetch
133 || $node instanceof Expr\New_
134 || $node instanceof Expr\Instanceof_
136 if ($node->class instanceof Name) {
137 $node->class = $this->resolveClassName($node->class);
139 } elseif ($node instanceof Stmt\Catch_) {
140 foreach ($node->types as &$type) {
143 } elseif ($node instanceof Expr\FuncCall) {
144 if ($node->name instanceof Name) {
145 $node->name = $this->resolveName($node->name, Stmt\Use_::TYPE_FUNCTION);
147 } elseif ($node instanceof Expr\ConstFetch) {
148 $node->name = $this->resolveName($node->name, Stmt\Use_::TYPE_CONSTANT);
149 } elseif ($node instanceof Stmt\TraitUse) {
150 foreach ($node->traits as &$trait) {
154 foreach ($node->adaptations as $adaptation) {
183 private function resolveSignature($node): void { argument
184 foreach ($node->params as $param) {
188 $node->returnType = $this->resolveType($node->returnType);
193 * @param T $node
196 private function resolveType(?Node $node): ?Node { argument
197 if ($node instanceof Name) {
198 return $this->resolveClassName($node);
200 if ($node instanceof Node\NullableType) {
201 $node->type = $this->resolveType($node->type);
202 return $node;
204 if ($node instanceof Node\UnionType || $node instanceof Node\IntersectionType) {
205 foreach ($node->types as &$type) {
208 return $node;
210 return $node;
256 protected function addNamespacedName(Node $node): void { argument
257 $node->namespacedName = Name::concat(
258 $this->nameContext->getNamespace(), (string) $node->name);
261 protected function resolveAttrGroups(Node $node): void { argument
262 foreach ($node->attrGroups as $attrGroup) {