BinaryOperatorSpacesFixer
extends AbstractFixer
in package
implements
ConfigurationDefinitionFixerInterface
Tags
Interfaces, Classes and Traits
Table of Contents
- $alignOperatorTokens : array<string, string>
- $allowedValues : mixed
- $currentLevel : int
- Level counter of the current nest level.
- $deepestLevel : int
- Keep track of the deepest level ever achieved while parsing the code. Used later to replace alignment placeholders with spaces.
- $operators : array<string, string>
- $supportedOperators : array<string|int, string>
- $tokensAnalyzer : TokensAnalyzer
- configure() : mixed
- {@inheritdoc}
- getDefinition() : mixed
- {@inheritdoc}
- getPriority() : mixed
- {@inheritdoc}
- isCandidate() : mixed
- {@inheritdoc}
- applyFix() : mixed
- {@inheritdoc}
- createConfigurationDefinition() : mixed
- {@inheritdoc}
- fixAlignment() : mixed
- fixWhiteSpaceAroundOperator() : mixed
- fixWhiteSpaceAroundOperatorToNoSpace() : mixed
- fixWhiteSpaceAroundOperatorToSingleSpace() : mixed
- fixWhiteSpaceBeforeOperator() : mixed
- injectAlignmentPlaceholders() : mixed
- injectAlignmentPlaceholdersForArrow() : mixed
- injectArrayAlignmentPlaceholders() : mixed
- isEqualPartOfDeclareStatement() : false|int
- replacePlaceholders() : string
- Look for group of placeholders and provide vertical alignment.
- resolveOldConfig() : array<string|int, mixed>
- resolveOperatorsFromConfig() : array<string, string>
Properties
$alignOperatorTokens
private
array<string, string>
$alignOperatorTokens
= []
$allowedValues
private
static mixed
$allowedValues
= [self::ALIGN, self::ALIGN_SINGLE_SPACE, self::ALIGN_SINGLE_SPACE_MINIMAL, self::SINGLE_SPACE, self::NO_SPACE, null]
$currentLevel
Level counter of the current nest level.
private
int
$currentLevel
So one level alignments are not mixed with other level ones.
$deepestLevel
Keep track of the deepest level ever achieved while parsing the code. Used later to replace alignment placeholders with spaces.
private
int
$deepestLevel
$operators
private
array<string, string>
$operators
= []
$supportedOperators
private
static array<string|int, string>
$supportedOperators
= ['=', '*', '/', '%', '<', '>', '|', '^', '+', '-', '&', '&=', '&&', '||', '.=', '/=', '=>', '==', '>=', '===', '!=', '<>', '!==', '<=', 'and', 'or', 'xor', '-=', '%=', '*=', '|=', '+=', '<<', '<<=', '>>', '>>=', '^=', '**', '**=', '<=>', '??', '??=']
$tokensAnalyzer
private
TokensAnalyzer
$tokensAnalyzer
Methods
configure()
{@inheritdoc}
public
configure([array<string|int, mixed> $configuration = null ]) : mixed
Parameters
- $configuration : array<string|int, mixed> = null
Return values
mixed —getDefinition()
{@inheritdoc}
public
getDefinition() : mixed
Return values
mixed —getPriority()
{@inheritdoc}
public
getPriority() : mixed
Must run after ArrayIndentationFixer, ArraySyntaxFixer, ListSyntaxFixer, NoMultilineWhitespaceAroundDoubleArrowFixer, NoUnsetCastFixer, PowToExponentiationFixer, StandardizeNotEqualsFixer, StrictComparisonFixer.
Return values
mixed —isCandidate()
{@inheritdoc}
public
isCandidate(Tokens $tokens) : mixed
Parameters
- $tokens : Tokens
Return values
mixed —applyFix()
{@inheritdoc}
protected
applyFix(SplFileInfo $file, Tokens $tokens) : mixed
Parameters
- $file : SplFileInfo
- $tokens : Tokens
Return values
mixed —createConfigurationDefinition()
{@inheritdoc}
protected
createConfigurationDefinition() : mixed
Return values
mixed —fixAlignment()
private
fixAlignment(Tokens $tokens, array<string, string> $toAlign) : mixed
Parameters
- $tokens : Tokens
- $toAlign : array<string, string>
Return values
mixed —fixWhiteSpaceAroundOperator()
private
fixWhiteSpaceAroundOperator(Tokens $tokens, int $index) : mixed
Parameters
- $tokens : Tokens
- $index : int
Return values
mixed —fixWhiteSpaceAroundOperatorToNoSpace()
private
fixWhiteSpaceAroundOperatorToNoSpace(Tokens $tokens, int $index) : mixed
Parameters
- $tokens : Tokens
- $index : int
Return values
mixed —fixWhiteSpaceAroundOperatorToSingleSpace()
private
fixWhiteSpaceAroundOperatorToSingleSpace(Tokens $tokens, int $index) : mixed
Parameters
- $tokens : Tokens
- $index : int
Return values
mixed —fixWhiteSpaceBeforeOperator()
private
fixWhiteSpaceBeforeOperator(Tokens $tokens, int $index, string $alignStrategy) : mixed
Parameters
- $tokens : Tokens
- $index : int
- $alignStrategy : string
Return values
mixed —injectAlignmentPlaceholders()
private
injectAlignmentPlaceholders(Tokens $tokens, int $startAt, int $endAt, string $tokenContent) : mixed
Parameters
- $tokens : Tokens
- $startAt : int
- $endAt : int
- $tokenContent : string
Return values
mixed —injectAlignmentPlaceholdersForArrow()
private
injectAlignmentPlaceholdersForArrow(Tokens $tokens, int $startAt, int $endAt) : mixed
Parameters
- $tokens : Tokens
- $startAt : int
- $endAt : int
Return values
mixed —injectArrayAlignmentPlaceholders()
private
injectArrayAlignmentPlaceholders(Tokens $tokens, int $from, int $until) : mixed
Parameters
- $tokens : Tokens
- $from : int
- $until : int
Return values
mixed —isEqualPartOfDeclareStatement()
private
isEqualPartOfDeclareStatement(Tokens $tokens, int $index) : false|int
Parameters
- $tokens : Tokens
- $index : int
Return values
false|int —index of T_DECLARE where the =
belongs to or false
replacePlaceholders()
Look for group of placeholders and provide vertical alignment.
private
replacePlaceholders(Tokens $tokens, string $alignStrategy) : string
Parameters
- $tokens : Tokens
- $alignStrategy : string
Return values
string —resolveOldConfig()
private
resolveOldConfig(array<string|int, mixed> $configuration) : array<string|int, mixed>
Parameters
- $configuration : array<string|int, mixed>
Return values
array<string|int, mixed> —resolveOperatorsFromConfig()
private
resolveOperatorsFromConfig() : array<string, string>