Page MenuHomePhabricator

Let `ArcanistNamespaceFirstStatementXHPASTLinterRule` support `declare` statements
Needs ReviewPublic

Authored by wjiang on Aug 6 2017, 12:52 PM.
Tags
None
Referenced Files
F15417247: D18351.id44107.diff
Thu, Mar 20, 4:16 PM
F15405063: D18351.id.diff
Tue, Mar 18, 10:10 AM
F15400171: D18351.diff
Mon, Mar 17, 10:06 AM
F15397066: D18351.diff
Sun, Mar 16, 5:54 PM
F15375885: D18351.diff
Thu, Mar 13, 12:31 AM
Unknown Object (File)
Sun, Mar 2, 2:16 PM
Unknown Object (File)
Feb 4 2025, 7:04 PM
Unknown Object (File)
Jan 27 2025, 3:35 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.