WordPress / WordPress/WordPress-Coding-Standards

Handbook: when using aliases for imports, these should follow the naming conventions

Open
#2,306 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Core Focus: Modern PHP Type: Enhancement Upstream: PHPCSExtra
Dominant language
PHP
Stars
2.8k
Forks
521
Avg merge
5d 20h
Merged PRs (30d)
1

Description

Is your feature request related to a problem?

A sniff should be added to address the following handbook rule:

Aliases can be used to prevent name collisions (two classes in different namespaces using the same class name).
When using aliases, make sure the aliases follow the WordPress naming convention and are unique.

Ref: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#using-import-use-statements

Additional context (optional)

:Related issue in PHPCSExtra: https://github.com/PHPCSStandards/PHPCSExtra/issues/232

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the WordPress Coding Standards handbook section on import/use statements and review the related PHPCSExtra issue #232. Then inspect the repository's existing sniff and test conventions for import aliases. Done means a sniff enforces unique aliases that follow the WordPress naming convention, with coverage for the stated rule.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.