com php-langspec: Continue on switch emits warning: spec/11-statements.md tests/statements/jump/continue.phpt

From: Date: Mon, 10 Sep 2018 11:54:16 +0000
Subject: com php-langspec: Continue on switch emits warning: spec/11-statements.md tests/statements/jump/continue.phpt
Groups: php.standards.cvs 
Request: Send a blank email to standards--cvs+get-416@lists.php.net to get a copy of this message
Commit: b5ca441040e2c6f8c38d3b7373f7c720af4b8f8c Author: Nikita Popov <nikita.ppv@gmail.com> Mon, 10 Sep 2018 13:54:16 +0200 Parents: ea03278e7e3d48061ef6744570b8f36b7a20d02c Branches: master Link: http://git.php.net/?p=php-langspec.git;a=commitdiff;h=b5ca441040e2c6f8c38d3b7373f7c720af4b8f8c Log: Continue on switch emits warning Changed paths: M spec/11-statements.md M tests/statements/jump/continue.phpt Diff: diff --git a/spec/11-statements.md b/spec/11-statements.md index a8dfc9e..062a64e 100644 --- a/spec/11-statements.md +++ b/spec/11-statements.md @@ -860,9 +860,11 @@ number 1 and containing statements having levels increasing by 1. A continue statement terminates the execution of one or more enclosing [iteration](#iteration-statements) or [switch](#the-switch-statement) statements, up to the specified level. If the statement at the *breakout-level* is an iteration statement, -the next iteration (if any) of the next innermost enclosing iteration or switch statement is started. +the next iteration (if any) of the iteration statement is started. If that statement is a for statement and it has a *for-end-of-loop*, its -end-of-loop expression group for the current iteration is evaluated first. If +end-of-loop expression group for the current iteration is evaluated first. If it +is a switch statement, a warning is emitted and the behavior is the same as a +[break statement](#the-break-statement) at the same *breakout-level*. If *breakout-level* is omitted, a level of 1 is assumed. A continue statement may break out of a construct that is fully diff --git a/tests/statements/jump/continue.phpt b/tests/statements/jump/continue.phpt index 3efcd99..040b06e 100644 --- a/tests/statements/jump/continue.phpt +++ b/tests/statements/jump/continue.phpt @@ -85,7 +85,8 @@ for ($i = 10; $i <= 40; $i +=10) echo "\nJust beyond the switch"; } echo "\n----------\n"; ---EXPECT-- +--EXPECTF-- +Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in %s on line %d 1 is odd 3 is odd 5 is odd

« previous php.standards.cvs (#416) next »