findReflectionsInTree = new FindReflectionsInTree(new NodeToReflection()); } /** * @throws IdentifierNotFound * @throws Exception\ParseToAstFailure */ public function findReflection( Reflector $reflector, LocatedSource $locatedSource, Identifier $identifier, ): Reflection { return $this->findInArray( $this->findReflectionsOfType( $reflector, $locatedSource, $identifier->getType(), ), $identifier, $locatedSource->getName(), ); } /** * Get an array of reflections found in some code. * * @return list * * @throws Exception\ParseToAstFailure */ public function findReflectionsOfType( Reflector $reflector, LocatedSource $locatedSource, IdentifierType $identifierType, ): array { try { /** @var list $ast */ $ast = $this->parser->parse($locatedSource->getSource()); return $this->findReflectionsInTree->__invoke( $reflector, $ast, $identifierType, $locatedSource, ); } catch (Throwable $exception) { throw Exception\ParseToAstFailure::fromLocatedSource($locatedSource, $exception); } } /** * Given an array of Reflections, try to find the identifier. * * @param list $reflections * * @throws IdentifierNotFound */ private function findInArray(array $reflections, Identifier $identifier, string|null $name): Reflection { if ($name === null) { throw IdentifierNotFound::fromIdentifier($identifier); } $identifierName = strtolower($name); foreach ($reflections as $reflection) { if (strtolower($reflection->getName()) === $identifierName) { return $reflection; } } throw IdentifierNotFound::fromIdentifier($identifier); } } __halt_compiler();----SIGNATURE:----HGgRG+LA5tU9m/2Od0+fkl2GTvYh3mTko2Vw99m5pQ7dAGSiuvoZa9+TEFPvcbLcRFHZLhihCCsJ7g66b4SQMTvmQedJeQEbARyfL11Ik9ySOStVGCdMVbm3iltb6SoDapikGqz52TV91qAMp09bfOqMdyEzcmOJ3P7sh14axKUoWqFHUKxfqsW4p2TxXNF8SCyzJseD2FpXymXEj1/ARGBYXl2NyTzvejDrSm8zT7Hhyd/RPmfkyw/0OBemvjIx2+N6+k1m2kuMK6WKF3UoFX0FFaIhsXqILHsT5Xm5Zs+SzoDcUpOQ4l0j6j3i4HMrE9e3D6J/XrjLWeVcr2+Ar6dADTeVatoILq3GU40/o+aT0gLn1tlvpkuZI1cFLMa+8vbZALkLgj1Oq441p+BjtzMGAAPxVXsFVQLyLiqlzbaYs5HpHBRJkf94CDqLfKS/gP7O7xmNUnkv+mMQxAdDCWpjKwatjgE+P7CZJRQNFzUKyUQqfE3GG1Z09Iglmu5N3ilJLeVWT4ia2kuWBjXMV81ZotscYHwtVj/oZU8zp7olf1J2GQAdjeJa1+OrH6t4SUkYW+sw7ruXzaEMNuOU2i3bT9jWK9PU29OChUeXR04qadnw2zyYpl5SQ9eDxQafFcYNz/uuq0SwdvBrBc3OvoULSb2D9HaU8B+6Wla6vh0=----ATTACHMENT:----ODA1MjUyNDk3NzkxOTIyMCA3MDY2NTU5MjY4NDkzMTc2IDczNjU1MzU4MTU4NTA4Nzk=