Extend semicolon rule to multiline expressions#30
Extend semicolon rule to multiline expressions#30ashamrov wants to merge 1 commit intopaysera:masterfrom
Conversation
7048951 to
cd24437
Compare
If this is true, shouldn't <?php
// single line – no special rule
$isValid = $a && $b || $c;
// multiline – semicolon on its own line
$isValid = $conditionA
&& $conditionB
&& $conditionC
;be something like <?php
// single line – no special rule
$isValid = $a && $b || $c;
// multiline – semicolon on its own line
$isValid =
$conditionA
&& $conditionB
&& $conditionC
; |
Why? I think we should apply this rule only where it provides a clear, practical benefit. The main value of moving the semicolon to a separate line is reducing diff noise when code is extended incrementally (e.g., chained calls or long logical expressions). If putting the semicolon on a separate line does not improve diff stability or maintainability, then it doesn’t really justify the added visual inconsistency. So for me the rule is:
This keeps the style intentional rather than mechanically consistent. |
Breaking after = does not provide the same benefit as breaking chained calls. It doesn’t meaningfully reduce diff noise, but it does make the code harder to scan. |
Extend semicolon rule to multiline expressions
Summary
Extends the semicolon-on-its-own-line rule from chained method calls to all multiline expressions (ternary, comparison, logical). Introduces RFC 2119 requirement level keywords throughout the style guide.
Changes
RFC 2119 keywords
Semicolon placement rule (extended)
returnon its own line with the condition indented below)getPrice()example in the Money/Doctrine section to match the new ternary styleCross-references
Test plan