- 🇫🇷France andypost
+1 and needs discuss a sniffer rule to maintain consistency
- 🇺🇸United States nicxvan
I think with three supporters we can RTBC this.
I updated the IS with the new language.
- 🇳🇿New Zealand quietone
Converting to the new template so we can track progress.
- 🇳🇿New Zealand quietone
I'd rather not add another sentence and I don't think we need to explain that PHP allows a semicolon.
Always use curly braces even in situations where they are technically optional. Having them increases readability and decreases the likelihood of logic errors being introduced when new lines are added. The opening curly should be on the same line as the opening statement, preceded by one space. The closing curly should be on a line by itself and indented to the same level as the opening statement.
For switch statements always use a colon after the
case
instruction. - 🇳🇿New Zealand quietone
Changing status to discuss proposed text in #15
- 🇺🇸United States theodorejb
I agree that it's not necessary to explain that PHP allows a semicolon. I would suggest using the proposed text in #13, or else don't change the text at all and just add an automated coding style rule to enforce the case syntax shown in the example.
- 🇺🇸United States nicxvan
I agree with your suggestion too. I think adding that line will just confuse people.
- 🇬🇧United Kingdom jonathan1055
The new text was actually in the wrong place in the suggestion. It should refer to the switch statement, not the if. I have updated the proposed text in the issue summary, also noting that there should be no space between the condition and the colon. This is already checked for by Coder.
- Status changed to RTBC
about 2 months ago 4:23am 18 February 2025 - 🇳🇿New Zealand quietone
Changing status so it will be reviewed by the committee.
- 🇧🇪Belgium borisson_ Mechelen, 🇧🇪
The change record looks good, as well as the proposed change to the text.
- 🇳🇿New Zealand quietone
This was discussed at the Coding Standards Meeting Tuesday 2025-02-26 0900 UTC 🌱 Coding Standards Meeting Tuesday 2025-02-26 0900 UTC Active and there were no objections.
- 🇮🇹Italy mondrake 🇮🇹
Looks like PHP is going to deprecate semicolons soon: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_semicolon_after_...
So a Drupal standard may become rather irrelevant.