WordPress / WordPress/WordPress-Coding-Standards
Idea: Suggest specifying namespace for @param and @return types
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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