doc/rules/control_structure/no_alternative_syntax.rst
no_alternative_syntaxReplace control structure alternative syntax to use braces.
This rule is CONFIGURABLE
You can configure this rule using the following option:
``fix_non_monolithic_code``.
Configuration
-------------
``fix_non_monolithic_code``
Whether to also fix code with inline HTML.
Allowed types: bool
Default value: true
Default value (future-mode): false
Example #1
*Default* configuration.
.. code-block:: diff
--- Original
+++ New
<?php
-if(true):echo 't';else:echo 'f';endif;
+if(true) { echo 't';} else { echo 'f';}
Example #2
With configuration: ['fix_non_monolithic_code' => true].
.. code-block:: diff
--- Original +++ New -<?php if ($condition): ?> +<?php if ($condition) { ?> Lorem ipsum. -<?php endif; ?> +<?php } ?>
The rule is part of the following rule sets:
@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>_@Symfony <./../../ruleSets/Symfony.rst>_PhpCsFixer\\Fixer\\ControlStructure\\NoAlternativeSyntaxFixer <./../../../src/Fixer/ControlStructure/NoAlternativeSyntaxFixer.php>_PhpCsFixer\\Tests\\Fixer\\ControlStructure\\NoAlternativeSyntaxFixerTest <./../../../tests/Fixer/ControlStructure/NoAlternativeSyntaxFixerTest.php>_The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.