File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ final class Analyzer
7171 T_WHILE => T_WHILE ,
7272 T_DO => T_DO ,
7373 T_CATCH => T_CATCH ,
74+ T_MATCH => T_MATCH ,
7475 ];
7576
7677 /**
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ public function provideTokensAndExpectedCognitiveComplexity(): Iterator
5858 yield [__DIR__ . '/Data/function9.php.inc ' , 5 ];
5959 yield [__DIR__ . '/Data/function10.php.inc ' , 19 ];
6060 yield [__DIR__ . '/Data/function11.php.inc ' , 1 ];
61+ yield [__DIR__ . '/Data/function12.php.inc ' , 6 ];
6162 }
6263
6364 /**
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ function matchIncrementsNesting ($ number ) {
4+ $ a = true ;
5+ $ b = true ;
6+
7+ if ($ a ) { // +1 if
8+ match ($ number ) { // +1 match +1 nesting
9+ 1 => $ b ? "one " : "uno " , // +1 ternary +2 nesting
10+ 2 => "a couple " ,
11+ 3 => "a few " ,
12+ default => "lots " ,
13+ };
14+ }
15+ }
16+
17+ // Cognitive Complexity 6
You can’t perform that action at this time.
0 commit comments