private function anonymousFunction(Node $static = NULL) {
    $node = new AnonymousFunctionNode();
    if ($static) {
      $node->addChild($static);
    }
    $this->mustMatch(T_FUNCTION, $node);
    $this->tryMatch('&', $node, 'reference');
    $this->parameterList($node);
    if ($this->tryMatch(T_USE, $node, 'lexicalUse')) {
      $this->mustMatch('(', $node, 'lexicalOpenParen');
      $lexical_vars_node = new CommaListNode();
      do {
        if ($this->currentType === '&') {
          $var = new ReferenceVariableNode();
          $this->mustMatch('&', $var);
          $this->mustMatch(T_VARIABLE, $var, 'variable', TRUE);
          $lexical_vars_node->addChild($var);
        }
        else {
          $this->mustMatch(T_VARIABLE, $lexical_vars_node, NULL, TRUE);
        }
      } while ($this->tryMatch(',', $lexical_vars_node));
      $node->addChild($lexical_vars_node, 'lexicalVariables');
      $this->mustMatch(')', $node, 'lexicalCloseParen');
    }
    $this->matchHidden($node);
    $node->addChild($this->innerStatementBlock(), 'body');
    return $node;
  }
private function anonymousFunction(Node $static = NULL) {
    $node = new AnonymousFunctionNode();
    if ($static) {
      $node->addChild($static);
    }
    $this->mustMatch(T_FUNCTION, $node);
    $this->tryMatch('&', $node, 'reference');
    $this->parameterList($node);
    if ($this->tryMatch(T_USE, $node, 'lexicalUse')) {
      $this->mustMatch('(', $node, 'lexicalOpenParen');
      $lexical_vars_node = new CommaListNode();
      do {
        if ($this->currentType === '&') {
          $var = new ReferenceVariableNode();
          $this->mustMatch('&', $var);
          $this->mustMatch(T_VARIABLE, $var, 'variable', TRUE);
          $lexical_vars_node->addChild($var);
        }
        else {
          $this->mustMatch(T_VARIABLE, $lexical_vars_node, NULL, TRUE);
        }
      } while ($this->tryMatch(',', $lexical_vars_node));
      $node->addChild($lexical_vars_node, 'lexicalVariables');
      $this->mustMatch(')', $node, 'lexicalCloseParen');
    }
    $this->matchHidden($node);
    $node->addChild($this->innerStatementBlock(), 'body');
    return $node;
  }
private function anonymousFunction ( Node $ static = NULL ) { $ node = new AnonymousFunctionNode ( ) ; if ( $ static ) { $ node -> addChild ( $ static ) ; } $ this -> mustMatch ( T_FUNCTION , $ node ) ; $ this -> tryMatch ( '&' , $ node , 'reference' ) ; $ this -> parameterList ( $ node ) ; if ( $ this -> tryMatch ( T_USE , $ node , 'lexicalUse' ) ) { $ this -> mustMatch ( '(' , $ node , 'lexicalOpenParen' ) ; $ lexical_vars_node = new CommaListNode ( ) ; do { if ( $ this -> currentType === '&' ) { $ var = new ReferenceVariableNode ( ) ; $ this -> mustMatch ( '&' , $ var ) ; $ this -> mustMatch ( T_VARIABLE , $ var , 'variable' , TRUE ) ; $ lexical_vars_node -> addChild ( $ var ) ; } else { $ this -> mustMatch ( T_VARIABLE , $ lexical_vars_node , NULL , TRUE ) ; } } while ( $ this -> tryMatch ( ',' , $ lexical_vars_node ) ) ; $ node -> addChild ( $ lexical_vars_node , 'lexicalVariables' ) ; $ this -> mustMatch ( ')' , $ node , 'lexicalCloseParen' ) ; } $ this -> matchHidden ( $ node ) ; $ node -> addChild ( $ this -> innerStatementBlock ( ) , 'body' ) ; return $ node ; }
Parse an anonymous function declaration.
@param Node $static
@return AnonymousFunctionNode
Parse an anonymous function declaration .