@@ -103,12 +103,6 @@ public function isStaticComplete(): bool
103103 */
104104 public function getDefinitions (): \Generator
105105 {
106- // foreach ($this->fqnDefinitions as $fqnDefinition) {
107- // foreach ($fqnDefinition as $fqn => $definition) {
108- // yield $fqn => $definition;
109- // }
110- // }
111-
112106 yield from $ this ->yieldDefinitionsRecursively ($ this ->definitions );
113107 }
114108
@@ -120,14 +114,10 @@ public function getDefinitions(): \Generator
120114 */
121115 public function getDefinitionsForFqn (string $ fqn ): \Generator
122116 {
123- // foreach ($this->fqnDefinitions[$fqn] ?? [] as $symbolFqn => $definition) {
124- // yield $symbolFqn => $definition;
125- // }
126-
127117 $ parts = $ this ->splitFqn ($ fqn );
128118 if ('' === end ($ parts )) {
129119 // we want to return all the definitions in the given FQN, not only
130- // the one matching exactly the FQN.
120+ // the one (non member) matching exactly the FQN.
131121 array_pop ($ parts );
132122 }
133123
@@ -149,19 +139,6 @@ public function getDefinitionsForFqn(string $fqn): \Generator
149139 */
150140 public function getDefinition (string $ fqn , bool $ globalFallback = false )
151141 {
152- // $namespacedFqn = $this->extractNamespacedFqn($fqn);
153- // $definitions = $this->fqnDefinitions[$namespacedFqn] ?? [];
154-
155- // if (isset($definitions[$fqn])) {
156- // return $definitions[$fqn];
157- // }
158-
159- // if ($globalFallback) {
160- // $parts = explode('\\', $fqn);
161- // $fqn = end($parts);
162- // return $this->getDefinition($fqn);
163- // }
164-
165142 $ parts = $ this ->splitFqn ($ fqn );
166143 $ result = $ this ->getIndexValue ($ parts , $ this ->definitions );
167144
@@ -175,11 +152,6 @@ public function getDefinition(string $fqn, bool $globalFallback = false)
175152
176153 return $ this ->getDefinition ($ fqn );
177154 }
178-
179- // return $result instanceof Definition
180- // ? $result
181- // : null
182- // ;
183155 }
184156
185157 /**
@@ -191,13 +163,6 @@ public function getDefinition(string $fqn, bool $globalFallback = false)
191163 */
192164 public function setDefinition (string $ fqn , Definition $ definition )
193165 {
194- // $namespacedFqn = $this->extractNamespacedFqn($fqn);
195- // if (!isset($this->fqnDefinitions[$namespacedFqn])) {
196- // $this->fqnDefinitions[$namespacedFqn] = [];
197- // }
198-
199- // $this->fqnDefinitions[$namespacedFqn][$fqn] = $definition;
200-
201166 $ parts = $ this ->splitFqn ($ fqn );
202167 $ this ->indexDefinition (0 , $ parts , $ this ->definitions , $ definition );
203168
@@ -213,17 +178,7 @@ public function setDefinition(string $fqn, Definition $definition)
213178 */
214179 public function removeDefinition (string $ fqn )
215180 {
216- // $namespacedFqn = $this->extractNamespacedFqn($fqn);
217- // if (isset($this->fqnDefinitions[$namespacedFqn])) {
218- // unset($this->fqnDefinitions[$namespacedFqn][$fqn]);
219-
220- // if (empty($this->fqnDefinitions[$namespacedFqn])) {
221- // unset($this->fqnDefinitions[$namespacedFqn]);
222- // }
223- // }
224-
225181 $ parts = $ this ->splitFqn ($ fqn );
226-
227182 $ this ->removeIndexedDefinition (0 , $ parts , $ this ->definitions );
228183
229184 unset($ this ->references [$ fqn ]);
@@ -324,21 +279,6 @@ public function serialize()
324279 ]);
325280 }
326281
327- /**
328- * @param string $fqn The symbol FQN
329- * @return string The namespaced FQN extracted from the given symbol FQN
330- */
331- // private function extractNamespacedFqn(string $fqn): string
332- // {
333- // foreach (['::', '->'] as $operator) {
334- // if (false !== ($pos = strpos($fqn, $operator))) {
335- // return substr($fqn, 0, $pos);
336- // }
337- // }
338-
339- // return $fqn;
340- // }
341-
342282 /**
343283 * Returns a Genrerator containing all the into the given $storage recursively.
344284 * The generator yields key => value pairs, eg
0 commit comments