Home GnuPG

Add a linter rule for `use` statement namespace prefixes
ae210fda9f4bUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

Add a linter rule for use statement namespace prefixes

Summary:
When importing or aliases a symbol with a use statement, the leading namespace separator is optional and does not modify the behavior. That is, use \X is equivalent to use X. As such, the latter syntax should be preferred because it is more concise.

According to the PHP documentation:

Note that for namespaced names (fully qualified namespace names containing namespace separator, such as Foo\Bar as opposed to global names that do not, such as FooBar), the leading backslash is unnecessary and not recommended, as import names must be fully qualified, and are not processed relative to the current namespace.

Test Plan: Added test cases.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D14517

Details

Provenance
Joshua Spence <josh@freelancer.com>Authored on Nov 23 2015, 8:42 PM
Parents
rARCc71fe67ccbbe: Address feedback from D14530
Branches
Unknown
Tags
Unknown

Event Timeline

Joshua Spence <josh@freelancer.com> committed rARCae210fda9f4b: Add a linter rule for `use` statement namespace prefixes (authored by Joshua Spence <josh@freelancer.com>).Nov 23 2015, 8:42 PM