/docker-phpcbf

Docker image for PHP_CodeSniffer's phpcbf.

MIT LicenseMIT

Supported tags and respective Dockerfile links

What is PHP_CodeSniffer and phpcbf?

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.

https://github.com/squizlabs/PHP_CodeSniffer

How to use this image

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

Volumes

  • /project: Your PHP project directory.