squizlabs / PHP_CodeSniffer

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
BSD 3-Clause "New" or "Revised" License
10.66k stars 1.48k forks source link

Redundant semicolon added to a file when fixing PSR2.Files.ClosingTag.NotAllowed #2943

Closed morozov closed 4 years ago

morozov commented 4 years ago

Consider the following file:

<?php
/*
 * Some comment goes here
 */
?>

Fixing it using phpcbf --standard=PSR2 test.php makes it look like:

<?php
;/*
 * Some comment goes here
 */

The semicolon is needed to address #773 but it's only needed when there is something else than whitespace or comment after the opening <?php tag.

gsherwood commented 4 years ago

Thanks for reporting this bug. The fix will be released in 3.5.6.