public function testFromReflection()
 {
     $previous = new ClosureAnalysisException('Two closures were declared on the same line');
     $exception = TwoClosuresOneLine::fromClosureAnalysisException($previous);
     $this->assertInstanceOf(TwoClosuresOneLine::class, $exception);
     $this->assertSame('Two closures were declared on the same line', $exception->getMessage());
 }
 /**
  * {@inheritDoc}
  */
 public function locateIdentifier(Reflector $reflector, Identifier $identifier)
 {
     try {
         $closureData = $this->closureAnalyzer->analyze($this->closure);
     } catch (ClosureAnalysisException $closureAnalysisException) {
         if (stripos($closureAnalysisException->getMessage(), 'Two closures were declared on the same line') !== false) {
             throw TwoClosuresOneLine::fromClosureAnalysisException($closureAnalysisException);
         }
         throw $closureAnalysisException;
     }
     if (!isset($closureData['ast']) || !$closureData['ast'] instanceof ClosureNode) {
         return null;
     }
     $locatedSource = new LocatedSource('<?php ' . $closureData['code'], $closureData['reflection']->getFileName());
     $namespaceNode = null;
     if (isset($closureData['location']['namespace'])) {
         $namespaceNode = new Namespace_(new Name($closureData['location']['namespace']));
     }
     return $this->conversionStrategy->__invoke($reflector, $closureData['ast'], $locatedSource, $namespaceNode);
 }