private function locateClosure(array &$data)
    {
        try {
            $locator = new ClosureLocatorVisitor($data['reflection']);
            $fileAst = $this->getFileAst($data['reflection']);

            $fileTraverser = new NodeTraverser;
            $fileTraverser->addVisitor(new NameResolver);
            $fileTraverser->addVisitor($locator);
            $fileTraverser->traverse($fileAst);
        } catch (ParserError $e) {
            // @codeCoverageIgnoreStart
            throw new ClosureAnalysisException(
                'There was an error analyzing the closure code.', 0, $e
            );
            // @codeCoverageIgnoreEnd
        }

        $data['ast'] = $locator->closureNode;
        if (!$data['ast']) {
            // @codeCoverageIgnoreStart
            throw new ClosureAnalysisException(
                'The closure was not found within the abstract syntax tree.'
            );
            // @codeCoverageIgnoreEnd
        }

        $data['location'] = $locator->location;
    }
private function locateClosure(array &$data)
    {
        try {
            $locator = new ClosureLocatorVisitor($data['reflection']);
            $fileAst = $this->getFileAst($data['reflection']);

            $fileTraverser = new NodeTraverser;
            $fileTraverser->addVisitor(new NameResolver);
            $fileTraverser->addVisitor($locator);
            $fileTraverser->traverse($fileAst);
        } catch (ParserError $e) {
            
            throw new ClosureAnalysisException(
                'There was an error analyzing the closure code.', 0, $e
            );
            
        }

        $data['ast'] = $locator->closureNode;
        if (!$data['ast']) {
            
            throw new ClosureAnalysisException(
                'The closure was not found within the abstract syntax tree.'
            );
            
        }

        $data['location'] = $locator->location;
    }
private function locateClosure ( array & $ data ) { try { $ locator = new ClosureLocatorVisitor ( $ data [ 'reflection' ] ) ; $ fileAst = $ this -> getFileAst ( $ data [ 'reflection' ] ) ; $ fileTraverser = new NodeTraverser ; $ fileTraverser -> addVisitor ( new NameResolver ) ; $ fileTraverser -> addVisitor ( $ locator ) ; $ fileTraverser -> traverse ( $ fileAst ) ; } catch ( ParserError $ e ) { // @codeCoverageIgnoreStart throw new ClosureAnalysisException ( 'There was an error analyzing the closure code.' , 0 , $ e ) ; // @codeCoverageIgnoreEnd } $ data [ 'ast' ] = $ locator -> closureNode ; if ( ! $ data [ 'ast' ] ) { // @codeCoverageIgnoreStart throw new ClosureAnalysisException ( 'The closure was not found within the abstract syntax tree.' ) ; // @codeCoverageIgnoreEnd } $ data [ 'location' ] = $ locator -> location ; }
Parses the closure's code and produces an abstract syntax tree (AST).

@param array $data

@throws ClosureAnalysisException if there is an issue finding the closure
Parses the closure s code and produces an abstract syntax tree ( AST ) .