webtoolshealth/php-coding-standard

PHP Coding standards ruleset

1.0.0 2021-06-10 02:46 UTC

This package is auto-updated.

Last update: 2024-04-29 04:47:20 UTC


README

This project contains a reusable rule-set for the symplify/easy-coding-standard package.

Example Configuration

 composer require webtoolshealth/php-coding-standard

Create a new file called ecs.php in the root of your project

<?php

declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Webtoolshealth\CodingStandard\Set;

return static function (ContainerConfigurator $container): void {
    $parameters = $container->parameters();

    $parameters->set(Option::PATHS, [
        __DIR__ . '/app',
        __DIR__ . '/config',
        __DIR__ . '/database',
        __DIR__ . '/routes',
        __DIR__ . '/tests',
    ]);

    $parameters->set(Option::PARALLEL, true);
    
    $container->import(Set::WEBTOOLS_CODING_STANDARD);
};

You can add the following scripts to your projects composer.json

"scripts": {
  "ecs": "vendor/bin/ecs check",
  "ecs-fix": "vendor/bin/ecs check --fix",
}