/** * Parses a trait adaptation precedence statement. * * @param array $reference Parsed method reference array. * * @return PHP_Depend_Code_ASTTraitAdaptationPrecedence * @throws PHP_Depend_Parser_InvalidStateException * @since 1.0.0 */ private function parseTraitAdaptationPrecedenceStatement(array $reference) { if (count($reference) < 2) { throw new PHP_Depend_Parser_InvalidStateException($this->tokenizer->next()->startLine, $this->sourceFile->getFileName(), 'Expecting full qualified trait method name.'); } $stmt = $this->builder->buildAstTraitAdaptationPrecedence($reference[0]); $stmt->addChild($reference[1]); $this->consumeToken(self::T_INSTEADOF); $this->consumeComments(); $stmt->addChild($this->parseTraitReference()); $this->consumeComments(); while (self::T_COMMA === $this->tokenizer->peek()) { $this->consumeToken(self::T_COMMA); $stmt->addChild($this->parseTraitReference()); $this->consumeComments(); } return $stmt; }