ClassAttributesSeparationFixer
extends AbstractFixer
in package
implements
ConfigurableFixerInterface, WhitespacesAwareFixerInterface
uses
ConfigurableFixerTrait
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
Table of Contents
Interfaces
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
SPACING_ONLY_IF_META
private
mixed
SPACING_ONLY_IF_META
= 'only_if_meta'
Properties
$classElementTypes
private
array<string, string>
$classElementTypes
= []
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 BracesFixer, IndentationTypeFixer, NoExtraBlankLinesFixer, StatementIndentationFixer. Must run after OrderedClassElementsFixer, SingleClassElementPerStatementFixer, VisibilityRequiredFixer.
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
configurePostNormalisation()
protected
configurePostNormalisation() : void
createConfigurationDefinition()
protected
createConfigurationDefinition() : FixerConfigurationResolverInterface
Return values
FixerConfigurationResolverInterfacecorrectLineBreaks()
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
intfindCommentBlockStart()
private
findCommentBlockStart(Tokens $tokens, int $start, int $elementAboveEnd) : int
Parameters
- $tokens : Tokens
- $start : int
- $elementAboveEnd : int
Return values
intfixSpaceAboveClassElement()
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
fixSpaceBelowClassElement()
private
fixSpaceBelowClassElement(Tokens $tokens, _Class $class) : void
Parameters
- $tokens : Tokens
- $class : _Class
getElementsByClass()
private
getElementsByClass(Tokens $tokens) : Generator<string|int, _Class>
Parameters
- $tokens : Tokens
Tags
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
intgetLastTokenIndexOfClassElement()
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
intgetLineBreakCount()
private
getLineBreakCount(Tokens $tokens, int $startIndex, int $endIndex) : int
Parameters
- $tokens : Tokens
- $startIndex : int
- $endIndex : int