diff --git a/src/Standards/Generic/Sniffs/Classes/OpeningBraceSameLineSniff.php b/src/Standards/Generic/Sniffs/Classes/OpeningBraceSameLineSniff.php index 40291ea47d..126b648113 100644 --- a/src/Standards/Generic/Sniffs/Classes/OpeningBraceSameLineSniff.php +++ b/src/Standards/Generic/Sniffs/Classes/OpeningBraceSameLineSniff.php @@ -49,8 +49,7 @@ public function process(File $phpcsFile, $stackPtr) $errorData = [strtolower($tokens[$stackPtr]['content']).' '.$tokens[$scopeIdentifier]['content']]; if (isset($tokens[$stackPtr]['scope_opener']) === false) { - $error = 'Possible parse error: %s missing opening or closing brace'; - $phpcsFile->addWarning($error, $stackPtr, 'MissingBrace', $errorData); + // Parse error or live coding. return; } diff --git a/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.inc b/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.inc index ce9a69f8d9..57c0366a68 100644 --- a/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.inc +++ b/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.inc @@ -47,7 +47,7 @@ class Test_Class_Bad_H extends Test_Class_Bad_G { class Test_Class_Bad_I implements Test_Interface_Bad_C{ } -// This one should be flagged as a potential parse error. +// This one should be ignored as a potential parse error. class Test_Class_Bad_H // This is OK. diff --git a/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.inc.fixed b/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.inc.fixed index 0d5f6b63f3..2bcfc63d05 100644 --- a/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.inc.fixed +++ b/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.inc.fixed @@ -47,7 +47,7 @@ class Test_Class_Bad_H extends Test_Class_Bad_G { class Test_Class_Bad_I implements Test_Interface_Bad_C { } -// This one should be flagged as a potential parse error. +// This one should be ignored as a potential parse error. class Test_Class_Bad_H // This is OK. diff --git a/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.php b/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.php index 451af9b243..fc1f444d2f 100644 --- a/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.php +++ b/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.php @@ -60,7 +60,7 @@ public function getErrorList() */ public function getWarningList() { - return [51 => 1]; + return []; }//end getWarningList() diff --git a/src/Standards/PEAR/Sniffs/Classes/ClassDeclarationSniff.php b/src/Standards/PEAR/Sniffs/Classes/ClassDeclarationSniff.php index 893dc9a8df..3466be1a44 100644 --- a/src/Standards/PEAR/Sniffs/Classes/ClassDeclarationSniff.php +++ b/src/Standards/PEAR/Sniffs/Classes/ClassDeclarationSniff.php @@ -48,8 +48,7 @@ public function process(File $phpcsFile, $stackPtr) $errorData = [strtolower($tokens[$stackPtr]['content'])]; if (isset($tokens[$stackPtr]['scope_opener']) === false) { - $error = 'Possible parse error: %s missing opening or closing brace'; - $phpcsFile->addWarning($error, $stackPtr, 'MissingBrace', $errorData); + // Parse error or live coding. return; } diff --git a/src/Standards/PEAR/Tests/Classes/ClassDeclarationUnitTest.2.inc b/src/Standards/PEAR/Tests/Classes/ClassDeclarationUnitTest.2.inc index ac71fc9f27..f86f5a0cbb 100644 --- a/src/Standards/PEAR/Tests/Classes/ClassDeclarationUnitTest.2.inc +++ b/src/Standards/PEAR/Tests/Classes/ClassDeclarationUnitTest.2.inc @@ -7,5 +7,5 @@ if (!class_exists('ClassOpeningBraceTabIndented')) { } -// Needs to be last test in the file. Intentional parse error. +// Needs to be last test in the file. Intentional parse error. Should be ignored. class MyParseError extends Exception diff --git a/src/Standards/PEAR/Tests/Classes/ClassDeclarationUnitTest.php b/src/Standards/PEAR/Tests/Classes/ClassDeclarationUnitTest.php index 12648cc0a2..c0461c0f2d 100644 --- a/src/Standards/PEAR/Tests/Classes/ClassDeclarationUnitTest.php +++ b/src/Standards/PEAR/Tests/Classes/ClassDeclarationUnitTest.php @@ -88,10 +88,6 @@ public function getErrorList($testFile='') */ public function getWarningList($testFile='') { - if ($testFile === 'ClassDeclarationUnitTest.2.inc') { - return [11 => 1]; - } - return[]; }//end getWarningList() diff --git a/src/Standards/Squiz/Sniffs/Classes/ValidClassNameSniff.php b/src/Standards/Squiz/Sniffs/Classes/ValidClassNameSniff.php index 5f4f261fc3..1fd84a149a 100644 --- a/src/Standards/Squiz/Sniffs/Classes/ValidClassNameSniff.php +++ b/src/Standards/Squiz/Sniffs/Classes/ValidClassNameSniff.php @@ -49,9 +49,7 @@ public function process(File $phpcsFile, $stackPtr) $tokens = $phpcsFile->getTokens(); if (isset($tokens[$stackPtr]['scope_opener']) === false) { - $error = 'Possible parse error: %s missing opening or closing brace'; - $data = [$tokens[$stackPtr]['content']]; - $phpcsFile->addWarning($error, $stackPtr, 'MissingBrace', $data); + // Parse error or live coding. return; } diff --git a/src/Standards/Squiz/Sniffs/Commenting/ClosingDeclarationCommentSniff.php b/src/Standards/Squiz/Sniffs/Commenting/ClosingDeclarationCommentSniff.php index 44bd4388db..f9cffbb174 100644 --- a/src/Standards/Squiz/Sniffs/Commenting/ClosingDeclarationCommentSniff.php +++ b/src/Standards/Squiz/Sniffs/Commenting/ClosingDeclarationCommentSniff.php @@ -62,8 +62,7 @@ public function process(File $phpcsFile, $stackPtr) } if (isset($tokens[$stackPtr]['scope_closer']) === false) { - $error = 'Possible parse error: non-abstract method defined as abstract'; - $phpcsFile->addWarning($error, $stackPtr, 'Abstract'); + // Parse error or live coding. return; } @@ -80,9 +79,7 @@ public function process(File $phpcsFile, $stackPtr) }//end if if (isset($tokens[$stackPtr]['scope_closer']) === false) { - $error = 'Possible parse error: %s missing opening or closing brace'; - $data = [$tokens[$stackPtr]['content']]; - $phpcsFile->addWarning($error, $stackPtr, 'MissingBrace', $data); + // Parse error or live coding. return; } diff --git a/src/Standards/Squiz/Sniffs/ControlStructures/ForEachLoopDeclarationSniff.php b/src/Standards/Squiz/Sniffs/ControlStructures/ForEachLoopDeclarationSniff.php index 456886b369..498849209f 100644 --- a/src/Standards/Squiz/Sniffs/ControlStructures/ForEachLoopDeclarationSniff.php +++ b/src/Standards/Squiz/Sniffs/ControlStructures/ForEachLoopDeclarationSniff.php @@ -59,14 +59,12 @@ public function process(File $phpcsFile, $stackPtr) $openingBracket = $phpcsFile->findNext(T_OPEN_PARENTHESIS, $stackPtr); if ($openingBracket === false) { - $error = 'Possible parse error: FOREACH has no opening parenthesis'; - $phpcsFile->addWarning($error, $stackPtr, 'MissingOpenParenthesis'); + // Parse error or live coding. return; } if (isset($tokens[$openingBracket]['parenthesis_closer']) === false) { - $error = 'Possible parse error: FOREACH has no closing parenthesis'; - $phpcsFile->addWarning($error, $stackPtr, 'MissingCloseParenthesis'); + // Parse error or live coding. return; } @@ -134,8 +132,7 @@ public function process(File $phpcsFile, $stackPtr) $asToken = $phpcsFile->findNext(T_AS, $openingBracket); if ($asToken === false) { - $error = 'Possible parse error: FOREACH has no AS statement'; - $phpcsFile->addWarning($error, $stackPtr, 'MissingAs'); + // Parse error or live coding. return; } diff --git a/src/Standards/Squiz/Sniffs/ControlStructures/ForLoopDeclarationSniff.php b/src/Standards/Squiz/Sniffs/ControlStructures/ForLoopDeclarationSniff.php index 51fd738291..29393fffb2 100644 --- a/src/Standards/Squiz/Sniffs/ControlStructures/ForLoopDeclarationSniff.php +++ b/src/Standards/Squiz/Sniffs/ControlStructures/ForLoopDeclarationSniff.php @@ -67,8 +67,7 @@ public function process(File $phpcsFile, $stackPtr) $openingBracket = $phpcsFile->findNext(T_OPEN_PARENTHESIS, $stackPtr); if ($openingBracket === false || isset($tokens[$openingBracket]['parenthesis_closer']) === false) { - $error = 'Possible parse error: no opening/closing parenthesis for FOR keyword'; - $phpcsFile->addWarning($error, $stackPtr, 'NoOpenBracket'); + // Parse error or live coding. return; } diff --git a/src/Standards/Squiz/Sniffs/ControlStructures/SwitchDeclarationSniff.php b/src/Standards/Squiz/Sniffs/ControlStructures/SwitchDeclarationSniff.php index 77d49749bb..c08c8fed02 100644 --- a/src/Standards/Squiz/Sniffs/ControlStructures/SwitchDeclarationSniff.php +++ b/src/Standards/Squiz/Sniffs/ControlStructures/SwitchDeclarationSniff.php @@ -123,8 +123,7 @@ public function process(File $phpcsFile, $stackPtr) } if (isset($tokens[$nextCase]['scope_opener']) === false) { - $error = 'Possible parse error: CASE missing opening colon'; - $phpcsFile->addWarning($error, $nextCase, 'MissingColon'); + // Parse error or live coding. continue; } diff --git a/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.1.inc b/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.1.inc index 560370bfb1..9e44bd71f1 100644 --- a/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.1.inc +++ b/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.1.inc @@ -68,7 +68,7 @@ interface TestClass class MyClass { - public function myFunction(); + public function parseErrorMustBeIgnored(); }//end class // Closures don't need end comments. diff --git a/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.1.inc.fixed b/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.1.inc.fixed index 8c69014528..c3b6e68898 100644 --- a/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.1.inc.fixed +++ b/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.1.inc.fixed @@ -68,7 +68,7 @@ interface TestClass class MyClass { - public function myFunction(); + public function parseErrorMustBeIgnored(); }//end class // Closures don't need end comments. diff --git a/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.2.inc b/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.2.inc index 25913dd8fc..7597555087 100644 --- a/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.2.inc +++ b/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.2.inc @@ -2,6 +2,6 @@ // Intentional parse error (missing opening bracket). // This should be the only test in this file. -// Testing that the sniff is triggered. +// Testing that the sniff stays silent. class MissingOpeningBracket diff --git a/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.3.inc b/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.3.inc index 310e77f0ce..a16df11316 100644 --- a/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.3.inc +++ b/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.3.inc @@ -2,6 +2,6 @@ // Intentional parse error (missing closing bracket). // This should be the only test in this file. -// Testing that the sniff is triggered. +// Testing that the sniff stays silent. class MissingClosingBracket { diff --git a/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.php b/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.php index fcbb026423..2680eda7ad 100644 --- a/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.php +++ b/src/Standards/Squiz/Tests/Commenting/ClosingDeclarationCommentUnitTest.php @@ -78,17 +78,7 @@ public function getErrorList($testFile='') */ public function getWarningList($testFile='') { - switch ($testFile) { - case 'ClosingDeclarationCommentUnitTest.1.inc': - return [71 => 1]; - - case 'ClosingDeclarationCommentUnitTest.2.inc': - case 'ClosingDeclarationCommentUnitTest.3.inc': - return [7 => 1]; - - default: - return []; - } + return []; }//end getWarningList() diff --git a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.2.inc b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.2.inc index a327ccedda..d7a783853f 100644 --- a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.2.inc +++ b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.2.inc @@ -2,5 +2,5 @@ // Parse error/live coding test (no parentheses). // This test has to be the only test in the file! -// Testing the "NoOpenBracket" warning. +// This should be ignored. for diff --git a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.3.inc b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.3.inc index cbda178101..36035c7d08 100644 --- a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.3.inc +++ b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.3.inc @@ -2,5 +2,5 @@ // Parse error/live coding test (no close parenthesis). // This test has to be the only test in the file! -// Testing the "NoOpenBracket" warning. +// This should be ignored. for ($i = 10; diff --git a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.php b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.php index 0f8fff6d54..fe13da8271 100644 --- a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.php +++ b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.php @@ -86,14 +86,7 @@ public function getErrorList($testFile='') */ public function getWarningList($testFile='') { - switch ($testFile) { - case 'ForLoopDeclarationUnitTest.2.inc': - case 'ForLoopDeclarationUnitTest.3.inc': - return [6 => 1]; - - default: - return []; - }//end switch + return []; }//end getWarningList()