Skip to content

wt-health/php-coding-standard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Coding Standards

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",
}