@@ -424,16 +424,6 @@ public function testSuppressLine()
424
424
$ this ->assertEquals (1 , $ numErrors );
425
425
$ this ->assertCount (1 , $ errors );
426
426
427
- // Process with @ suppression on line before inside docblock.
428
- $ content = '<?php ' .PHP_EOL .'/** ' .PHP_EOL .' * Comment here ' .PHP_EOL .' * @phpcs:ignore ' .PHP_EOL .' * ' .str_repeat ('a ' , 50 ).PHP_EOL .'*/ ' ;
429
- $ file = new DummyFile ($ content , $ ruleset , $ config );
430
- $ file ->process ();
431
-
432
- $ errors = $ file ->getErrors ();
433
- $ numErrors = $ file ->getErrorCount ();
434
- $ this ->assertEquals (0 , $ numErrors );
435
- $ this ->assertCount (0 , $ errors );
436
-
437
427
// Process with suppression on same line.
438
428
$ content = '<?php ' .PHP_EOL .'$var = FALSE; // phpcs:ignore ' .PHP_EOL .'$var = FALSE; ' ;
439
429
$ file = new DummyFile ($ content , $ ruleset , $ config );
@@ -487,6 +477,40 @@ public function testSuppressLine()
487
477
}//end testSuppressLine()
488
478
489
479
480
+ /**
481
+ * Test suppressing a single error using a single line ignore within a docblock.
482
+ *
483
+ * @covers PHP_CodeSniffer\Tokenizers\Tokenizer::createPositionMap
484
+ *
485
+ * @return void
486
+ */
487
+ public function testSuppressLineWithinDocblock ()
488
+ {
489
+ $ config = new Config ();
490
+ $ config ->standards = ['Generic ' ];
491
+ $ config ->sniffs = ['Generic.Files.LineLength ' ];
492
+
493
+ $ ruleset = new Ruleset ($ config );
494
+
495
+ // Process with @ suppression on line before inside docblock.
496
+ $ comment = str_repeat ('a ' , 50 );
497
+ $ content = <<<EOD
498
+ <?php
499
+ /**
500
+ * Comment here
501
+ * @phpcs:ignore
502
+ * $comment
503
+ */
504
+ EOD ;
505
+ $ file = new DummyFile ($ content , $ ruleset , $ config );
506
+ $ file ->process ();
507
+
508
+ $ this ->assertSame (0 , $ file ->getErrorCount ());
509
+ $ this ->assertCount (0 , $ file ->getErrors ());
510
+
511
+ }//end testSuppressLineWithinDocblock()
512
+
513
+
490
514
/**
491
515
* Test that using a single line ignore does not interfere with other suppressions.
492
516
*
0 commit comments