123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- ==============================
- Rule ``no_alternative_syntax``
- ==============================
- Replace control structure alternative syntax to use braces.
- Configuration
- -------------
- ``fix_non_monolithic_code``
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Whether to also fix code with inline HTML.
- Allowed types: ``bool``
- Default value: ``true``
- Examples
- --------
- 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 } ?>
- Rule sets
- ---------
- The rule is part of the following rule sets:
- - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
- - `@Symfony <./../../ruleSets/Symfony.rst>`_
|