Documentation

SingleSpaceAroundConstructFixer extends AbstractFixer
in package
implements ConfigurableFixerInterface uses ConfigurableFixerTrait

FinalYes
Tags
author

Andreas Möller am@localheinz.com

author

Dariusz Rumiński dariusz.ruminski@gmail.com

implements

ConfigurableFixerInterface<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration>

phpstan-type

_AutogeneratedInputConfiguration array{ constructs_contain_a_single_space?: list<'yield_from'>, constructs_followed_by_a_single_space?: list<'abstract'|'as'|'attribute'|'break'|'case'|'catch'|'class'|'clone'|'comment'|'const'|'const_import'|'continue'|'do'|'echo'|'else'|'elseif'|'enum'|'extends'|'final'|'finally'|'for'|'foreach'|'function'|'function_import'|'global'|'goto'|'if'|'implements'|'include'|'include_once'|'instanceof'|'insteadof'|'interface'|'match'|'named_argument'|'namespace'|'new'|'open_tag_with_echo'|'php_doc'|'php_open'|'print'|'private'|'protected'|'public'|'readonly'|'require'|'require_once'|'return'|'static'|'switch'|'throw'|'trait'|'try'|'type_colon'|'use'|'use_lambda'|'use_trait'|'var'|'while'|'yield'|'yield_from'>, constructs_preceded_by_a_single_space?: list<'as'|'use_lambda'> }

phpstan-type

_AutogeneratedComputedConfiguration array{ constructs_contain_a_single_space: list<'yield_from'>, constructs_followed_by_a_single_space: list<'abstract'|'as'|'attribute'|'break'|'case'|'catch'|'class'|'clone'|'comment'|'const'|'const_import'|'continue'|'do'|'echo'|'else'|'elseif'|'enum'|'extends'|'final'|'finally'|'for'|'foreach'|'function'|'function_import'|'global'|'goto'|'if'|'implements'|'include'|'include_once'|'instanceof'|'insteadof'|'interface'|'match'|'named_argument'|'namespace'|'new'|'open_tag_with_echo'|'php_doc'|'php_open'|'print'|'private'|'protected'|'public'|'readonly'|'require'|'require_once'|'return'|'static'|'switch'|'throw'|'trait'|'try'|'type_colon'|'use'|'use_lambda'|'use_trait'|'var'|'while'|'yield'|'yield_from'>, constructs_preceded_by_a_single_space: list<'as'|'use_lambda'> }

Table of Contents

Interfaces

ConfigurableFixerInterface

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

$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

getPriority()

Returns the priority of the fixer.

public getPriority() : int

Must run before BracesFixer, FunctionDeclarationFixer, NullableTypeDeclarationFixer. Must run after ArraySyntaxFixer, ModernizeStrposFixer.

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

isMultilineExtendsOrImplementsWithMoreThanOneAncestor()

private isMultilineExtendsOrImplementsWithMoreThanOneAncestor(Tokens $tokens, int $index) : bool
Parameters
$tokens : Tokens
$index : int
Return values
bool

        
On this page

Search results