|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +/** |
| 6 | + * Copyright (c) 2018-2026 Andreas Möller |
| 7 | + * |
| 8 | + * For the full copyright and license information, please view |
| 9 | + * the LICENSE.md file that was distributed with this source code. |
| 10 | + * |
| 11 | + * @see https://github.com/ergebnis/phpstan-rules |
| 12 | + */ |
| 13 | + |
| 14 | +namespace Ergebnis\PHPStan\Rules\Test\Integration\Files; |
| 15 | + |
| 16 | +use Ergebnis\PHPStan\Rules\Test; |
| 17 | +use PHPStan\Rules; |
| 18 | +use PHPStan\Testing; |
| 19 | + |
| 20 | +/** |
| 21 | + * @covers \Ergebnis\PHPStan\Rules\Files\NoPhpstanIgnoreRule |
| 22 | + * |
| 23 | + * @uses \Ergebnis\PHPStan\Rules\ErrorIdentifier |
| 24 | + * |
| 25 | + * @extends Testing\RuleTestCase<\Ergebnis\PHPStan\Rules\Files\NoPhpstanIgnoreRule> |
| 26 | + */ |
| 27 | +final class NoPhpStanIgnoreRuleTest extends Testing\RuleTestCase |
| 28 | +{ |
| 29 | + use Test\Util\Helper; |
| 30 | + |
| 31 | + public function testNoIgnoreRule(): void |
| 32 | + { |
| 33 | + $this->analyse( |
| 34 | + self::phpFilesIn(__DIR__ . '/../../Fixture/Files/NoPhpstanIgnoreRule'), |
| 35 | + [ |
| 36 | + [ |
| 37 | + 'Errors reported by phpstan/phpstan should not be ignored via "@phpstan-ignore", fix the error or use the baseline instead.', |
| 38 | + 5, |
| 39 | + ], |
| 40 | + [ |
| 41 | + 'No error with identifier variable.undefined is reported on line 6.', |
| 42 | + 6, |
| 43 | + ], |
| 44 | + [ |
| 45 | + 'Errors reported by phpstan/phpstan should not be ignored via "@phpstan-ignore", fix the error or use the baseline instead.', |
| 46 | + 8, |
| 47 | + ], |
| 48 | + [ |
| 49 | + 'No error with identifier variable.undefined is reported on line 9.', |
| 50 | + 9, |
| 51 | + ], |
| 52 | + [ |
| 53 | + 'Errors reported by phpstan/phpstan should not be ignored via "@phpstan-ignore", fix the error or use the baseline instead.', |
| 54 | + 11, |
| 55 | + ], |
| 56 | + [ |
| 57 | + 'No error with identifier variable.undefined is reported on line 12.', |
| 58 | + 12, |
| 59 | + ], |
| 60 | + [ |
| 61 | + 'Errors reported by phpstan/phpstan should not be ignored via "@phpstan-ignore", fix the error or use the baseline instead.', |
| 62 | + 15, |
| 63 | + ], |
| 64 | + [ |
| 65 | + 'No error with identifier variable.undefined is reported on line 17.', |
| 66 | + 17, |
| 67 | + ], |
| 68 | + [ |
| 69 | + 'Errors reported by phpstan/phpstan should not be ignored via "@phpstan-ignore-line", fix the error or use the baseline instead.', |
| 70 | + 19, |
| 71 | + ], |
| 72 | + [ |
| 73 | + 'No error to ignore is reported on line 19.', |
| 74 | + 19, |
| 75 | + ], |
| 76 | + [ |
| 77 | + 'Errors reported by phpstan/phpstan should not be ignored via "@phpstan-ignore-line", fix the error or use the baseline instead.', |
| 78 | + 21, |
| 79 | + ], |
| 80 | + [ |
| 81 | + 'No error to ignore is reported on line 21.', |
| 82 | + 21, |
| 83 | + ], |
| 84 | + [ |
| 85 | + 'Errors reported by phpstan/phpstan should not be ignored via "@phpstan-ignore-line", fix the error or use the baseline instead.', |
| 86 | + 25, |
| 87 | + ], |
| 88 | + [ |
| 89 | + 'No error to ignore is reported on line 25.', |
| 90 | + 25, |
| 91 | + ], |
| 92 | + [ |
| 93 | + 'Errors reported by phpstan/phpstan should not be ignored via "@phpstan-ignore-next-line", fix the error or use the baseline instead.', |
| 94 | + 27, |
| 95 | + ], |
| 96 | + [ |
| 97 | + 'No error to ignore is reported on line 28.', |
| 98 | + 28, |
| 99 | + ], |
| 100 | + [ |
| 101 | + 'Errors reported by phpstan/phpstan should not be ignored via "@phpstan-ignore-next-line", fix the error or use the baseline instead.', |
| 102 | + 30, |
| 103 | + ], |
| 104 | + [ |
| 105 | + 'No error to ignore is reported on line 31.', |
| 106 | + 31, |
| 107 | + ], |
| 108 | + [ |
| 109 | + 'Errors reported by phpstan/phpstan should not be ignored via "@phpstan-ignore-next-line", fix the error or use the baseline instead.', |
| 110 | + 33, |
| 111 | + ], |
| 112 | + [ |
| 113 | + 'No error to ignore is reported on line 34.', |
| 114 | + 34, |
| 115 | + ], |
| 116 | + ], |
| 117 | + ); |
| 118 | + } |
| 119 | + |
| 120 | + protected function getRule(): Rules\Rule |
| 121 | + { |
| 122 | + return new \Ergebnis\PHPStan\Rules\Files\NoPhpstanIgnoreRule(); |
| 123 | + } |
| 124 | +} |
0 commit comments