Skip to content

bigboss86/PHP-Code-Quality-Tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Code Quality Tools

PHPCodeSniffer

Installation

$ composer require --dev "squizlabs/php_codesniffer"

Now you can run vendor/bin/phpcs to check the code.

Many errors can be fixed with the next command: vendor/bin/phpcbf

More details

Integrate with PHPStorm

The above command configures the PHPStorm inspector automatically, but you can do it manually:

  1. Configure path in File->Settings->Languages->Frameworks->PHP->Quality Tools
  2. Enable it in File->Settings->Editor->Inspections

More details

PHPMessDetector

Installation

$ composer require --dev "phpmd/phpmd"

Now you can run vendor/bin/phpmd src/ ansi ruleset.xml to check the code.

More details

Integrate with PHPStorm

The above command configures the PHPStorm inspector automatically, but you can do it manually:

  1. Configure path in File->Settings->Languages->Frameworks->PHP->Quality Tools
  2. Enable it in File->Settings->Editor->Inspections

More details

PHPStan

Installation

More details

$ composer require --dev "phpstan/phpstan"
$ composer require --dev "phpstan/phpstan-doctrine"
$ composer require --dev "phpstan/phpstan-webmozart-assert"

Now you can run vendor/bin/phpstan analyse -c phpstan.neon -l max src/ to check the code.

Integrate with PHPStorm

The above command configures the PHPStorm inspector automatically, but you can do it manually:

  1. Configure path in File->Settings->Languages->Frameworks->PHP->Quality Tools
  2. Enable it in File->Settings->Editor->Inspections

Configuration Files

Include the configuration files in the root directory of your project:

PHPCodeSniffer: phpcs.xml

PHPMessDetector: ruleset.xml

PHPStan: phpstan.neon

Git Validation

Include the pre-commit file into .git/hooks in your project.

TODO

TwigCS

JSCS

CSFIXER

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages