Page MenuHomePhabricator

Let `ArcanistNamespaceFirstStatementXHPASTLinterRule` support `declare` statements
Needs ReviewPublic

Authored by wjiang on Aug 6 2017, 12:52 PM.
Tags
None
Referenced Files
F18733709: D18351.id.diff
Tue, Sep 30, 10:40 PM
F18637711: D18351.diff
Wed, Sep 17, 8:19 AM
F18612374: D18351.id44107.diff
Sun, Sep 14, 9:01 AM
F18465494: D18351.diff
Sep 2 2025, 7:17 AM
F18228899: D18351.id.diff
Aug 20 2025, 8:48 AM
F18217340: D18351.diff
Aug 19 2025, 8:48 AM
F18110297: D18351.diff
Aug 11 2025, 6:12 PM
F18094856: D18351.diff
Aug 7 2025, 10:23 PM

Details

Reviewers
joshuaspence
Group Reviewers
Blessed Reviewers
Summary

declare statements should be put before the namespace statement. See Defining namespaces.
This improvement will be especially useful on PHP7 code where the use of declare(strict_types=1) is common.

Test Plan

Unit test

Diff Detail

Repository
rARC Arcanist
Branch
declare
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 17924
Build 24074: arc lint + arc unit

Event Timeline

Maybe the name of ArcanistNamespaceFirstStatementXHPASTLinterRule is not quite proper now ? Perhaps ArcanistNamespaceStatementPositionXHPASTLinterRule could be replacement.

wjiang retitled this revision from Let `ArcanistNamespaceFirstStatementXHPASTLinterRule` support `declare` statemnts to Let `ArcanistNamespaceFirstStatementXHPASTLinterRule` support `declare` statements.Aug 6 2017, 12:56 PM
joshuaspence added inline comments.
src/lint/linter/xhpast/rules/ArcanistNamespaceFirstStatementXHPASTLinterRule.php
9

Given that the documentation lists this an an exception, I think it's fine to leave the name as-is.