<?php
use PedroTroller\CS\Fixer\Fixers;
use PedroTroller\CS\Fixer\RuleSetFactory;
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules(RuleSetFactory::create()
->symfony() // Activate the @Symfony ruleset
->phpCsFixer() // Activate the @PhpCsFixer ruleset
->php(8.2, true) // Activate php 8.2 risky rules
->pedrotroller(true) // Activate my own ruleset (with risky rules)
->enable('ordered_imports') // Add an other rule
->disable('yoda_style') // Disable a rule
->getRules()
)
->registerCustomFixers(new Fixers())
->setFinder(
PhpCsFixer\Finder::create()->in(__DIR__)
)
;
Activate the @PER
(@PER-CS1.0
, @PER-CS1.0:risky
, @PER-CS2.0
, @PER-CS2.0:risky
, ...) rule.
Activate the @psr0
rule.
Activate the @psr1
rule.
Activate the @psr2
rule.
Activate the @psr4
rule.
Activate the @Symfony
rule or @Symfony:risky
rule depending of the $risky
argument.
Activate the @PhpCsFixer
rule or @PhpCsFixer:risky
rule depending of the $risky
argument.
Activate the @DoctrineAnnotation
rule.
Activate fixers and rules related to a PHP version including risky of not depending of the $risky
argument.
Example:
RuleSetFactory::create()
->php(5.6)
->php(5.6, true)
->php(7.0)
->php(7.0, true)
->php(7.1)
->php(7.1, true)
->php(7.2)
->php(7.2, true)
->getRules()
;
Activate fixers and rules related to a PHPUnit version including risky of not depending of the $risky
argument.
Example:
RuleSetFactory::create()
->phpUnit(5.2) // There is no non-risky rule for the moment
->phpUnit(5.2, true)
->getRules()
;
Activate all rules of this library including risky of not depending of the $risky
argument.
Enable a rule.
Example:
RuleSetFactory::create()
->enable('ordered_class_elements')
->enable('ordered_imports')
->enable('phpdoc_add_missing_param_annotation', ['only_untyped' => true])
->getRules()
;
Disable a rule.
Example:
RuleSetFactory::create()
->disable('ordered_class_elements')
->getRules()
;