kaizen-agency/php-cs-rule-set

0.1.7 2024-08-22 09:01 UTC

This package is auto-updated.

Last update: 2024-11-16 08:42:21 UTC


README

Installation:

composer require --dev friendsofphp/php-cs-fixer kaizen-agency/php-cs-rule-set

Configuration:

In .php-cs-fixer.dist.php:

<?php

$finder = (new PhpCsFixer\Finder())
    ->in(__DIR__)
    ->exclude([
        'vendor',
        'tests',
        // Add more directories here if needed
    ]);

return (new PhpCsFixer\Config())
    ->setRules((new KaizenAgency\PhpCsRuleSet\Config\PhpRuleSet())->getRules())
    // ->setRules((new KaizenAgency\PhpCsRuleSet\Config\Php80RuleSet())->getRules()) // Uncomment to use PHP 8.0 rules
    ->setFinder($finder)
    // ->setIndent("  ") // Uncomment to use two spaces instead of four
    ->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect());

Usage:

vendor/bin/php-cs-fixer check # Run the linter
vendor/bin/php-cs-fixer fix # Fix the code

Available rules:

  • PhpRuleSet
  • Php70RuleSet
  • Php71RuleSet
  • Php72RuleSet
  • Php73RuleSet
  • Php74RuleSet
  • Php80RuleSet
  • Php81RuleSet
  • Php82RuleSet
  • Php83RuleSet
  • Php84RuleSet