prezly / code-style
Prezly Code style configurations
Installs: 106 310
Dependents: 2
Suggesters: 0
Security: 0
Stars: 4
Watchers: 5
Forks: 0
Open Issues: 1
Language:JavaScript
Requires
- php: >=7.1
- symplify/easy-coding-standard: ^11.1
This package is auto-updated.
Last update: 2024-11-12 11:07:33 UTC
README
PHP Code Style checker (and fixer) is built with Easy-Coding-Standard.
Usage
-
(Optional) Add prefixed ECS CLI tool into your composer requirements (if you're not a fan of resolving conflicts with enormous dependencies list of
simplify/easy-coding-standard
).composer require --dev symplify/easy-coding-standard-prefixed
-
Link prezly/code-style repo as composer dependency
composer require prezly/code-style:~4.0
-
Include the provided configuration into your project.
Simply create an ecs.php file in your project root and include the ecs.php provided by this package into it.
<?php // Include the stock prezly/code-style config as is. return require __DIR__ . '/vendor/prezly/code-style/ecs.php';
-
If you need to extend or override the stock configuration, you can of course do it by adding code on top of it:
<?php declare(strict_types=1); use PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $config): void { // Include the stock prezly/code-style config. (require __DIR__ . '/vendor/prezly/code-style/ecs.php')($config); $services = $config->services(); // Override stock preset configuration. $services->set(BinaryOperatorSpacesFixer::class)->call('configure', [ [ 'operators' => [ '=>' => 'align', ], ], ]); };
-
Run checks (you can also configure your CI to run this for you on every push):
vendor/bin/ecs check src/
-
Fix problems:
vendor/bin/ecs check src/ --fix