WordPress / WordPress/WordPress-Coding-Standards

Traits and interfaces file name standard

Open
#1,859 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Focus: Modern PHP Status: Needs Make post Type: Enhancement
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?

Although we have a standard for class file names, we don't have one for traits or interfaces.

Describe the solution you'd like

For consistency with what we currently require for classes, a trait file name should be prefixed with trait- and an interface file name should be prefixed with interface-.

I'm not a big fan of these prefixes but as we enforce them to classes, it seems to make sense have them for traits and interfaces too.


Issue #1327 mentions the problem but it's almost 2 years old now. As these elements can already be used in core, it would be awesome if these standards are defined before it happens :)

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 by reviewing the existing class file-name standard and the related discussion in issue #1327. Define how trait and interface file names should be checked consistently with class names, then verify that the ruleset enforces the trait- and interface- prefixes.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.