Esempio n. 1
0
 /**
  * Extracts all dependencies from a callable signature.
  *
  * @return PHP_Depend_Code_ASTFormalParameters
  * @since 0.9.5
  */
 private function parseFormalParameters()
 {
     $this->consumeComments();
     $this->tokenStack->push();
     $formalParameters = $this->builder->buildAstFormalParameters();
     $this->consumeToken(self::T_PARENTHESIS_OPEN);
     $this->consumeComments();
     $tokenType = $this->tokenizer->peek();
     // Check for function without parameters
     if ($tokenType === self::T_PARENTHESIS_CLOSE) {
         $this->consumeToken(self::T_PARENTHESIS_CLOSE);
         return $this->setNodePositionsAndReturn($formalParameters);
     }
     while ($tokenType !== self::T_EOF) {
         $formalParameters->addChild($this->parseFormalParameterOrTypeHintOrByReference());
         $this->consumeComments();
         $tokenType = $this->tokenizer->peek();
         // Check for following parameter
         if ($tokenType !== self::T_COMMA) {
             break;
         }
         $this->consumeToken(self::T_COMMA);
     }
     $this->consumeToken(self::T_PARENTHESIS_CLOSE);
     return $this->setNodePositionsAndReturn($formalParameters);
 }