Skip to content

Commit

Permalink
Generic/EmptyPHPStatement: minor tweaks to test case file
Browse files Browse the repository at this point in the history
* Updated tests to have more examples with more than one superfluous semicolon.
* Minor test comment punctuation tweaks.
  • Loading branch information
rodrigoprimo authored and jrfnl committed Nov 26, 2024
1 parent f6c5682 commit 74bcb2e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function_call();

?>
<input name="<?php ; something_else(); ?>" />
<input name="<?php something_else(); ; ?>" />
<input name="<?php something_else(); ; ; ?>" />

/*
* Test empty statement: no code between PHP open and close tag.
Expand All @@ -42,7 +42,7 @@ function_call();
-->
<?php ; ?>

<input name="<?php ; ?>" /> <!-- Bad. -->
<input name="<?php ;; ?>" /> <!-- Bad. -->

<!-- Tests with short open echo tag. -->
<input name="<?= 'some text' ?>" /> <!-- OK. -->
Expand All @@ -53,7 +53,7 @@ function_call();
// Guard against false positives for two consecutive semicolons in a for statement.
for ( $i = 0; ; $i++ ) {}

// Test for useless semicolons
// Test for useless semicolons.
for ( $i = 0; ; $i++ ) {};

if (true) {};
Expand All @@ -80,7 +80,7 @@ if ($foo) {
;
}

// Do not remove semicolon after match
// Do not remove semicolon after match.
$c = match ($a) {
1 => true,
};
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function_call();
// Guard against false positives for two consecutive semicolons in a for statement.
for ( $i = 0; ; $i++ ) {}

// Test for useless semicolons
// Test for useless semicolons.
for ( $i = 0; ; $i++ ) {}

if (true) {}
Expand All @@ -74,7 +74,7 @@ echo $a{0};
if ($foo) {
}

// Do not remove semicolon after match
// Do not remove semicolon after match.
$c = match ($a) {
1 => true,
};
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ public function getWarningList($testFile='')
15 => 1,
18 => 1,
21 => 1,
22 => 1,
22 => 2,
31 => 1,
33 => 1,
43 => 1,
45 => 1,
45 => 2,
49 => 1,
50 => 1,
57 => 1,
Expand Down

0 comments on commit 74bcb2e

Please sign in to comment.