[php-src] PR #25933: Suggest elseif for else if in the alternative if syntax

From: Date: Mon, 30 Nov 2026 10:10:17 +0000
Subject: [php-src] PR #25933: Suggest elseif for else if in the alternative if syntax
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-41233@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25933 Author: LamentXU123 Writing else if in an if (...): ... endif; block currently produces unexpected token "if", expecting ":". ```php if ($first): runFirst(); else if ($second): runSecond(); endif; ``` ``` syntax error, unexpected token "if", expecting ":". ``` With this PR I hope it can be ``` syntax error, unexpected token "if", expecting ":". Use "elseif" in the alternative syntax instead of "else if". ``` I wrote the logic intentionally to make the hint being added during error reporting. The parser checks that the error occurred immediately after else. That is, there will be no performance decreasements in non-exception case. And in cases that needs to throw an exception performance doesn't matter.

« previous php.git-pulls (#41233) next »