Exemplo n.º 1
0
 /**
  * Parses a trait adaptation alias statement.
  *
  * @param array $reference Parsed method reference array.
  *
  * @return \PDepend\Source\AST\ASTTraitAdaptationAlias
  * @since  1.0.0
  */
 private function parseTraitAdaptationAliasStatement(array $reference)
 {
     $stmt = $this->builder->buildAstTraitAdaptationAlias($reference[0]);
     if (2 === count($reference)) {
         $stmt->addChild($reference[1]);
     }
     $this->consumeToken(Tokens::T_AS);
     $this->consumeComments();
     switch ($this->tokenizer->peek()) {
         case Tokens::T_PUBLIC:
             $stmt->setNewModifier(State::IS_PUBLIC);
             $this->consumeToken(Tokens::T_PUBLIC);
             $this->consumeComments();
             break;
         case Tokens::T_PROTECTED:
             $stmt->setNewModifier(State::IS_PROTECTED);
             $this->consumeToken(Tokens::T_PROTECTED);
             $this->consumeComments();
             break;
         case Tokens::T_PRIVATE:
             $stmt->setNewModifier(State::IS_PRIVATE);
             $this->consumeToken(Tokens::T_PRIVATE);
             $this->consumeComments();
             break;
     }
     if (Tokens::T_SEMICOLON !== $this->tokenizer->peek()) {
         $stmt->setNewName($this->parseFunctionName());
     }
     return $stmt;
 }