Page MenuHomePhabricator

Add a linter rule to detect variable arguments for `break` and `continue`
ClosedPublic

Authored by joshuaspence on Sep 25 2014, 9:47 PM.
Tags
None
Referenced Files
F18867442: D10567.id25390.diff
Tue, Nov 4, 12:25 AM
F18809555: D10567.id.diff
Sun, Oct 19, 3:04 PM
F18783145: D10567.diff
Mon, Oct 13, 4:10 AM
F18623877: D10567.diff
Sep 15 2025, 5:56 PM
F18208696: D10567.id25385.diff
Aug 18 2025, 9:39 PM
F18208694: D10567.id25390.diff
Aug 18 2025, 9:39 PM
F18104172: D10567.diff
Aug 10 2025, 10:21 AM
Unknown Object (File)
Jun 4 2025, 8:31 AM
Subscribers

Details

Summary

In PHP 5.4, the break and continue statements no longer accept variable arguments (e.g., break 1 + foo() * $bar;). Static arguments still work, such as break 2;. As a side effect of this change break 0; and continue 0; are no longer allowed.

Test Plan

Added some test cases.

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

joshuaspence retitled this revision from to Add a linter rule to detect variable arguments for `break` and `continue`.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.
epriestley edited edge metadata.
This revision is now accepted and ready to land.Sep 25 2014, 9:50 PM
joshuaspence edited edge metadata.

Add test cases for continue

This revision was automatically updated to reflect the committed changes.