phpcbf
PHP Code Beautifier and Fixer
TLDR
SYNOPSIS
phpcbf [options] [files...]
DESCRIPTION
phpcbf (PHP Code Beautifier and Fixer) automatically corrects coding standard violations detected by phpcs. It is the companion fixer tool in the PHP_CodeSniffer package.The tool modifies files in-place by default, applying fixes for violations that have an automatic fixer defined. Not all phpcs violations are auto-fixable; phpcbf will only fix those with corresponding fixer implementations. Use --suffix to write fixed copies instead of overwriting originals, or --diff to generate a patch without modifying files.
PARAMETERS
FILES
Files or directories to fix.--standard=NAME
Coding standard to use (e.g., PSR1, PSR2, PSR12, Squiz, PEAR).--sniffs=LIST
Comma-separated list of specific sniffs to apply.--exclude=LIST
Comma-separated list of sniffs to exclude.--extensions=LIST
Comma-separated file extensions to fix (default: php,inc). Can include type: module/php,es/js.--suffix=SUFFIX
Write fixed files with this suffix instead of overwriting originals.--no-patch
Use PHP for file replacement instead of diff/patch commands.--diff
Generate a diff of changes instead of applying them.-p
Show progress during fixing.--help
Display help information.
CAVEATS
Part of PHP_CodeSniffer. Not all coding standard violations are automatically fixable. Always review changes after fixing, especially on first use with a codebase.
HISTORY
PHPCBF is part of PHP_CodeSniffer, originally by Greg Sherwood (Squiz Labs), now maintained by PHPCSStandards.
SEE ALSO
phpcs(1), php-cs-fixer(1)
