Replace control structure alternative syntax to use braces.
--- Original
+++ New
<?php
-if(true):echo 't';else:echo 'f';endif;
+if(true) { echo 't';} else { echo 'f';}
--- Original
+++ New
<?php
-while(true):echo 'red';endwhile;
+while(true) { echo 'red';}
--- Original
+++ New
<?php
-for(;;):echo 'xc';endfor;
+for(;;) { echo 'xc';}
--- Original
+++ New
<?php
-foreach(array('a') as $item):echo 'xc';endforeach;
+foreach(array('a') as $item) { echo 'xc';}
The rule is part of the following rule sets:
- @PhpCsFixer
- Using the @PhpCsFixer rule set will enable the
no_alternative_syntax
rule. - @Symfony
- Using the @Symfony rule set will enable the
no_alternative_syntax
rule.