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
Version: I'm able to reproduce this in the latest commit.
Expected: If <?= is used and a semicolon is needed in the fixed file, a semicolon should be inserted at an appropriate place (e.g. not as part of a line comment). (Or skip warning about it and fixing it)
Observed: No semicolon is inserted
gsherwood
changed the title
Bug: Zend.Files.ClosingTag.NotAllowed removes closing tag from end of file without inserting a semicolon
Zend.Files.ClosingTag removes closing tag from end of file without inserting a semicolon
Sep 5, 2018
Thanks for reporting this. The fix will be in 3.3.2.
You may also consider using PSR2.Files.ClosingTag instead of the Zend sniff. It already accounted for this and only enforces no closing tag when the file is PHP-only. In the mixed case (like in your example) the closing tag would be allowed. That's obviously personal preference, but thought I'd point it out in case you wanted the tag kept in these cases.
Version: I'm able to reproduce this in the latest commit.
Expected: If
<?=
is used and a semicolon is needed in the fixed file, a semicolon should be inserted at an appropriate place (e.g. not as part of a line comment). (Or skip warning about it and fixing it)Observed: No semicolon is inserted
The input file
The observed result (results in a parse error):
An example ruleset.xml:
Command:
path/to/PHP_CodeSniffer/bin/phpcbf --standard=ruleset.xml src/bug.php
A workaround is to exclude Zend.Files.ClosingTag.NotAllowed and include PSR2.Files.ClosingTag.NotAllowed or PSR2.
The text was updated successfully, but these errors were encountered: