Replace control structure alternative syntax to use braces.
Whether to also fix code with inline HTML.
Allowed types: bool
Default value: true
Default configuration.
--- Original
+++ New
<?php
-if(true):echo 't';else:echo 'f';endif;
+if(true) { echo 't';} else { echo 'f';}
With configuration: ['fix_non_monolithic_code' => true]
.
--- Original
+++ New
-<?php if ($condition): ?>
+<?php if ($condition) { ?>
Lorem ipsum.
-<?php endif; ?>
+<?php } ?>
The rule is part of the following rule sets:
- @PhpCsFixer
- Using the @PhpCsFixer rule set will enable the
no_alternative_syntax
rule with the default config. - @Symfony
- Using the @Symfony rule set will enable the
no_alternative_syntax
rule with the default config.