Skip to content

Commit

Permalink
build: Add some missing line breaks for continue/break lines
Browse files Browse the repository at this point in the history
phpcs missed sometimes to add a newline (known as T246630)

Change-Id: Ic9535562d551fbec94d332295587816ead33751d
  • Loading branch information
umherirrender authored and Krinkle committed Aug 3, 2023
1 parent e68d82f commit 9a960cb
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
26 changes: 17 additions & 9 deletions lib/Less/Exception/Chunk.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ protected function Chunks() {
$currentChunkStartIndex = $this->parserCurrentIndex;
for ( $this->parserCurrentIndex += 1; $this->parserCurrentIndex < $this->input_len; $this->parserCurrentIndex++ ) {
$cc2 = $this->CharCode( $this->parserCurrentIndex );
if ( $cc2 > 96 ) { continue;
if ( $cc2 > 96 ) {
continue;
}
if ( $cc2 == $cc ) { $matched = 1;
break;
if ( $cc2 == $cc ) {
$matched = 1;
break;
}
if ( $cc2 == 92 ) { // \
if ( $this->parserCurrentIndex == $this->input_len - 1 ) {
Expand All @@ -115,32 +117,38 @@ protected function Chunks() {
$this->parserCurrentIndex++;
}
}
if ( $matched ) { break;
if ( $matched ) {
break;
}
return $this->fail( "unmatched `" . chr( $cc ) . "`", $currentChunkStartIndex );

// /, check for comment
case 47:
if ( $parenLevel || ( $this->parserCurrentIndex == $this->input_len - 1 ) ) { break;
if ( $parenLevel || ( $this->parserCurrentIndex == $this->input_len - 1 ) ) {
break;
}
$cc2 = $this->CharCode( $this->parserCurrentIndex + 1 );
if ( $cc2 == 47 ) {
// //, find lnfeed
for ( $this->parserCurrentIndex += 2; $this->parserCurrentIndex < $this->input_len; $this->parserCurrentIndex++ ) {
$cc2 = $this->CharCode( $this->parserCurrentIndex );
if ( ( $cc2 <= 13 ) && ( ( $cc2 == 10 ) || ( $cc2 == 13 ) ) ) { break;
if ( ( $cc2 <= 13 ) && ( ( $cc2 == 10 ) || ( $cc2 == 13 ) ) ) {
break;
}
}
} elseif ( $cc2 == 42 ) {
// /*, find */
$lastMultiComment = $currentChunkStartIndex = $this->parserCurrentIndex;
for ( $this->parserCurrentIndex += 2; $this->parserCurrentIndex < $this->input_len - 1; $this->parserCurrentIndex++ ) {
$cc2 = $this->CharCode( $this->parserCurrentIndex );
if ( $cc2 == 125 ) { $lastMultiCommentEndBrace = $this->parserCurrentIndex;
if ( $cc2 == 125 ) {
$lastMultiCommentEndBrace = $this->parserCurrentIndex;
}
if ( $cc2 != 42 ) { continue;
if ( $cc2 != 42 ) {
continue;
}
if ( $this->CharCode( $this->parserCurrentIndex + 1 ) == 47 ) { break;
if ( $this->CharCode( $this->parserCurrentIndex + 1 ) == 47 ) {
break;
}
}
if ( $this->parserCurrentIndex == $this->input_len - 1 ) {
Expand Down
3 changes: 2 additions & 1 deletion lib/Less/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,8 @@ public function datauri( $mimetypeNode, $filePathNode = null ) {

$charset = Less_Mime::charsets_lookup( $mimetype );
$useBase64 = !in_array( $charset, [ 'US-ASCII', 'UTF-8' ] );
if ( $useBase64 ) { $mimetype .= ';base64';
if ( $useBase64 ) {
$mimetype .= ';base64';
}

} else {
Expand Down
11 changes: 7 additions & 4 deletions lib/Less/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ private function rgb2html( $r, $g = -1, $b = -1 ) {
}

$r = intval( $r );
$g = intval( $g );
$g = intval( $g );
$b = intval( $b );

$r = dechex( $r < 0 ? 0 : ( $r > 255 ? 255 : $r ) );
Expand Down Expand Up @@ -1379,7 +1379,8 @@ function parseExtend( $isRule = false ) {
$elements = [];
while ( true ) {
$option = $this->MatchReg( '/\\G(all)(?=\s*(\)|,))/' );
if ( $option ) { break;
if ( $option ) {
break;
}
$e = $this->parseElement();
if ( !$e ) {
Expand Down Expand Up @@ -2126,7 +2127,8 @@ private function parseImportOptions() {
break;
}
$options[$optionName] = $value;
if ( !$this->MatchChar( ',' ) ) { break;
if ( !$this->MatchChar( ',' ) ) {
break;
}
}
}while ( $optionName );
Expand Down Expand Up @@ -2394,7 +2396,8 @@ function parseMultiplication() {

$a = $this->parseOperand();

if ( !$a ) { break;
if ( !$a ) {
break;
}

$m->parensInOp = true;
Expand Down
3 changes: 2 additions & 1 deletion lib/Less/Tree/Mixin/Definition.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ public function compileParams( $env, $mixinFrames, $args = [], &$evaldArguments
$argIndex = 0;
foreach ( $params as $i => $param ) {

if ( isset( $evaldArguments[$i] ) ) { continue;
if ( isset( $evaldArguments[$i] ) ) {
continue;
}

$arg = null;
Expand Down

0 comments on commit 9a960cb

Please sign in to comment.