protected function assertTokens($tokens, TokenQueue $queue) { $queue->reset(); $it = new \ArrayIterator($tokens); $token = $queue->peek(); while ($it->valid()) { $expectedToken = $it->current(); $this->assertFalse($queue->isEof(), 'There is no more tokens, expected = ' . $expectedToken[1]); $this->assertToken($expectedToken[0], $expectedToken[1], $token); $token = $queue->next(); $it->next(); } $this->assertTrue($queue->isEof(), 'There are more unexpected tokens.'); }