Skip to content

Commit 9811fc5

Browse files
rodrigoprimojrfnl
authored andcommitted
Generic/NestingLevel: improve tests by adding more tokens
This commit improves the tests by adding more tokens that increase the nesting level and are already considered by the sniff, but were not being used in the tests.
1 parent 9794ed8 commit 9811fc5

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/Standards/Generic/Tests/Metrics/NestingLevelUnitTest.1.inc

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ function nestingFive()
2727
function nestingSix()
2828
{
2929
if ($condition) {
30-
echo 'hi';
31-
switch ($condition)
32-
{
30+
} else {
31+
switch ($condition) {
3332
case '1':
3433
if ($condition === '1') {
35-
if ($cond) {
34+
} elseif ($condition === '2') {
35+
do {
3636
foreach ($conds as $cond) {
3737
echo 'hi';
3838
}
39-
}
39+
} while ($cond > 5);
4040
}
4141
break;
4242
}
@@ -79,19 +79,19 @@ function nestingEleven()
7979
case '1':
8080
if ($condition === '1') {
8181
if ($cond) {
82-
switch ($cond) {
83-
case '1':
84-
if ($cond === '1') {
85-
foreach ($conds as $cond) {
86-
if ($cond === 'hi') {
87-
if ($cond !== 'bye') {
88-
echo 'hi';
89-
}
82+
try {
83+
if ( $cond === '1' ) {
84+
for ( $i = 0; $i < 10; $i ++ ) {
85+
while ($i < 5) {
86+
if ( $cond === 'hi' ) {
87+
match ( $cond ) {
88+
'hi' => 'something',
89+
};
9090
}
9191
}
9292
}
93-
break;
94-
}
93+
}
94+
} catch (Exception $e) {}
9595
}
9696
}
9797
break;

0 commit comments

Comments
 (0)