Based on https://medium.com/@yani/php-code-sniffer-with-docker-aa6cc88584d8
If you want to be able to run PHP Code Sniffer as if it was installed on your host locally, you can define the following function in your ~/.bashrc, ~/.zshrc or similar. Also do "source ~/.bashrc" or "source ~/.zshrc" or reload the terminal.
phpcs () {
docker run \
--rm \
-t \
-i \
--volume $(pwd)/:/app/:cached \
hkirsman/wunder-phpcs phpcs $@
}
To be able to automatically fix the errors create phpcbf function:
phpcbf () {
docker run \
--rm \
-t \
-i \
--volume $(pwd)/:/app/:cached \
hkirsman/wunder-phpcs phpcbf $@
}
Check current folder.
phpcs .
phpcbf .
phpcs --standard=PHPCompatibility --extensions=php,inc,module,install --runtime-set testVersion 7.1 -ps sites/all/
Content type
Image
Digest
Size
100.7 MB
Last updated
about 7 years ago
docker pull hkirsman/wunder-phpcs