You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on #699, I noticed an inconsistency in how the Generic.CodeAnalysis.EmptyPHPStatement sniff fixes superfluous semicolons placed right after a PHP open tag when the PHP ini directive short_open_tag is enabled.
If a normal open tag is used, the superfluous semicolon is removed, and a space is left between the open tag and the rest of the code. If a shot open tag is used, no space is left between the open tag and the rest of the code. I'm inclined to think the sniff should behave the same for both types of open tags.
This is probably not a high-priority issue as the resulting code is not a parse error, and short open tags are not very popular.
Leaving a single space after a short open tag makes sense to me and a PR to add special handling for short open tags would be welcome.
Though as you already said: low priority as it's not a parse error and AFAICS not a cause for fixer conflicts.
Describe the bug
While working on #699, I noticed an inconsistency in how the
Generic.CodeAnalysis.EmptyPHPStatement
sniff fixes superfluous semicolons placed right after a PHP open tag when the PHP ini directiveshort_open_tag
is enabled.If a normal open tag is used, the superfluous semicolon is removed, and a space is left between the open tag and the rest of the code. If a shot open tag is used, no space is left between the open tag and the rest of the code. I'm inclined to think the sniff should behave the same for both types of open tags.
This is probably not a high-priority issue as the resulting code is not a parse error, and short open tags are not very popular.
Related to #593
Code sample
To reproduce
Steps to reproduce the behavior:
short_open_tag
ini directive is enabled.test.php
with the code sample above.phpcbf --standard=Generic --sniffs=Generic.CodeAnalysis.EmptyPHPStatement test.php
<?
andmy_function();
.Expected behavior
I expect the sniff to preserve the space between
<?
andmy_function();
.Versions (please complete the following information)
Please confirm
master
branch of PHP_CodeSniffer.The text was updated successfully, but these errors were encountered: