SingleSpaceAroundConstructFixer
extends AbstractFixer
in package
implements
ConfigurableFixerInterface
uses
ConfigurableFixerTrait
FinalYes
Tags
Table of Contents
Interfaces
Properties
- $fixTokenMapContainASingleSpace : array<string, int>
- $fixTokenMapFollowedByASingleSpace : array<string, int>
- $fixTokenMapPrecededByASingleSpace : array<string, int>
- $tokenMapContainASingleSpace : array<string, null|int>
- $tokenMapFollowedByASingleSpace : array<string, null|int>
- $tokenMapPrecededByASingleSpace : array<string, null|int>
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
- isMultilineCommaSeparatedConstant() : bool
- isMultilineExtendsOrImplementsWithMoreThanOneAncestor() : bool
- isMultiLineReturn() : bool
Properties
$fixTokenMapContainASingleSpace
private
array<string, int>
$fixTokenMapContainASingleSpace
= []
$fixTokenMapFollowedByASingleSpace
private
array<string, int>
$fixTokenMapFollowedByASingleSpace
= []
$fixTokenMapPrecededByASingleSpace
private
array<string, int>
$fixTokenMapPrecededByASingleSpace
= []
$tokenMapContainASingleSpace
private
static array<string, null|int>
$tokenMapContainASingleSpace
= [
// for now, only one case - but we are ready to extend it, when we learn about new cases to cover
'yield_from' => T_YIELD_FROM,
]
$tokenMapFollowedByASingleSpace
private
static array<string, null|int>
$tokenMapFollowedByASingleSpace
= ['abstract' => T_ABSTRACT, 'as' => T_AS, 'attribute' => \PhpCsFixer\Tokenizer\CT::T_ATTRIBUTE_CLOSE, 'break' => T_BREAK, 'case' => T_CASE, 'catch' => T_CATCH, 'class' => T_CLASS, 'clone' => T_CLONE, 'comment' => T_COMMENT, 'const' => T_CONST, 'const_import' => \PhpCsFixer\Tokenizer\CT::T_CONST_IMPORT, 'continue' => T_CONTINUE, 'do' => T_DO, 'echo' => T_ECHO, 'else' => T_ELSE, 'elseif' => T_ELSEIF, 'enum' => null, 'extends' => T_EXTENDS, 'final' => T_FINAL, 'finally' => T_FINALLY, 'for' => T_FOR, 'foreach' => T_FOREACH, 'function' => T_FUNCTION, 'function_import' => \PhpCsFixer\Tokenizer\CT::T_FUNCTION_IMPORT, 'global' => T_GLOBAL, 'goto' => T_GOTO, 'if' => T_IF, 'implements' => T_IMPLEMENTS, 'include' => T_INCLUDE, 'include_once' => T_INCLUDE_ONCE, 'instanceof' => T_INSTANCEOF, 'insteadof' => T_INSTEADOF, 'interface' => T_INTERFACE, 'match' => null, 'named_argument' => \PhpCsFixer\Tokenizer\CT::T_NAMED_ARGUMENT_COLON, 'namespace' => T_NAMESPACE, 'new' => T_NEW, 'open_tag_with_echo' => T_OPEN_TAG_WITH_ECHO, 'php_doc' => T_DOC_COMMENT, 'php_open' => T_OPEN_TAG, 'print' => T_PRINT, 'private' => T_PRIVATE, 'protected' => T_PROTECTED, 'public' => T_PUBLIC, 'readonly' => null, 'require' => T_REQUIRE, 'require_once' => T_REQUIRE_ONCE, 'return' => T_RETURN, 'static' => T_STATIC, 'switch' => T_SWITCH, 'throw' => T_THROW, 'trait' => T_TRAIT, 'try' => T_TRY, 'type_colon' => \PhpCsFixer\Tokenizer\CT::T_TYPE_COLON, 'use' => T_USE, 'use_lambda' => \PhpCsFixer\Tokenizer\CT::T_USE_LAMBDA, 'use_trait' => \PhpCsFixer\Tokenizer\CT::T_USE_TRAIT, 'var' => T_VAR, 'while' => T_WHILE, 'yield' => T_YIELD, 'yield_from' => T_YIELD_FROM]
$tokenMapPrecededByASingleSpace
private
static array<string, null|int>
$tokenMapPrecededByASingleSpace
= ['as' => T_AS, 'use_lambda' => \PhpCsFixer\Tokenizer\CT::T_USE_LAMBDA]
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, FunctionDeclarationFixer, NullableTypeDeclarationFixer. Must run after ArraySyntaxFixer, ModernizeStrposFixer.
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
FixerConfigurationResolverInterfaceisMultilineCommaSeparatedConstant()
private
isMultilineCommaSeparatedConstant(Tokens $tokens, int $constantIndex) : bool
Parameters
- $tokens : Tokens
- $constantIndex : int
Return values
boolisMultilineExtendsOrImplementsWithMoreThanOneAncestor()
private
isMultilineExtendsOrImplementsWithMoreThanOneAncestor(Tokens $tokens, int $index) : bool
Parameters
- $tokens : Tokens
- $index : int
Return values
boolisMultiLineReturn()
private
isMultiLineReturn(Tokens $tokens, int $index) : bool
Parameters
- $tokens : Tokens
- $index : int