Documentation

ClassAttributesSeparationFixer extends AbstractFixer
in package
implements ConfigurableFixerInterface, WhitespacesAwareFixerInterface uses ConfigurableFixerTrait

FinalYes

Make sure there is one blank line above and below class elements.

The exception is when an element is the first or last item in a 'classy'.

Tags
phpstan-type

_Class array{ index: int, open: int, close: int, elements: non-empty-list<_Element> }

phpstan-type

_Element array{token: Token, type: string, index: int, start?: int, end?: int}

phpstan-type

_AutogeneratedInputConfiguration array{ elements?: array<string, string> }

phpstan-type

_AutogeneratedComputedConfiguration array{ elements: array<string, string> }

implements

ConfigurableFixerInterface<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration>

Table of Contents

Interfaces

ConfigurableFixerInterface
WhitespacesAwareFixerInterface

Constants

SPACING_ONLY_IF_META  = 'only_if_meta'

Properties

$classElementTypes  : array<string, string>

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
configurePostNormalisation()  : void
createConfigurationDefinition()  : FixerConfigurationResolverInterface
correctLineBreaks()  : void
determineRequiredLineCount()  : int
findCommentBlockStart()  : int
fixSpaceAboveClassElement()  : void
Fix spacing above an element of a class, interface or trait.
fixSpaceBelowClassElement()  : void
getElementsByClass()  : Generator<string|int, _Class>
getFirstTokenIndexOfClassElement()  : int
including trailing single line comments if belonging to the class element.
getLastTokenIndexOfClassElement()  : int
including trailing single line comments if belonging to the class element.
getLineBreakCount()  : int

Constants

Properties

Methods

getPriority()

Returns the priority of the fixer.

public getPriority() : int

Must run before BracesFixer, IndentationTypeFixer, NoExtraBlankLinesFixer, StatementIndentationFixer. Must run after OrderedClassElementsFixer, SingleClassElementPerStatementFixer, VisibilityRequiredFixer.

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

correctLineBreaks()

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

determineRequiredLineCount()

private determineRequiredLineCount(Tokens $tokens, _Class $class, int $elementIndex) : int
Parameters
$tokens : Tokens
$class : _Class
$elementIndex : int
Return values
int

findCommentBlockStart()

private findCommentBlockStart(Tokens $tokens, int $start, int $elementAboveEnd) : int
Parameters
$tokens : Tokens
$start : int
$elementAboveEnd : int
Return values
int

fixSpaceAboveClassElement()

Fix spacing above an element of a class, interface or trait.

private fixSpaceAboveClassElement(Tokens $tokens, _Class $class, int $elementIndex) : void

Deals with comments, PHPDocs and spaces above the element with respect to the position of the element within the class, interface or trait.

Parameters
$tokens : Tokens
$class : _Class
$elementIndex : int

getElementsByClass()

private getElementsByClass(Tokens $tokens) : Generator<string|int, _Class>
Parameters
$tokens : Tokens
Tags
TODO

Introduce proper DTO instead of an array

Return values
Generator<string|int, _Class>

getFirstTokenIndexOfClassElement()

including trailing single line comments if belonging to the class element.

private getFirstTokenIndexOfClassElement(Tokens $tokens, _Class $class, _Element $element) : int
Parameters
$tokens : Tokens
$class : _Class
$element : _Element
Return values
int

getLastTokenIndexOfClassElement()

including trailing single line comments if belonging to the class element.

private getLastTokenIndexOfClassElement(Tokens $tokens, _Class $class, _Element $element, TokensAnalyzer $tokensAnalyzer) : int
Parameters
$tokens : Tokens
$class : _Class
$element : _Element
$tokensAnalyzer : TokensAnalyzer
Return values
int

        
On this page

Search results