2021-04-28 16:49:39 +02:00
In PHP 5.4, ``++break++`` and ``++continue++`` no longer accept arguments that require computation. Static arguments are still okay except for zero (``++0++``).
2021-04-28 18:08:03 +02:00
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
$i = 0;
$break = 1;
while (++$i) {
switch ($i) {
case 5:
// ...
break $break; // Noncompliant
case 10:
// ...
break $break + 1; // Noncompliant
default:
break $break; // Noncompliant
}
}
----
2021-04-28 18:08:03 +02:00
2021-04-28 16:49:39 +02:00
== Compliant Solution
----
$i = 0;
while (++$i) {
switch ($i) {
case 5:
// ...
break 1;
case 10:
// ...
break 2;
default:
break;
}
}
----
2021-04-28 18:08:03 +02:00
2021-06-02 20:44:38 +02:00
ifdef::rspecator-view[]
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::rspecator-view[]