PHP Interface PhpCsFixer\Fixer\FixerInterface

Author: Dariusz Rumiński ([email protected])
Author: Fabien Potencier ([email protected])
Mostra file Open project: friendsofphp/php-cs-fixer Interface Usage Examples

Public Methods

Method Description
fix ( SplFileInfo $file, Tokens $tokens ) Fixes a file.
getName ( ) : string Returns the name of the fixer.
getPriority ( ) : integer Returns the priority of the fixer.
isCandidate ( Tokens $tokens ) : boolean Check if the fixer is a candidate for given Tokens collection.
isRisky ( ) : boolean Check if fixer is risky or not.
supports ( SplFileInfo $file ) : boolean Returns true if the file is supported by this fixer.

Method Details

fix() public method

Fixes a file.
public fix ( SplFileInfo $file, Tokens $tokens )
$file SplFileInfo A \SplFileInfo instance
$tokens PhpCsFixer\Tokenizer\Tokens Tokens collection

getName() public method

The name must be all lowercase and without any spaces.
public getName ( ) : string
return string The name of the fixer

getPriority() public method

The default priority is 0 and higher priorities are executed first.
public getPriority ( ) : integer
return integer

isCandidate() public method

Fixer is a candidate when the collection contains tokens that may be fixed during fixer work. This could be considered as some kind of bloom filter. When this method returns true then to the Tokens collection may or may not need a fixing, but when this method returns false then the Tokens collection need no fixing for sure.
public isCandidate ( Tokens $tokens ) : boolean
$tokens PhpCsFixer\Tokenizer\Tokens
return boolean

isRisky() public method

Risky fixer could change code behavior!
public isRisky ( ) : boolean
return boolean

supports() public method

Returns true if the file is supported by this fixer.
public supports ( SplFileInfo $file ) : boolean
$file SplFileInfo
return boolean true if the file is supported by this fixer, false otherwise