note 121588 deleted from control-structures.alternative-syntax by salathe

From: Date: Mon, 21 Sep 2020 14:36:03 +0000
Subject: note 121588 deleted from control-structures.alternative-syntax by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-215216@lists.php.net to get a copy of this message
Note Submitter: jcmarchi at gmail dot com ---- After a long and useless discussion at https://bugs.php.net/bug.php?id=75138, while trying to place a bug report for this problem, I came to a sad conclusion that PHP developers nowadays rather live with the code syntax problem instead of fixing it, then blame issues to the developers' code style. Well... I can accept it as not being a "BUG", as far as a "NEW SYNTAX requirement" is explicitly defined for it (rules are rules). I'd suggest a modification in the language manual in regards to semicolon usage definition: ==================== When using "alternative syntax for control structures" observe the fact that when an "IF" statement is required to be nested into another IF-ELSEIF-ELSE block and it casually ends up being the last statement of the nested block, it is a LANGUAGE REQUIREMENT to terminate it with double semicolon (;;) to prevent the "dangling else" effect. ==================== Or, better, we can add it to the same (miss)interpretation concept that aread exist in this very same page, keeping documentation standards intact: ==================== Note: Mixing syntaxes in the same control block is not supported. Note: A nested "if" statement immediately before an "else:" or "elseif: " statement in control block is not supported. ==================== Oh, that solves all problems, sure!!!! Or, even better! Let's simply ignore it all and leave it as it is. What harm can an extra ";" after another ";" do anyway, right? It is always developers' fault anyway... Poor bastards that don't know how to code! I can't believe anyone will have an IF statement as the last nested statement inside another IF... Can you imagine it? :P

« previous php.notes (#215216) next »