Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed Dec 10, 2019
1 parent 4abac7f commit 0334ea2
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,49 @@ if (
) {
return $n;
}

// phpcs:set PSR12.ControlStructures.BooleanOperatorPlacement allowOnly first
if (
$expr1
&& $expr2
&& ($expr3
|| $expr4)
&& $expr5
) {
// if body
} elseif (
$expr1 &&
($expr3 || $expr4)
&& $expr5
) {
// elseif body
} elseif (
$expr1
&& ($expr3 || $expr4) &&
$expr5
) {
// elseif body
}

// phpcs:set PSR12.ControlStructures.BooleanOperatorPlacement allowOnly last
if (
$expr1
&& $expr2
&& ($expr3
|| $expr4)
&& $expr5
) {
// if body
} elseif (
$expr1 &&
($expr3 || $expr4)
&& $expr5
) {
// elseif body
} elseif (
$expr1
&& ($expr3 || $expr4) &&
$expr5
) {
// elseif body
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,53 @@ if (
) {
return $n;
}

// phpcs:set PSR12.ControlStructures.BooleanOperatorPlacement allowOnly first
if (
$expr1
&& $expr2
&& ($expr3
|| $expr4)
&& $expr5
) {
// if body
} elseif (
$expr1
&& ($expr3
|| $expr4)
&& $expr5
) {
// elseif body
} elseif (
$expr1
&& ($expr3
|| $expr4)
&& $expr5
) {
// elseif body
}

// phpcs:set PSR12.ControlStructures.BooleanOperatorPlacement allowOnly last
if (
$expr1 &&
$expr2 &&
($expr3 ||
$expr4) &&
$expr5
) {
// if body
} elseif (
$expr1 &&
($expr3 ||
$expr4) &&
$expr5
) {
// elseif body
} elseif (
$expr1 &&
($expr3 ||
$expr4) &&
$expr5
) {
// elseif body
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@ class BooleanOperatorPlacementUnitTest extends AbstractSniffUnitTest
public function getErrorList()
{
return [
10 => 1,
16 => 1,
28 => 1,
34 => 1,
10 => 1,
16 => 1,
28 => 1,
34 => 1,
75 => 1,
81 => 1,
90 => 1,
98 => 1,
104 => 1,
];

}//end getErrorList()
Expand Down

0 comments on commit 0334ea2

Please sign in to comment.