NativeTypeDeclarationCasingFixer
extends AbstractFixer
in package
FinalYes
Table of Contents
Constants
- CLASS_CONST_SUPPORTED_HINTS = ['array' => true, 'bool' => true, 'float' => true, 'int' => true, 'iterable' => true, 'mixed' => true, 'null' => true, 'object' => true, 'parent' => true, 'self' => true, 'string' => true, 'static' => true]
- CLASS_PROPERTY_SUPPORTED_HINTS = ['array' => true, 'bool' => true, 'float' => true, 'int' => true, 'iterable' => true, 'mixed' => true, 'null' => true, 'object' => true, 'parent' => true, 'self' => true, 'static' => true, 'string' => true]
- TYPE_SEPARATION_TYPES = [\PhpCsFixer\Tokenizer\CT::T_TYPE_ALTERNATION, \PhpCsFixer\Tokenizer\CT::T_TYPE_INTERSECTION, \PhpCsFixer\Tokenizer\CT::T_DISJUNCTIVE_NORMAL_FORM_TYPE_PARENTHESIS_OPEN, \PhpCsFixer\Tokenizer\CT::T_DISJUNCTIVE_NORMAL_FORM_TYPE_PARENTHESIS_CLOSE]
Properties
- $beforePropertyTypeTokens : array<int, array{: int}|string>
- $functionsAnalyzer : FunctionsAnalyzer
- $functionTypeHints : array<string, true>
- https://secure.php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration.
Methods
- __construct() : mixed
- getDefinition() : FixerDefinitionInterface
- isCandidate() : bool
- applyFix() : void
- fixArgumentType() : void
- fixCasing() : void
- fixClassConstantsAndProperties() : void
- fixFunctionArgumentTypes() : void
- fixFunctionReturnType() : void
- fixFunctions() : void
- getConstNameIndex() : int
- getFirstIndexOfType() : int
- getNativeTypeHintCandidatesForConstant() : iterable<string|int, int>
- getNativeTypeHintCandidatesForProperty() : iterable<string|int, int>
- getTypeEnd() : int
- isConstWithoutType() : bool
Constants
CLASS_CONST_SUPPORTED_HINTS
private
mixed
CLASS_CONST_SUPPORTED_HINTS
= ['array' => true, 'bool' => true, 'float' => true, 'int' => true, 'iterable' => true, 'mixed' => true, 'null' => true, 'object' => true, 'parent' => true, 'self' => true, 'string' => true, 'static' => true]
CLASS_PROPERTY_SUPPORTED_HINTS
private
mixed
CLASS_PROPERTY_SUPPORTED_HINTS
= ['array' => true, 'bool' => true, 'float' => true, 'int' => true, 'iterable' => true, 'mixed' => true, 'null' => true, 'object' => true, 'parent' => true, 'self' => true, 'static' => true, 'string' => true]
TYPE_SEPARATION_TYPES
private
mixed
TYPE_SEPARATION_TYPES
= [\PhpCsFixer\Tokenizer\CT::T_TYPE_ALTERNATION, \PhpCsFixer\Tokenizer\CT::T_TYPE_INTERSECTION, \PhpCsFixer\Tokenizer\CT::T_DISJUNCTIVE_NORMAL_FORM_TYPE_PARENTHESIS_OPEN, \PhpCsFixer\Tokenizer\CT::T_DISJUNCTIVE_NORMAL_FORM_TYPE_PARENTHESIS_CLOSE]
Properties
$beforePropertyTypeTokens
private
array<int, array{: int}|string>
$beforePropertyTypeTokens
$functionsAnalyzer
private
FunctionsAnalyzer
$functionsAnalyzer
$functionTypeHints
https://secure.php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration.
private
array<string, true>
$functionTypeHints
self PHP 5.0 array PHP 5.1 callable PHP 5.4 bool PHP 7.0 float PHP 7.0 int PHP 7.0 string PHP 7.0 iterable PHP 7.1 void PHP 7.1 object PHP 7.2 static PHP 8.0 (return type only) mixed PHP 8.0 false PHP 8.0 (union return type only) null PHP 8.0 (union return type only) never PHP 8.1 (return type only) true PHP 8.2 (standalone type: https://wiki.php.net/rfc/true-type) false PHP 8.2 (standalone type: https://wiki.php.net/rfc/null-false-standalone-types) null PHP 8.2 (standalone type: https://wiki.php.net/rfc/null-false-standalone-types)
Methods
__construct()
public
__construct() : mixed
getDefinition()
public
getDefinition() : FixerDefinitionInterface
Return values
FixerDefinitionInterfaceisCandidate()
public
isCandidate(Tokens $tokens) : bool
Parameters
- $tokens : Tokens
Return values
boolapplyFix()
protected
applyFix(SplFileInfo $file, Tokens $tokens) : void
Parameters
- $file : SplFileInfo
- $tokens : Tokens
fixArgumentType()
private
fixArgumentType(Tokens $tokens[, TypeAnalysis|null $type = null ]) : void
Parameters
- $tokens : Tokens
- $type : TypeAnalysis|null = null
fixCasing()
private
fixCasing(array<string, true> $supportedTypeHints, Tokens $tokens, int $index) : void
Parameters
- $supportedTypeHints : array<string, true>
- $tokens : Tokens
- $index : int
fixClassConstantsAndProperties()
private
fixClassConstantsAndProperties(Tokens $tokens) : void
Parameters
- $tokens : Tokens
fixFunctionArgumentTypes()
private
fixFunctionArgumentTypes(Tokens $tokens, int $index) : void
Parameters
- $tokens : Tokens
- $index : int
fixFunctionReturnType()
private
fixFunctionReturnType(Tokens $tokens, int $index) : void
Parameters
- $tokens : Tokens
- $index : int
fixFunctions()
private
fixFunctions(Tokens $tokens) : void
Parameters
- $tokens : Tokens
getConstNameIndex()
private
getConstNameIndex(Tokens $tokens, int $index) : int
Parameters
- $tokens : Tokens
- $index : int
Return values
intgetFirstIndexOfType()
private
getFirstIndexOfType(Tokens $tokens, int $index) : int
Parameters
- $tokens : Tokens
- $index : int
Return values
intgetNativeTypeHintCandidatesForConstant()
private
getNativeTypeHintCandidatesForConstant(Tokens $tokens, int $index) : iterable<string|int, int>
Parameters
- $tokens : Tokens
- $index : int
Return values
iterable<string|int, int>getNativeTypeHintCandidatesForProperty()
private
getNativeTypeHintCandidatesForProperty(Tokens $tokens, int $index) : iterable<string|int, int>
Parameters
- $tokens : Tokens
- $index : int
Return values
iterable<string|int, int>getTypeEnd()
private
getTypeEnd(Tokens $tokens, int $index, int $upperLimit) : int
Parameters
- $tokens : Tokens
- $index : int
- $upperLimit : int
Return values
intisConstWithoutType()
private
isConstWithoutType(Tokens $tokens, int $index) : bool
Parameters
- $tokens : Tokens
- $index : int