WordPress / WordPress/WordPress-Coding-Standards
Review how docblock class imports are handled
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 2.8k
- Forks
- 521
- Avg merge
- 5d 20h
- Merged PRs (30d)
- 1
Description
I noticed that in the docblocks we are unsing FQCN when adding types to the parameters. We are also importing those at the top of the file.
In most of the editors, the editor is smart enough that it will know to what class/interface we are referring to.
So we should consider maybe shortening the FQCNs in the docblocks?
Example:
<?php
...
namespace WordPressCS\WordPress\Helpers;
use PHP_CodeSniffer\Files\File;
...
// Later in the class/trait/interface:
/**
* ...
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
Could be written as:
<?php
...
namespace WordPressCS\WordPress\Helpers;
use PHP_CodeSniffer\Files\File;
...
// Later in the class/trait/interface:
/**
* ...
* @param File $phpcsFile The file being scanned.
As the File is imported at the top of the file.
Thoughts?
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
Review the repository's PHP docblocks and their top-level imports, using the issue's PHP_CodeSniffer\Files\File example as the starting point. The work is done when the project has a decided convention for imported docblock types and the affected usages follow it consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- documentation, tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100