MultilineWhitespaceBeforeSemicolonsFixer
extends AbstractFixer
in package
implements
ConfigurableFixerInterface, WhitespacesAwareFixerInterface
uses
ConfigurableFixerTrait
Tags
Table of Contents
Interfaces
Methods
- getDefinition() : FixerDefinitionInterface
- Returns the definition of the fixer.
- getPriority() : int
- Returns the priority of the fixer.
- isCandidate() : bool
- Check if the fixer is a candidate for given Tokens collection.
- applyFix() : void
- createConfigurationDefinition() : FixerConfigurationResolverInterface
- findWhitespaceBeforeFirstCall() : string|null
- Checks if the semicolon closes a multiline call and returns the whitespace of the first call at $index.
- getNewLineIndex() : int
- Find the index for the next new line. Return the given index when there's no new line.
- getPreviousSignificantTokenIndex() : int
- Find the index for the previous significant token. Return the given index when there's no significant token.
Methods
getDefinition()
Returns the definition of the fixer.
public
getDefinition() : FixerDefinitionInterface
Return values
FixerDefinitionInterfacegetPriority()
Returns the priority of the fixer.
public
getPriority() : int
Must run before SpaceAfterSemicolonFixer. Must run after CombineConsecutiveIssetsFixer, GetClassToClassKeywordFixer, NoEmptyStatementFixer, SimplifiedIfReturnFixer, SingleImportPerStatementFixer.
Return values
intisCandidate()
Check if the fixer is a candidate for given Tokens collection.
public
isCandidate(Tokens $tokens) : bool
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.
Parameters
- $tokens : Tokens
Return values
boolapplyFix()
protected
applyFix(SplFileInfo $file, Tokens $tokens) : void
Parameters
- $file : SplFileInfo
- $tokens : Tokens
createConfigurationDefinition()
protected
createConfigurationDefinition() : FixerConfigurationResolverInterface
Return values
FixerConfigurationResolverInterfacefindWhitespaceBeforeFirstCall()
Checks if the semicolon closes a multiline call and returns the whitespace of the first call at $index.
private
findWhitespaceBeforeFirstCall(int $index, Tokens $tokens) : string|null
i.e. it will return the whitespace marked with '____' in the example underneath.
.. ____$this->methodCall() ->anotherCall(); ..
Parameters
- $index : int
- $tokens : Tokens
Return values
string|nullgetNewLineIndex()
Find the index for the next new line. Return the given index when there's no new line.
private
getNewLineIndex(int $index, Tokens $tokens) : int
Parameters
- $index : int
- $tokens : Tokens
Return values
intgetPreviousSignificantTokenIndex()
Find the index for the previous significant token. Return the given index when there's no significant token.
private
getPreviousSignificantTokenIndex(int $index, Tokens $tokens) : int
Parameters
- $index : int
- $tokens : Tokens