Skip to content

New sniff: warn on use of PHP as top-level namespace #1025

@jrfnl

Description

@jrfnl

Original mentioned in: #1024 (comment)

The PHP top level namespace is reserved for PHP itself.

I've been wondering whether we should add a sniff for it and am leaning towards "yes" as, even though it is currently not used in PHP itself, there has been discussion about starting to use it.

This is on par with the warning about double underscore prefixed function names, as that is also reserved for PHP itself.

Code samples:

// Ok.
namespace MyPHPApp;
namespace My\PHP\App;

// Warning.
namespace PHP;
namespace PHP\App;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions