4.2.15. Remove Brackets Around Single Instruction¶
This cobbler removes brackets when they are not compulsory. This applies to single instruction, on for(), foreach(), while(), do…while() structures.
This also means that any refactoring that grows the instruction again to multiple instructions has to add the brackets again.
There is no gain in speed or code lenght by removing those brackets.
4.2.15.1. Before¶
<?php
foreach($i = 0; $i < 10; ++$i) { $total += 1; }
?>
4.2.15.2. After¶
<?php
foreach($i = 0; $i < 10; ++$i) $total += 1;
?>
4.2.15.3. Reverse Cobbler¶
4.2.15.4. Specs¶
Short Name |
Structures/RemoveBracketsAroundSingleInstruction |
Exakat version |
2.3.0 |
Available in |