public function skipUntil($matcher)
 {
     while ($this->moveNext()) {
         if ($this->token->matches($matcher)) {
             return $this->token;
         }
     }
     return null;
 }
 public function skipUntil($token)
 {
     $found = false;
     while ($this->moveNext()) {
         if ($this->token->matches($token)) {
             $found = true;
             break;
         }
     }
     return $found;
 }
 /**
  * Checks whether the given token can safely be rewritten.
  *
  * We consider something safe to rewrite if there are no comments placed inside
  * the use statements.
  *
  * @param \JMS\PhpManipulator\TokenStream\AbstractToken $token
  *
  * @return boolean
  */
 private function isSafeToRewrite(AbstractToken $token, array &$imports = array(), AbstractToken &$lastToken = null, &$multiple = false)
 {
     if (!$token->matches(T_USE)) {
         throw new \LogicException(sprintf('Expected a T_USE token, but got "%s".', $token));
     }
     $next = $token;
     $isFirst = true;
     $multiple = false;
     do {
         if (!$isFirst) {
             $multiple = true;
         }
         $isFirst = false;
         $next = $next->findNextToken('NO_WHITESPACE')->get();
         if (!$next->matches(T_STRING)) {
             return false;
         }
         $endOfName = $next->findNextToken('END_OF_NAME')->get();
         $namespace = $next->getContentUntil($endOfName);
         if ($namespace[0] === '\\') {
             $namespace = substr($namespace, 1);
         }
         $next = $endOfName;
         if ($next->matches(T_WHITESPACE)) {
             $next = $next->findNextToken('NO_WHITESPACE')->get();
         }
         if ($next->matches(T_AS)) {
             $next = $next->findNextToken('NO_WHITESPACE')->get();
             if (!$next->matches(T_STRING)) {
                 return false;
             }
             $imports[$namespace] = $next->getContent();
             $next = $next->findNextToken('NO_WHITESPACE')->get();
             if ($next->matches(';')) {
                 $lastToken = $next;
                 return $this->isSafeEndToken($next);
             }
         } else {
             $imports[$namespace] = null;
         }
         if ($next->matches(';')) {
             $lastToken = $next;
             return $this->isSafeEndToken($next);
         }
     } while ($next->matches(','));
     return false;
 }