Documentation

NoSuperfluousPhpdocTagsFixer extends AbstractFixer
in package
implements ConfigurableFixerInterface uses ConfigurableFixerTrait

FinalYes
Tags
phpstan-type

_TypeInfo array{ types: list, allows_null: bool, }

phpstan-type

_DocumentElement array{ index: int, type: 'classy'|'function'|'property', modifiers: array<int, Token>, types: array<int, Token>, }

phpstan-type

_AutogeneratedInputConfiguration array{ allow_hidden_params?: bool, allow_mixed?: bool, allow_unused_params?: bool, remove_inheritdoc?: bool }

phpstan-type

_AutogeneratedComputedConfiguration array{ allow_hidden_params: bool, allow_mixed: bool, allow_unused_params: bool, remove_inheritdoc: bool }

implements

ConfigurableFixerInterface<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration>

Table of Contents

Interfaces

ConfigurableFixerInterface

Constants

NO_TYPE_INFO  = ['types' => [], 'allows_null' => true]

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
createConfigurationDefinition()  : FixerConfigurationResolverInterface
annotationIsSuperfluous()  : bool
findDocumentedElement()  : null|_DocumentElement
fixClassDocComment()  : string
fixFunctionDocComment()  : string
fixPropertyDocComment()  : string
getArgumentsInfo()  : array<non-empty-string, _TypeInfo>
getReturnTypeInfo()  : _TypeInfo
parseTypeHint()  : _TypeInfo
removeSuperfluousInheritDoc()  : string
removeSuperfluousModifierAnnotation()  : void
toComparableNames()  : array<int, string>
Normalizes types to make them comparable.

Constants

Methods

getPriority()

Returns the priority of the fixer.

public getPriority() : int

Must run before NoEmptyPhpdocFixer, PhpdocAlignFixer, VoidReturnFixer. Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, FullyQualifiedStrictTypesFixer, PhpdocAddMissingParamAnnotationFixer, PhpdocIndentFixer, PhpdocLineSpanFixer, PhpdocReturnSelfReferenceFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocToParamTypeFixer, PhpdocToPropertyTypeFixer, PhpdocToReturnTypeFixer, PhpdocTypesFixer.

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

annotationIsSuperfluous()

private annotationIsSuperfluous(Annotation $annotation, _TypeInfo $info, null|non-empty-string $namespace, string|null $currentSymbol, array<string, string> $symbolShortNames) : bool
Parameters
$annotation : Annotation
$info : _TypeInfo
$namespace : null|non-empty-string
$currentSymbol : string|null
$symbolShortNames : array<string, string>
Return values
bool

findDocumentedElement()

private findDocumentedElement(Tokens $tokens, int $docCommentIndex) : null|_DocumentElement
Parameters
$tokens : Tokens
$docCommentIndex : int
Return values
null|_DocumentElement

fixClassDocComment()

private fixClassDocComment(string $content, _DocumentElement|array{type: "classy"} $element) : string
Parameters
$content : string
$element : _DocumentElement|array{type: "classy"}
Return values
string

fixFunctionDocComment()

private fixFunctionDocComment(string $content, Tokens $tokens, _DocumentElement|array{type: "function"} $element, null|non-empty-string $namespace, string|null $currentSymbol, array<string, string> $shortNames) : string
Parameters
$content : string
$tokens : Tokens
$element : _DocumentElement|array{type: "function"}
$namespace : null|non-empty-string
$currentSymbol : string|null
$shortNames : array<string, string>
Return values
string

fixPropertyDocComment()

private fixPropertyDocComment(string $content, Tokens $tokens, _DocumentElement|array{type: "property"} $element, null|non-empty-string $namespace, string|null $currentSymbol, array<string, string> $shortNames) : string
Parameters
$content : string
$tokens : Tokens
$element : _DocumentElement|array{type: "property"}
$namespace : null|non-empty-string
$currentSymbol : string|null
$shortNames : array<string, string>
Return values
string

getArgumentsInfo()

private getArgumentsInfo(Tokens $tokens, int $start, int $end) : array<non-empty-string, _TypeInfo>
Parameters
$tokens : Tokens
$start : int
$end : int
Return values
array<non-empty-string, _TypeInfo>

getReturnTypeInfo()

private getReturnTypeInfo(Tokens $tokens, int $closingParenthesisIndex) : _TypeInfo
Parameters
$tokens : Tokens
$closingParenthesisIndex : int
Return values
_TypeInfo

parseTypeHint()

private parseTypeHint(Tokens $tokens, int $index) : _TypeInfo
Parameters
$tokens : Tokens
$index : int

The index of the first token of the type hint

Return values
_TypeInfo

removeSuperfluousInheritDoc()

private removeSuperfluousInheritDoc(string $docComment) : string
Parameters
$docComment : string
Return values
string

toComparableNames()

Normalizes types to make them comparable.

private toComparableNames(array<int, string> $types, null|non-empty-string $namespace, string|null $currentSymbol, array<string, string> $symbolShortNames) : array<int, string>

Converts given types to lowercase, replaces imports aliases with their matching FQCN, and finally sorts the result.

Parameters
$types : array<int, string>

The types to normalize

$namespace : null|non-empty-string
$currentSymbol : string|null
$symbolShortNames : array<string, string>

The imports aliases

Return values
array<int, string>

The normalized types


        
On this page

Search results