]> khamidou — GitHub mirrors - arcanist.git/commit
Add a linter rule to detect variable arguments for `break` and `continue`
authorJoshua Spence <josh@joshuaspence.com>
Thu, 25 Sep 2014 22:36:29 +0000 (08:36 +1000)
committerJoshua Spence <josh@joshuaspence.com>
Thu, 25 Sep 2014 22:40:30 +0000 (08:40 +1000)
commit8ed1459ecdbaea387de65874e618ed4811fbf690
tree9cefe66358a04be50079d7d21b635cbbefbee61a
parent247a4fabb8b6f0751f246665f7779909ba6310f6
Add a linter rule to detect variable arguments for `break` and `continue`

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.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10567
src/lint/linter/ArcanistXHPASTLinter.php
src/lint/linter/__tests__/xhpast/php53-features.lint-test [moved from src/lint/linter/__tests__/xhpast/php53.lint-test with 100% similarity]
src/lint/linter/__tests__/xhpast/php54-features.lint-test [moved from src/lint/linter/__tests__/xhpast/php54.lint-test with 100% similarity]
src/lint/linter/__tests__/xhpast/php54-incompat.lint-test [new file with mode: 0644]