whatwedo / php-coding-standard
Default PHP coding standard at whatwedo
Installs: 25 731
Dependents: 12
Suggesters: 0
Security: 0
Stars: 2
Watchers: 10
Forks: 1
Open Issues: 13
Requires
- php: >=7.4
- kubawerlos/php-cs-fixer-custom-fixers: ^3.0
- slevomat/coding-standard: ^8.5
- symplify/easy-coding-standard: ^12.1
- dev-master
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.1
- v1.1.0
- v1.0.0
- v0.2.0
- v0.1.1
- v0.1.0
- dev-feature/php-cs-fixer-config
- dev-feature/ecs-per-cs2
- dev-release/v2.0.0
- dev-feature/31-phpcsfixer-config
- dev-develop
- dev-feature/28-phpcs-fixer
- dev-fix/namespace
- dev-feature/24-remove-NoImportFromGlobalNamespaceFixer
- dev-feature/14-move-dump-fixer
- dev-feature/21-provide-sample-config
- dev-feature/add-PER-CS2.0-rule-set
- dev-feature/ecs-12-update
- dev-feature/version-update
This package is auto-updated.
Last update: 2024-12-19 05:20:56 UTC
README
PhpCodingStandard
This project is a set of coding standard rules, which we are using at whatwedo. It's heavily based on Simplify/EasyCodingStandard.
Installation
We suggest to use Composer to install this project:
composer require whatwedo/php-coding-standard
Usage
Without custom configuration
You can run the checks without project specific configuration using one of following commands:
vendor/bin/ecs check SRC_DIRECTORY --config vendor/whatwedo/php-coding-standard/config/whatwedo-symfony.php # Symfony projects
vendor/bin/ecs check SRC_DIRECTORY --config vendor/whatwedo/php-coding-standard/config/whatwedo-wordpress.php # WordPress projects
vendor/bin/ecs check SRC_DIRECTORY --config vendor/whatwedo/php-coding-standard/config/whatwedo-common.php # Common PHP projects
With custom configuration
If you want to add additional checkers or exclude files, you have to create an ecs.php
file in your own project root directory.
<?php declare(strict_types=1); use Symplify\EasyCodingStandard\Config\ECSConfig; return static function (ECSConfig $ecsConfig): void { /* // Remove rules with $ecsConfig->skip() $ecsConfig->skip([ SlevomatCodingStandard\Sniffs\Variables\UnusedVariableSniff::class => null, // Explicitly remove some rules in a specific files PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer::class => [ __DIR__ . '/PATH/FILE.php' ], ]); */ // This need to come last $ecsConfig->sets([__DIR__ . '/vendor/whatwedo/php-coding-standard/config/whatwedo-common.php']); };
Then run the following command:
vendor/bin/ecs check SRC_DIRECTORY
To fix certain issues automatically add --fix
add the end
For other configuration options, check out Simplify/EasyCodingStandard.
Dependencies
- PHP >=7.4
- Simplify/EasyCodingStandard
- kubawerlos/php-cs-fixer-custom-fixers
- slevomat/coding-standard
License
This bundle is under the MIT license. See the complete license in the bundle: LICENSE