Skip to content

Commit

Permalink
Fix notices seen in PHP 7.3.0alpha4
Browse files Browse the repository at this point in the history
    vendor/microsoft/tolerant-php-parser/src/Parser.php:1037 [2]
    "continue" targeting switch is equivalent to "break".
    Did you mean to use "continue 2"
  • Loading branch information
TysonAndre committed Jul 20, 2018
1 parent bce97ae commit f3fcb1f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/Parser.php
Expand Up @@ -1034,19 +1034,19 @@ private function parseStringLiteralExpression2($parentNode) {
$expression->children[] = $this->parseExpression($expression);
}
$expression->children[] = $this->eat1(TokenKind::CloseBraceToken);
continue;
break;
case $startQuoteKind = $expression->startQuote->kind:
case TokenKind::EndOfFileToken:
case TokenKind::HeredocEnd:
$expression->endQuote = $this->eat($startQuoteKind, TokenKind::HeredocEnd);
return $expression;
case TokenKind::VariableName:
$expression->children[] = $this->parseTemplateStringExpression($expression);
continue;
break;
default:
$expression->children[] = $this->getCurrentToken();
$this->advanceToken();
continue;
break;
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/PhpTokenizer.php
Expand Up @@ -86,31 +86,31 @@ public static function getTokensArrayFromContent(
case T_OPEN_TAG:
$arr[] = new Token(TokenKind::ScriptSectionStartTag, $fullStart, $start, $pos-$fullStart);
$start = $fullStart = $pos;
continue;
break;

case T_WHITESPACE:
$start += $strlen;
continue;
break;

case T_STRING:
$name = \strtolower($token[1]);
if (isset(TokenStringMaps::RESERVED_WORDS[$name])) {
$newTokenKind = TokenStringMaps::RESERVED_WORDS[$name];
$arr[] = new Token($newTokenKind, $fullStart, $start, $pos - $fullStart);
$start = $fullStart = $pos;
continue;
break;
}

default:
if (($tokenKind === T_COMMENT || $tokenKind === T_DOC_COMMENT) && $treatCommentsAsTrivia) {
$start += $strlen;
continue;
break;
}

$newTokenKind = self::TOKEN_MAP[$tokenKind] ?? TokenKind::Unknown;
$arr[] = new Token($newTokenKind, $fullStart, $start, $pos - $fullStart);
$start = $fullStart = $pos;
continue;
break;
}
}

Expand Down

0 comments on commit f3fcb1f

Please sign in to comment.