Page MenuHomePhabricator

Add a linter rule to ensure that `namespace` is the first statement in a file
ClosedPublic

Authored by joshuaspence on Nov 19 2015, 10:13 PM.
Tags
None
Referenced Files
F18830925: D14526.id.diff
Oct 25 2025, 9:41 AM
F18788468: D14526.id35138.diff
Oct 15 2025, 5:02 AM
F18788461: D14526.diff
Oct 15 2025, 5:01 AM
F18788460: D14526.id35262.diff
Oct 15 2025, 5:01 AM
F18787208: D14526.id35261.diff
Oct 14 2025, 10:35 PM
F18784780: D14526.id35261.diff
Oct 13 2025, 3:09 PM
F18712854: D14526.id.diff
Sep 29 2025, 5:33 AM
F18674198: D14526.diff
Sep 25 2025, 1:36 PM
Subscribers

Details

Summary

If a namespace is used within a PHP script, it must be the first statement.

Test Plan

Added unit tests.

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 ensure that `namespace` is the first statement in a file.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.
epriestley edited edge metadata.
<?php

1;

namespace X {
  class C { }
  echo 2;
}

Look at me, I'm PHP!

This revision is now accepted and ready to land.Nov 19 2015, 10:18 PM
joshuaspence edited edge metadata.

Add a test case for an edge case

This revision was automatically updated to reflect the committed changes.