Skip to content

Commit

Permalink
Tests: remove unreachable code
Browse files Browse the repository at this point in the history
`break` after a `return` statement is redundant.

As a side-note: I did have to chuckle when I saw that the `NonExecutableCode` test file also included this 😂
  • Loading branch information
jrfnl committed Oct 29, 2023
1 parent 321d252 commit cbd6fd5
Show file tree
Hide file tree
Showing 23 changed files with 54 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,26 @@ public function getWarningList($testFile='')
12 => 1,
13 => 1,
];
break;

case 'DuplicateClassNameUnitTest.2.inc':
return [
2 => 1,
3 => 1,
4 => 1,
5 => 1,
];
break;

case 'DuplicateClassNameUnitTest.5.inc':
return [
3 => 1,
7 => 1,
];
break;

case 'DuplicateClassNameUnitTest.6.inc':
return [10 => 1];
break;

default:
return [];
break;
}//end switch

}//end getWarningList()
Expand Down
7 changes: 3 additions & 4 deletions src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,15 @@ public function getErrorList($testFile='')
switch ($testFile) {
case 'InlineHTMLUnitTest.3.inc':
return [4 => 1];
break;

case 'InlineHTMLUnitTest.4.inc':
return [1 => 1];
break;

case 'InlineHTMLUnitTest.7.inc':
return [1 => 1];
break;

default:
return [];
break;
}//end switch

}//end getErrorList()
Expand Down
12 changes: 5 additions & 7 deletions src/Standards/Generic/Tests/Files/LineLengthUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,13 @@ public function getErrorList($testFile='')
45 => 1,
82 => 1,
];
break;

case 'LineLengthUnitTest.2.inc':
case 'LineLengthUnitTest.3.inc':
return [7 => 1];
break;

default:
return [];
break;
}//end switch

}//end getErrorList()
Expand Down Expand Up @@ -89,20 +88,19 @@ public function getWarningList($testFile='')
75 => 1,
84 => 1,
];
break;

case 'LineLengthUnitTest.2.inc':
case 'LineLengthUnitTest.3.inc':
return [6 => 1];
break;

case 'LineLengthUnitTest.4.inc':
return [
10 => 1,
14 => 1,
];
break;

default:
return [];
break;
}//end switch

}//end getWarningList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function getWarningList($testFile='MultipleStatementAlignmentUnitTest.inc
499 => 1,
500 => 1,
];
break;

case 'MultipleStatementAlignmentUnitTest.js':
return [
11 => 1,
Expand Down Expand Up @@ -154,10 +154,9 @@ public function getWarningList($testFile='MultipleStatementAlignmentUnitTest.inc
114 => 1,
117 => 1,
];
break;

default:
return [];
break;
}//end switch

}//end getWarningList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ public function getErrorList($testFile='')
switch ($testFile) {
case 'CharacterBeforePHPOpeningTagUnitTest.1.inc':
return [2 => 1];
break;

default:
return [];
break;
}//end switch

}//end getErrorList()
Expand Down
4 changes: 2 additions & 2 deletions src/Standards/Generic/Tests/PHP/ClosingPHPTagUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ public function getErrorList($testFile='')
switch ($testFile) {
case 'ClosingPHPTagUnitTest.1.inc':
return [9 => 1];

case 'ClosingPHPTagUnitTest.2.inc':
return [5 => 1];
break;

default:
return [];
break;
}

}//end getErrorList()
Expand Down
5 changes: 2 additions & 3 deletions src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function getErrorList($testFile='LowerCaseConstantUnitTest.inc')
95 => 1,
100 => 2,
];
break;

case 'LowerCaseConstantUnitTest.js':
return [
2 => 1,
Expand All @@ -64,10 +64,9 @@ public function getErrorList($testFile='LowerCaseConstantUnitTest.inc')
13 => 1,
14 => 1,
];
break;

default:
return [];
break;
}//end switch

}//end getErrorList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public function getErrorList($testFile='')
switch ($testFile) {
case 'RequireStrictTypesUnitTest.1.inc':
return [];
break;
}

return [1 => 1];
Expand Down
3 changes: 1 addition & 2 deletions src/Standards/Generic/Tests/PHP/SyntaxUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ public function getErrorList($testFile='')
case 'SyntaxUnitTest.1.inc':
case 'SyntaxUnitTest.2.inc':
return [3 => 1];
break;

default:
return [];
break;
}

}//end getErrorList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function getErrorList($testFile='UnnecessaryStringConcatUnitTest.inc')
19 => 1,
20 => 1,
];
break;

case 'UnnecessaryStringConcatUnitTest.js':
return [
1 => 1,
Expand All @@ -46,10 +46,9 @@ public function getErrorList($testFile='UnnecessaryStringConcatUnitTest.inc')
14 => 1,
15 => 1,
];
break;

default:
return [];
break;
}//end switch

}//end getErrorList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function getErrorList($testFile='DisallowSpaceIndentUnitTest.1.inc')
117 => 1,
118 => 1,
];
break;

case 'DisallowSpaceIndentUnitTest.3.inc':
return [
2 => 1,
Expand All @@ -96,16 +96,15 @@ public function getErrorList($testFile='DisallowSpaceIndentUnitTest.1.inc')
14 => 1,
15 => 1,
];
break;

case 'DisallowSpaceIndentUnitTest.js':
return [3 => 1];
break;

case 'DisallowSpaceIndentUnitTest.css':
return [2 => 1];
break;

default:
return [];
break;
}//end switch

}//end getErrorList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function getErrorList($testFile='LongConditionClosingCommentUnitTest.inc'
1008 => 1,
1032 => 1,
];
break;

case 'LongConditionClosingCommentUnitTest.js':
return [
47 => 1,
Expand All @@ -76,10 +76,9 @@ public function getErrorList($testFile='LongConditionClosingCommentUnitTest.inc'
439 => 1,
444 => 1,
];
break;

default:
return [];
break;
}//end switch

}//end getErrorList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function getErrorList($testFile='OperatorBracketUnitTest.inc')
193 => 1,
194 => 2,
];
break;

case 'OperatorBracketUnitTest.js':
return [
5 => 1,
Expand All @@ -90,10 +90,9 @@ public function getErrorList($testFile='OperatorBracketUnitTest.inc')
63 => 1,
108 => 1,
];
break;

default:
return [];
break;
}//end switch

}//end getErrorList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getErrorList($testFile='ComparisonOperatorUsageUnitTest.inc')
131 => 1,
135 => 1,
];
break;

case 'ComparisonOperatorUsageUnitTest.js':
return [
5 => 1,
Expand All @@ -74,10 +74,9 @@ public function getErrorList($testFile='ComparisonOperatorUsageUnitTest.inc')
67 => 1,
71 => 1,
];
break;

default:
return [];
break;
}//end switch

}//end getErrorList()
Expand Down
5 changes: 2 additions & 3 deletions src/Standards/Squiz/Tests/PHP/CommentedOutCodeUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,15 @@ public function getWarningList($testFile='CommentedOutCodeUnitTest.inc')
147 => 1,
158 => 1,
];
break;

case 'CommentedOutCodeUnitTest.css':
return [
7 => 1,
16 => 1,
];
break;

default:
return [];
break;
}//end switch

}//end getWarningList()
Expand Down
5 changes: 2 additions & 3 deletions src/Standards/Squiz/Tests/PHP/DisallowInlineIfUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ public function getErrorList($testFile='DisallowInlineIfUnitTest.inc')
8 => 1,
18 => 1,
];
break;

case 'DisallowInlineIfUnitTest.js':
return [1 => 1];
break;

default:
return [];
break;
}//end switch

}//end getErrorList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,12 @@ public function getErrorList($testFile='DisallowSizeFunctionsInLoopsUnitTest.inc
44 => 1,
46 => 1,
];
break;

case 'DisallowSizeFunctionsInLoopsUnitTest.js':
return [1 => 1];
break;

default:
return [];
break;
}//end switch

}//end getErrorList()
Expand Down
5 changes: 2 additions & 3 deletions src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function getWarningList($testFile='')
391 => 1,
396 => 1,
];
break;

case 'NonExecutableCodeUnitTest.2.inc':
return [
7 => 1,
Expand All @@ -97,7 +97,7 @@ public function getWarningList($testFile='')
70 => 2,
71 => 2,
];
break;

case 'NonExecutableCodeUnitTest.3.inc':
return [
27 => 1,
Expand All @@ -108,7 +108,6 @@ public function getWarningList($testFile='')
];
default:
return [];
break;
}//end switch

}//end getWarningList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function getErrorList($testFile='ControlStructureSpacingUnitTest.inc')
261 => 1,
262 => 1,
];
break;

case 'ControlStructureSpacingUnitTest.js':
return [
3 => 1,
Expand All @@ -76,10 +76,9 @@ public function getErrorList($testFile='ControlStructureSpacingUnitTest.inc')
74 => 2,
75 => 2,
];
break;

default:
return [];
break;
}//end switch

}//end getErrorList()
Expand Down
Loading

0 comments on commit cbd6fd5

Please sign in to comment.