Pārlūkot izejas kodu

CS: prefer while (true) over while (1)

Jordi Boggiano 14 gadi atpakaļ
vecāks
revīzija
451847c7d2

+ 3 - 3
src/Symfony/Component/CssSelector/Parser.php

@@ -82,7 +82,7 @@ class Parser
     protected function parseSelectorGroup($stream)
     {
         $result = array();
-        while (1) {
+        while (true) {
             $result[] = $this->parseSelector($stream);
             if ($stream->peek() == ',') {
                 $stream->next();
@@ -105,7 +105,7 @@ class Parser
     {
         $result = $this->parseSimpleSelector($stream);
 
-        while (1) {
+        while (true) {
             $peek = $stream->peek();
             if (',' == $peek || null === $peek) {
                 return $result;
@@ -156,7 +156,7 @@ class Parser
 
         $result = new Node\ElementNode($namespace, $element);
         $has_hash = false;
-        while (1) {
+        while (true) {
             $peek = $stream->peek();
             if ('#' == $peek) {
                 if ($has_hash) {

+ 2 - 2
src/Symfony/Component/CssSelector/Tokenizer.php

@@ -32,7 +32,7 @@ class Tokenizer
         $pos = 0;
         $s = preg_replace('#/\*.*?\*/#s', '', $s);
 
-        while (1) {
+        while (true) {
             if (preg_match('#\s+#A', $s, $match, 0, $pos)) {
                 $preceding_whitespace_pos = $pos;
                 $pos += strlen($match[0]);
@@ -103,7 +103,7 @@ class Tokenizer
 
         $pos = $pos + 1;
         $start = $pos;
-        while (1) {
+        while (true) {
             $next = strpos($s, $quote, $pos);
             if (false === $next) {
                 throw new SyntaxError(sprintf('Expected closing %s for string in: %s', $quote, substr($s, $start)));