Skip to content

Latest commit

 

History

History
51 lines (35 loc) · 1.81 KB

README.md

File metadata and controls

51 lines (35 loc) · 1.81 KB

Docker image for PHP_CodeSniffer

PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.

Example Usage

To check a file against the PEAR coding standard, simply specify the file's location.

docker container run --rm -it -v "$(pwd)":/mnt mgilbert/phpcs phpcs myfile.php

Or, if you wish to check an entire directory instead of a file.

docker container run --rm -it -v "$(pwd)":/mnt mgilbert/phpcs phpcs .

Printing a List of Installed Coding Standards

docker container run --rm -it -v "$(pwd)":/mnt mgilbert/phpcs phpcs -i

Check for violations of the PSR2 coding standard

docker container run --rm -it -v "$(pwd)":/mnt mgilbert/phpcs phpcs --standard=PSR2 myfile.php

Check for violations of the Squiz coding standard

docker container run --rm -it -v "$(pwd)":/mnt mgilbert/phpcs phpcs --standard=Squiz myfile.php

If you like, take a look into the container

docker container run --rm -it --entrypoint='bash' mgilbert/phpcs

Tools included in this image

  • PHP_CodeSniffer
  • GNU bash
  • GNU patch
  • PHP 7.2 (cli)

Documentation from the PHP_CodeSniffer Project

The documentation for PHP_CodeSniffer is available on the Github wiki.