-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DisallowUseClass/Function/Const: make the error codes more modular.
This adds four new error codes to each of the sniffs: - `FoundSameNamespace`, `FoundSameNamespaceWithAlias` for `use` statements importing from the same namespace; - `FoundGlobalNamespace`, `FoundGlobalNamespaceWithAlias` for `use` statements importing from the global namespace, like import statements for PHP native classes, functions and constants. In all other circumstances, the existing error codes `FoundWithAlias` and `FoundWithoutAlias` will continue to be used. This commit also contains three bug fixes applied to each of these sniffs: * In PHP, both namespace names, as well as aliases, are case-insensitive, so any comparison of them should be done in a case-insensitive manner. * An import from the global namespace would previously always be seen as non-aliased, even when it was aliased. * Tolerance for `use` import statements with leading backslashes. Includes: * Additional metrics about the import source: different namespace / same namespace / global namespace. * Additional unit tests.
- Loading branch information
Showing
18 changed files
with
957 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.