File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -422,7 +422,7 @@ public function start($contents=null)
422
422
// token, get them to process it.
423
423
foreach ($ this ->_tokens as $ stackPtr => $ token ) {
424
424
// Check for ignored lines.
425
- if ($ token ['code ' ] === T_COMMENT ) {
425
+ if ($ token ['code ' ] === T_COMMENT || $ token [ ' code ' ] === T_DOC_COMMENT ) {
426
426
if (strpos ($ token ['content ' ], '@codingStandardsIgnoreStart ' ) !== false ) {
427
427
$ ignoring = true ;
428
428
} else if (strpos ($ token ['content ' ], '@codingStandardsIgnoreEnd ' ) !== false ) {
Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
39
39
- Fixed problem where some file content could be ignored when checking STDIN
40
40
- Version information is now printed when installed via composer or run from a Git clone (request #20050)
41
41
- Added Squiz DisallowBooleanStatementSniff to ban boolean operators outside of control structure conditions
42
+ - Coding standard ignore comments can now appear instead doc blocks as well as inline comments
43
+ -- Thanks to Stuart Langley for the patch
42
44
- PEAR MultiLineConditionSniff now has a setting to specify how many spaces code should be indented
43
45
-- Default remains at 4; override the 'indent' setting in a ruleset.xml file to change
44
46
-- Thanks to Szabolcs Sulik for the patch
Original file line number Diff line number Diff line change @@ -148,6 +148,18 @@ public function testSuppressFile()
148
148
$ this ->assertEquals (0 , $ numWarnings );
149
149
$ this ->assertEquals (0 , count ($ warnings ));
150
150
151
+ // Process with a Doc Block suppression.
152
+ $ content = '<?php ' .PHP_EOL .'/* @codingStandardsIgnoreFile */ ' .PHP_EOL .'//TODO: write some code ' ;
153
+ $ phpcs ->processFile ('suppressionTest.php ' , $ content );
154
+
155
+ $ files = $ phpcs ->getFiles ();
156
+ $ file = $ files [1 ];
157
+
158
+ $ warnings = $ file ->getWarnings ();
159
+ $ numWarnings = $ file ->getWarningCount ();
160
+ $ this ->assertEquals (0 , $ numWarnings );
161
+ $ this ->assertEquals (0 , count ($ warnings ));
162
+
151
163
}//end testSuppressFile()
152
164
153
165
You can’t perform that action at this time.
0 commit comments