Documentation

MultilineWhitespaceBeforeSemicolonsFixer extends AbstractFixer
in package
implements ConfigurableFixerInterface, WhitespacesAwareFixerInterface uses ConfigurableFixerTrait

FinalYes
Tags
author

Graham Campbell hello@gjcampbell.co.uk

author

Egidijus Girčys e.gircys@gmail.com

implements

ConfigurableFixerInterface<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration>

phpstan-type

_AutogeneratedInputConfiguration array{ strategy?: 'new_line_for_chained_calls'|'no_multi_line' }

phpstan-type

_AutogeneratedComputedConfiguration array{ strategy: 'new_line_for_chained_calls'|'no_multi_line' }

Table of Contents

Interfaces

ConfigurableFixerInterface
WhitespacesAwareFixerInterface

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

getPriority()

Returns the priority of the fixer.

public getPriority() : int

Must run before SpaceAfterSemicolonFixer. Must run after CombineConsecutiveIssetsFixer, GetClassToClassKeywordFixer, NoEmptyStatementFixer, SimplifiedIfReturnFixer, SingleImportPerStatementFixer.

Return values
int

isCandidate()

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
bool

findWhitespaceBeforeFirstCall()

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|null

getPreviousSignificantTokenIndex()

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
Return values
int

        
On this page

Search results