diff --git a/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.inc b/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.1.inc similarity index 97% rename from src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.inc rename to src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.1.inc index 2399a387e1..8e17dbb644 100644 --- a/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.inc +++ b/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.1.inc @@ -175,3 +175,8 @@ class NonArbitraryParenthesesWithKeywords { $d = new parent( $foo,$bar ); } } + +// Test that the match expression does not trigger the sniff. +$b = match ( $a ) { + 1 => true, +}; diff --git a/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.inc.fixed b/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.1.inc.fixed similarity index 97% rename from src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.inc.fixed rename to src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.1.inc.fixed index 9162728e17..c215753ccb 100644 --- a/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.inc.fixed +++ b/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.1.inc.fixed @@ -163,3 +163,8 @@ class NonArbitraryParenthesesWithKeywords { $d = new parent( $foo,$bar ); } } + +// Test that the match expression does not trigger the sniff. +$b = match ( $a ) { + 1 => true, +}; diff --git a/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.2.inc b/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.2.inc new file mode 100644 index 0000000000..3d5bcd0a5c --- /dev/null +++ b/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.2.inc @@ -0,0 +1,4 @@ + */ - public function getErrorList() + public function getErrorList($testFile='') { - return [ - 64 => 4, - 66 => 1, - 68 => 1, - 69 => 1, - 72 => 2, - 73 => 2, - 77 => 2, - 81 => 4, - 90 => 4, - 94 => 1, - 95 => 1, - 97 => 1, - 100 => 2, - 101 => 2, - 104 => 2, - 107 => 2, - 109 => 4, - 111 => 4, - 113 => 2, - 115 => 2, - 123 => 1, - 125 => 2, - 127 => 1, - 131 => 1, - 133 => 1, - 137 => 1, - 139 => 2, - 141 => 1, - 144 => 1, - 146 => 1, - 163 => 1, - 164 => 1, - 165 => 1, - ]; + switch ($testFile) { + case 'ArbitraryParenthesesSpacingUnitTest.1.inc': + return [ + 64 => 4, + 66 => 1, + 68 => 1, + 69 => 1, + 72 => 2, + 73 => 2, + 77 => 2, + 81 => 4, + 90 => 4, + 94 => 1, + 95 => 1, + 97 => 1, + 100 => 2, + 101 => 2, + 104 => 2, + 107 => 2, + 109 => 4, + 111 => 4, + 113 => 2, + 115 => 2, + 123 => 1, + 125 => 2, + 127 => 1, + 131 => 1, + 133 => 1, + 137 => 1, + 139 => 2, + 141 => 1, + 144 => 1, + 146 => 1, + 163 => 1, + 164 => 1, + 165 => 1, + ]; + + default: + return []; + }//end switch }//end getErrorList() @@ -75,14 +83,22 @@ public function getErrorList() * The key of the array should represent the line number and the value * should represent the number of warnings that should occur on that line. * + * @param string $testFile The name of the file being tested. + * * @return array */ - public function getWarningList() + public function getWarningList($testFile='') { - return [ - 55 => 1, - 56 => 1, - ]; + switch ($testFile) { + case 'ArbitraryParenthesesSpacingUnitTest.1.inc': + return [ + 55 => 1, + 56 => 1, + ]; + + default: + return []; + }//end switch }//end getWarningList()