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.php with 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
See also squizlabs/PHP_CodeSniffer#2732
Describe the bug
I'm getting
2 | ERROR | The file header must be the first content in the file (PSR12.Files.FileHeader.HeaderPosition)when<?phpis in the middle of a mixed file when followed by docstring-like comment.Code sample
Custom ruleset
N/A
To reproduce
Steps to reproduce the behavior:
test.phpwith the code sample above...phpcs -s --standard=PSR12 test.phpExpected behavior
No error expected in this case
Versions (please complete the following information)
Additional context
Add any other context about the problem here.
Please confirm
4.xbranch of PHP_CodeSniffer.See also squizlabs/PHP_CodeSniffer#2732