-
-
Notifications
You must be signed in to change notification settings - Fork 88
Open
Description
Describe the bug
I'm getting 2 | ERROR | The file header must be the first content in the file (PSR12.Files.FileHeader.HeaderPosition) when <?php is in the middle of a mixed file when followed by docstring-like comment.
Code sample
<div></div>
<?php
/*** Comment - this is important, only comment in such format triggers the issue ***/
$b = 3;Custom ruleset
N/A
To reproduce
Steps to reproduce the behavior:
- Create a file called
test.phpwith the code sample above... - Run
phpcs -s --standard=PSR12 test.php - See error message displayed
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------
2 | ERROR | The file header must be the first content in the file (PSR12.Files.FileHeader.HeaderPosition)
Expected behavior
No error expected in this case
Versions (please complete the following information)
| Operating System | Windows, Docker |
| PHP version | 7.4 |
| PHP_CodeSniffer version | PHP_CodeSniffer version 3.13.2 (stable) , 4.0.1 (stable) |
| Standard | PSR12 |
| Install type | Composer in docker container |
Additional context
Add any other context about the problem here.
Please confirm
- I have searched the issue list and am not opening a duplicate issue.
- I have read the Contribution Guidelines and this is not a support question.
- I confirm that this bug is a bug in PHP_CodeSniffer and not in one of the external standards.
- I have verified the issue still exists in the
4.xbranch of PHP_CodeSniffer.
See also squizlabs/PHP_CodeSniffer#2732