Page MenuHomePhabricator

Change ArcanistElseIfUsageXHPASTLinterRule to be PSR-2 compliant
Needs ReviewPublic

Authored by joshuaspence on Jul 1 2015, 12:12 PM.
Tags
None
Referenced Files
F18946269: D13512.id.diff
Tue, Nov 11, 7:51 PM
F18870424: D13512.id33650.diff
Tue, Nov 4, 5:23 PM
F18820058: D13512.id.diff
Oct 22 2025, 12:20 PM
F18819663: D13512.id.diff
Oct 22 2025, 8:14 AM
F18814869: D13512.diff
Oct 21 2025, 12:02 AM
F18746597: D13512.diff
Oct 3 2025, 12:54 PM
F18601748: D13512.id.diff
Sep 13 2025, 1:22 PM
F18601664: D13512.id32671.diff
Sep 13 2025, 1:08 PM
Subscribers

Details

Reviewers
epriestley
Group Reviewers
Blessed Reviewers
Maniphest Tasks
T8742: Write a bunch of PSR-2 lint rules
Summary

Ref T8742. We are adopting PSR-2 at my work, which means that we need to be using elseif instead of else if. The rationale behind this is so that all control keywords look like single words. I was considering adding a boolean xhpast.elseif.single-token configuration option, but I'm not sure how value this would be?

Test Plan

Updated unit tests.

Diff Detail

Repository
rARC Arcanist
Branch
xhpast-lint2
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 7689
Build 8415: [Placeholder Plan] Wait for 30 Seconds
Build 8414: arc lint + arc unit

Event Timeline

joshuaspence retitled this revision from to Change ArcanistElseIfUsageXHPASTLinterRule to be PSR-2 compliant.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.

I want to stick with else if in this codebase (rationale roughly being that the grammar is better with fewer tokens, and if we could remove all the "elseif" / "endif" / "endwhile" cruft from the grammar we would; and that the other C-like languages we use -- Javascript and C -- do not support this construct, so using "else if" is more consistent across languages). Probably adding a module and then configuring this one as disabled in your codebase is the cleanest way forward?

I'm OK with bringing the alternate module upstream. I'm also OK with having a "psr-2" mode if it requires a nontrivial number of adjustments.

joshuaspence edited edge metadata.

Allow the linter rule to be configurable such that either elseif or else if can be preferred.