Skip to content
PHP Coding Standards for PrestaShop projects
Branch: master
Clone or download
Quetzacoalt91 Merge pull request #7 from Quetzacoalt91/symlink-phpstan-autoload
Add autoload when phpstan is hidden behind symlink
Latest commit 0a2c240 Jun 3, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Fix autoload file May 13, 2019
src Improve PHPStan installation May 21, 2019
templates Add autoload when phpstan is hidden behind symlink May 31, 2019
.gitignore Integrate php cs fixer Apr 30, 2019
.php_cs.dist Add prettyci.composer.json file to download dependencies before runni… May 13, 2019
LICENSE Initial commit Apr 30, 2019

PrestaShop Coding Standards

This repository provides a configuration for friendsofphp/php-cs-fixer, phpstan/phpstan and includes tools to check that repositories are following the standards defined by the PrestaShop community.


composer require --dev prestashop/php-coding-standards:dev-master

When this project is successfully added to your dependencies, you can enable each review tool on your projet.

PHP Cs fixer

$ php vendor/bin/prestashop-coding-standards cs-fixer:init [--dest /path/to/my/project]

It'll create a configuration file .php_cs.dist in the root of your project.


$ php vendor/bin/prestashop-coding-standards phpstan:init [--dest /path/to/my/project]

It'll create a bootstrap.php and a phpstan.neon files, by default in tests/phpstan, that are required to run phpstan. The default phpstan level is the lowest available, but we recommend you to update this value to get more recommandations.

PHPStan is not provided by our dependencies, because of the PHP compatibility from projects using this repository. We recommend you to install it globally on your environment:

composer global require phpstan/phpstan-shim


The configuration files added in your project can be freely modified in order to match your needs.

Running the tools can be done by calling its binary:

PHP CS Fixer

php vendor/bin/php-cs-fixer fix


If you have installed PHPStan globally and made the folder available in your PATH:

$ _PS_ROOT_DIR_=<Path_to_PrestaShop> phpstan --configuration=tests/phpstan/phpstan.neon analyse <path1 [path2 [...]]>

Otherwise, you can specify the path to the PHPStan binary. For instance:

$ _PS_ROOT_DIR_=<Path_to_PrestaShop> php ~/.composer/vendor/bin/phpstan.phar --configuration=tests/phpstan/phpstan.neon analyse <path1 [path2 [...]]>
You can’t perform that action at this time.