Description
Describe the bug
A line that violates the PSR1.Files.SideEffects.FoundWithSymbols
rule still generates a warning about it even when preceded with // phpcs:ignore
Code sample
<?php
// phpcs:ignore
define('MYCONST', 'myval');
$var = 'test';
To reproduce
Steps to reproduce the behavior:
- Create a file called
test.php
with the code sample above... - Run
phpcs test.php ...
- See error message displayed
-----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------
1 | WARNING | A file should declare new symbols (classes, functions, constants, etc.) and
| | cause no other side effects, or it should execute logic with side effects, but
| | should not do both. The first symbol is defined on line 4 and the first side
| | effect is on line 5. (PSR1.Files.SideEffects.FoundWithSymbols)
-----------------------------------------------------------------------------------------------
Expected behavior
No warnings get generated
Versions (please complete the following information):
- OS: Debian 8.11
- PHP: 7.3.11
- PHPCS: 3.6.0
- Standard: PSR12
Additional context
When the offending line has a space removed between the parameters, thereby violating Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterComma
, that error does get ignored.
If I instead wrap the line in disable/enable, the warning does not get generated
<?php
// phpcs:disable
define('MYCONST', 'myval');
// phpcs:enable
$var = 'test';
If I disable just that rule, the warning does get generated:
<?php
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
define('MYCONST', 'myval');
// phpcs:enable
$var = 'test';
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Ready for Release