Пример #1
0
 /**
  * Parses the adaptation expression of a trait use statement.
  *
  * @return \PDepend\Source\AST\ASTTraitAdaptation
  * @since  1.0.0
  */
 private function parseTraitAdaptation()
 {
     $this->tokenStack->push();
     $adaptation = $this->builder->buildAstTraitAdaptation();
     $this->consumeToken(Tokens::T_CURLY_BRACE_OPEN);
     do {
         $this->tokenStack->push();
         $reference = $this->parseTraitMethodReference();
         $this->consumeComments();
         if (Tokens::T_AS === $this->tokenizer->peek()) {
             $stmt = $this->parseTraitAdaptationAliasStatement($reference);
         } else {
             $stmt = $this->parseTraitAdaptationPrecedenceStatement($reference);
         }
         $this->consumeComments();
         $this->consumeToken(Tokens::T_SEMICOLON);
         $adaptation->addChild($this->setNodePositionsAndReturn($stmt));
         $this->consumeComments();
     } while (Tokens::T_CURLY_BRACE_CLOSE !== $this->tokenizer->peek());
     $this->consumeToken(Tokens::T_CURLY_BRACE_CLOSE);
     return $this->setNodePositionsAndReturn($adaptation);
 }