Documentation

ClassDefinitionFixer extends AbstractFixer
in package
implements ConfigurableFixerInterface, WhitespacesAwareFixerInterface uses ConfigurableFixerTrait

FinalYes

Fixer for part of the rules defined in PSR2 ¶4.1 Extends and Implements and PSR12 ¶8. Anonymous Classes.

Tags
phpstan-type

_ClassExtendsInfo array{start: int, numberOfExtends: int, multiLine: bool}

phpstan-type

_ClassImplementsInfo array{start: int, numberOfImplements: int, multiLine: bool}

phpstan-type

_AutogeneratedInputConfiguration array{ inline_constructor_arguments?: bool, multi_line_extends_each_single_line?: bool, single_item_single_line?: bool, single_line?: bool, space_before_parenthesis?: bool }

phpstan-type

_AutogeneratedComputedConfiguration array{ inline_constructor_arguments: bool, multi_line_extends_each_single_line: bool, single_item_single_line: bool, single_line: bool, space_before_parenthesis: bool }

implements

ConfigurableFixerInterface<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration>

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
fixClassyDefinition()  : void
fixClassyDefinitionExtends()  : _ClassExtendsInfo
fixClassyDefinitionImplements()  : _ClassImplementsInfo
fixClassyDefinitionOpenSpacing()  : int
getClassyDefinitionInfo()  : _ClassImplementsInfo, anonymousClass: bool, final: false|int, abstract: false|int, readonly: false|int}
getClassyInheritanceInfo()  : array<string, 1>|array{start: int, multiLine: bool}
makeClassyDefinitionSingleLine()  : void
makeClassyInheritancePartMultiLine()  : void
sortClassModifiers()  : void

Methods

getPriority()

Returns the priority of the fixer.

public getPriority() : int

Must run before BracesFixer, SingleLineEmptyBodyFixer. Must run after NewWithBracesFixer, NewWithParenthesesFixer.

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

fixClassyDefinition()

private fixClassyDefinition(Tokens $tokens, int $classyIndex) : void
Parameters
$tokens : Tokens
$classyIndex : int

Class definition token start index

fixClassyDefinitionExtends()

private fixClassyDefinitionExtends(Tokens $tokens, int $classOpenIndex, _ClassExtendsInfo $classExtendsInfo) : _ClassExtendsInfo
Parameters
$tokens : Tokens
$classOpenIndex : int
$classExtendsInfo : _ClassExtendsInfo
Return values
_ClassExtendsInfo

fixClassyDefinitionImplements()

private fixClassyDefinitionImplements(Tokens $tokens, int $classOpenIndex, _ClassImplementsInfo $classImplementsInfo) : _ClassImplementsInfo
Parameters
$tokens : Tokens
$classOpenIndex : int
$classImplementsInfo : _ClassImplementsInfo
Return values
_ClassImplementsInfo

fixClassyDefinitionOpenSpacing()

private fixClassyDefinitionOpenSpacing(Tokens $tokens, _ClassImplementsInfo, anonymousClass: bool, final: false|int, abstract: false|int, readonly: false|int} $classDefInfo) : int
Parameters
$tokens : Tokens
$classDefInfo : _ClassImplementsInfo, anonymousClass: bool, final: false|int, abstract: false|int, readonly: false|int}
Return values
int

getClassyDefinitionInfo()

private getClassyDefinitionInfo(Tokens $tokens, int $classyIndex) : _ClassImplementsInfo, anonymousClass: bool, final: false|int, abstract: false|int, readonly: false|int}
Parameters
$tokens : Tokens
$classyIndex : int
Return values
_ClassImplementsInfo, anonymousClass: bool, final: false|int, abstract: false|int, readonly: false|int}

getClassyInheritanceInfo()

private getClassyInheritanceInfo(Tokens $tokens, int $startIndex, string $label) : array<string, 1>|array{start: int, multiLine: bool}
Parameters
$tokens : Tokens
$startIndex : int
$label : string
Return values
array<string, 1>|array{start: int, multiLine: bool}

makeClassyDefinitionSingleLine()

private makeClassyDefinitionSingleLine(Tokens $tokens, int $startIndex, int $endIndex) : void
Parameters
$tokens : Tokens
$startIndex : int
$endIndex : int

makeClassyInheritancePartMultiLine()

private makeClassyInheritancePartMultiLine(Tokens $tokens, int $startIndex, int $endIndex) : void
Parameters
$tokens : Tokens
$startIndex : int
$endIndex : int

sortClassModifiers()

private sortClassModifiers(Tokens $tokens, array{final: false|int, abstract: false|int, readonly: false|int} $classDefInfo) : void
Parameters
$tokens : Tokens
$classDefInfo : array{final: false|int, abstract: false|int, readonly: false|int}

        
On this page

Search results