Skip to content

PSR2.Namespaces.UseDeclaration.SpaceAfterUse should also check for space after use const/use function #2960

Closed as not planned

Description

@umherirrender

If you have the following code:

use\Import\SomeClass;
use const\Import\SomeConst;
use function\Import\SomeFunction;

there is no hint to add a space after const or function.

Good: When using multiple spaces between use and const, it is detected.

Activity

  1. rodrigoprimo commented on Mar 4, 2026

    @rodrigoprimo

    Because of the reasons detailed in #2961 (comment), I believe this issue should be closed. const\Import\SomeConst and function\Import\SomeFunction are seen by PHP and PHPCS as a single T_NAME_QUALIFIED token, so there is no easy way for PHPCS to trigger PSR2.Namespaces.UseDeclaration when it finds the code above. Not to mention that the code above is valid, and adding the space would change its behavior.

  2. jrfnl commented on Mar 4, 2026

    @jrfnl
    Contributor

    Not to mention that the code above is valid

    * since PHP 8.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions