Sign inSign up

hkirsman/wunder-phpcs

By hkirsman

•Updated about 7 years ago

Image
0

1.5K

hkirsman/wunder-phpcs repository overview

⁠Local runtime/binary

Based on https://medium.com/@yani/php-code-sniffer-with-docker-aa6cc88584d8⁠

⁠Add to .bashrc/.zshrc (Linux & Mac)

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 $@
}

⁠Example usage for coding standards

Check current folder.

phpcs .
phpcbf .

⁠Example usage for PHP Compatibility

phpcs --standard=PHPCompatibility --extensions=php,inc,module,install --runtime-set testVersion 7.1 -ps sites/all/

Tag summary

Content type

Image

Digest

Size

100.7 MB

Last updated

about 7 years ago

docker pull hkirsman/wunder-phpcs