33 lines
887 B
Plaintext
33 lines
887 B
Plaintext
# Check phpcs version
|
|
phpcs --version
|
|
|
|
# Check phpcbf version
|
|
phpcbf --version
|
|
|
|
phpcs --standard=PSR12 /path/to/your/test.php
|
|
phpcbf --standard=PSR12 /path/to/your/test.php
|
|
|
|
# Include this path in your settings.json if in case if codesniffer is downloaded locally in a specific project directory
|
|
executable path
|
|
"phpcs.executablePath": "~/.config/composer/vendor/bin/phpcs",
|
|
"phpcbf.executablePath": "~/.config/composer/vendor/bin/phpcbf",
|
|
|
|
|
|
# Install php_codesniffer globally
|
|
|
|
composer global require squizlabs/php_codesniffer
|
|
|
|
# To add the Composer global bin directory to your PATH
|
|
|
|
nano ~/.bashrc
|
|
|
|
# Add the following line to include the Composer global bin directory in your PATH:
|
|
|
|
export PATH="$PATH:$HOME/.composer/vendor/bin"
|
|
|
|
# or for Composer v2.x:
|
|
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
|
|
|
|
# Save the file and reload your shell configuration:
|
|
source ~/.bashrc
|