Checks and fixes PHPDoc comments.
The phpdoc command coordinates PHPDoc checking and fixing using:
- PHP-CS-Fixer - fixes PHPDoc formatting
- Rector with
AddMissingMethodPhpDocRector- adds missing method PHPDoc
It also creates the .docheader template from repository metadata when missing.
composer phpdoc
composer phpdoc [options]
composer dev-tools phpdoc -- [options]
vendor/bin/dev-tools phpdoc [options]path(optional)- Path to the file or directory to check. Default:
..
--fix, -f- Automatically fix PHPDoc issues. Without this option, runs in dry-run mode.
--cache-dir(optional)- Path to the cache directory for PHP-CS-Fixer. Default:
.dev-tools/cache/php-cs-fixer. --progress- Enable progress output from PHP-CS-Fixer and the Rector phase.
--json- Emit a structured machine-readable payload instead of the normal terminal output.
--pretty-json- Emit the same structured payload with indentation for terminal inspection.
Check PHPDocs (dry-run):
composer phpdocFix PHPDocs automatically:
composer phpdoc --fixCheck specific directory:
composer phpdoc ./src| Code | Meaning |
|---|---|
| 0 | Success. All PHPDocs valid or fixes applied. |
| 1 | Failure. PHPDoc issues found. |
- Creates
.docheaderfrom the packaged template when the file is missing. - Uses
.php-cs-fixer.dist.phpandrector.phpthrough local-first fallback. - The Rector phase explicitly runs
FastForward\DevTools\Rector\AddMissingMethodPhpDocRector. - Progress output is disabled by default; use
--progressto re-enable it in text mode. --jsonand--pretty-jsonforward JSON mode to PHP-CS-Fixer and Rector while disabling their progress rendering.- Uses
--dry-runmode unless--fixis specified.