PHP Class PhpCsFixer\FixerFactory

Fixers may be registered (made the factory aware of them) by registering a custom fixer and default, built in fixers. Then, one can attach Config instance to fixer instances. Finally factory creates a ready to use group of fixers.
Author: Dariusz Rumiński ([email protected])
ファイルを表示 Open project: friendsofphp/php-cs-fixer Class Usage Examples

Public Methods

Method Description
__construct ( )
create ( ) : FixerFactory Create instance.
getFixers ( ) : PhpCsFixer\Fixer\FixerInterface[] Get fixers.
hasRule ( string $name ) : boolean Check if fixer exists.
registerBuiltInFixers ( ) Register all built in fixers.
registerCustomFixers ( array $fixers ) Register fixers.
registerFixer ( PhpCsFixer\Fixer\FixerInterface $fixer, boolean $isCustom ) Register fixer.
setWhitespacesConfig ( phpcsfixer\WhitespacesFixerConfig $config )
useRuleSet ( phpcsfixer\RuleSetInterface $ruleSet ) Apply RuleSet on fixers to filter out all unwanted fixers.

Private Methods

Method Description
generateConflictMessage ( array $fixerConflicts ) : string
getFixersConflicts ( PhpCsFixer\Fixer\FixerInterface $fixer ) : string[] | null
sortFixers ( ) Sort fixers by their priorities.

Method Details

__construct() public method

public __construct ( )

create() public static method

Create instance.
public static create ( ) : FixerFactory
return FixerFactory

getFixers() public method

Get fixers.
public getFixers ( ) : PhpCsFixer\Fixer\FixerInterface[]
return PhpCsFixer\Fixer\FixerInterface[]

hasRule() public method

Check if fixer exists.
public hasRule ( string $name ) : boolean
$name string
return boolean

registerBuiltInFixers() public method

Register all built in fixers.

registerCustomFixers() public method

Register fixers.
public registerCustomFixers ( array $fixers )
$fixers array

registerFixer() public method

Register fixer.
public registerFixer ( PhpCsFixer\Fixer\FixerInterface $fixer, boolean $isCustom )
$fixer PhpCsFixer\Fixer\FixerInterface
$isCustom boolean

setWhitespacesConfig() public method

public setWhitespacesConfig ( phpcsfixer\WhitespacesFixerConfig $config )
$config phpcsfixer\WhitespacesFixerConfig

useRuleSet() public method

Apply RuleSet on fixers to filter out all unwanted fixers.
public useRuleSet ( phpcsfixer\RuleSetInterface $ruleSet )
$ruleSet phpcsfixer\RuleSetInterface