WordPress / WordPress/WordPress-Coding-Standards

Idea: Suggest specifying namespace for @param and @return types

Open
#1,832 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Docs
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?

There are a number of classes, constants and the like that have a performance benefit from specifying the global namespace. It seems like for documentation, this may also help an IDE know which class to use for auto-complete.

Describe the solution you'd like

Parser sees: @param WP_Query
Parser suggests: @param \WP_Query

It seems like this may also make sense to apply this to code also, especially when there's no matching use.

Additional context (optional)

If this idea doesn't make sense, I'm okay with that. 👍

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

The issue names no files, sniffs, tests, or entry points. Start by reviewing the repository’s existing PHP_CodeSniffer sniffs and their tests to determine where PHPDoc type resolution is handled. Done would require an agreed scope for suggesting global namespaces, including whether the behavior applies only to documentation or to code, plus tests covering the decision.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.