-
Couldn't load subscription status.
- Fork 1.5k
Closed
Description
Example:
<?php if (true) : ?>
<? endif ?>
<?php if (true) { ?>
<? } ?>
<? if (false) : ?>
<? endif ?>
<?php if (false) { ?>
<?php } ?>CLI output (reduced for brevity):
$ phpcs -n --standard=PSR2 phpcs-test.php
1 | ERROR | [x] Inline control structures are not allowed
3 | ERROR | [x] Inline control structures are not allowed
$ phpcbf -n --standard=PSR2 phpcs-test.php
/home/me/phpcs-test.php FAILED TO FIX
Resulting "fixed" file:
<?php if (true) {
:;
} ?>
<? endif ?>
<?php if (true) { { { { { { { { { { { { { { { { { { { { { { { { { { { {;}}}}}}}}}}}}}}}}}}}}}}}}}} } ?>
<? } ?>
<? if (false) : ?>
<? endif ?>
<?php if (false) { ?>
<?php } ?>As can be seen in the false if's, using <?php or <? on both lines do not trigger the phpcs error. I'm not so sure what InlineControlStructure means in those cases (maybe the humanized message doesn't make much sense for those cases?), but we can say for sure that phpcbf got lost with the alt-syntax and nuts with the bracketed one 😂
That's for versions 3.3.2/3.4.2 at PHP 7.2.20.