PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.
PHP_CodeSniffer's phpcbf
is a script to automatically correct coding standard violations.
Basic usage using current user id (uid).
docker run --rm \
--user $(id -u):$(id -g) \
--volume $(pwd):/project \
herloct/phpcbf [<options>]
For example, to fix src
directory to follow PSR1 and PSR2 standard.
docker run --rm \
--user $(id -u):$(id -g) \
--volume $(pwd):/project \
herloct/phpcbf --no-patch --standard=PSR1,PSR2 src
- /project: Your PHP project directory.