protected function lookUp(array $types) { while ($this->hasTokens()) { $token = $this->getToken(); if (in_array($token['type'], $types, true)) { (yield $token); } else { break; } $this->nextToken(); } }