From 9811fc577ad819faff98486c30bbfc3836726753 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Mon, 9 Dec 2024 16:33:02 -0300 Subject: [PATCH] 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. --- .../Tests/Metrics/NestingLevelUnitTest.1.inc | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Standards/Generic/Tests/Metrics/NestingLevelUnitTest.1.inc b/src/Standards/Generic/Tests/Metrics/NestingLevelUnitTest.1.inc index 5f8c1b1dcb..3f1dd92617 100644 --- a/src/Standards/Generic/Tests/Metrics/NestingLevelUnitTest.1.inc +++ b/src/Standards/Generic/Tests/Metrics/NestingLevelUnitTest.1.inc @@ -27,16 +27,16 @@ function nestingFive() function nestingSix() { if ($condition) { - echo 'hi'; - switch ($condition) - { + } else { + switch ($condition) { case '1': if ($condition === '1') { - if ($cond) { + } elseif ($condition === '2') { + do { foreach ($conds as $cond) { echo 'hi'; } - } + } while ($cond > 5); } break; } @@ -79,19 +79,19 @@ function nestingEleven() case '1': if ($condition === '1') { if ($cond) { - switch ($cond) { - case '1': - if ($cond === '1') { - foreach ($conds as $cond) { - if ($cond === 'hi') { - if ($cond !== 'bye') { - echo 'hi'; - } + try { + if ( $cond === '1' ) { + for ( $i = 0; $i < 10; $i ++ ) { + while ($i < 5) { + if ( $cond === 'hi' ) { + match ( $cond ) { + 'hi' => 'something', + }; } } } - break; - } + } + } catch (Exception $e) {} } } break;