PhpdocParamOrderFixer
extends AbstractFixer
in package
FinalYes
Tags
Table of Contents
Constants
- PARAM_TAG = 'param'
Methods
- getDefinition() : FixerDefinitionInterface
- getPriority() : int
- {@inheritdoc}
- isCandidate() : bool
- applyFix() : void
- findParamAnnotationByIdentifier() : array<int, int>|null
- Return the indices of the lines of a specific parameter annotation.
- getFunctionParamNames() : array<int, Token>
- getOtherAnnotationsBetweenParams() : array<int, string>
- Fetch all annotations except the param ones.
- rewriteDocBlock() : DocBlock
- Overwrite the param annotations in order.
- sortParamAnnotations() : array<int, string>
- Sort the param annotations according to the function parameters.
Constants
PARAM_TAG
private
mixed
PARAM_TAG
= 'param'
Methods
getDefinition()
public
getDefinition() : FixerDefinitionInterface
Return values
FixerDefinitionInterfacegetPriority()
{@inheritdoc}
public
getPriority() : int
Must run before PhpdocAlignFixer. Must run after AlignMultilineCommentFixer, CommentToPhpdocFixer, PhpdocIndentFixer, PhpdocScalarFixer, PhpdocToCommentFixer, PhpdocTypesFixer.
Return values
intisCandidate()
public
isCandidate(Tokens $tokens) : bool
Parameters
- $tokens : Tokens
Return values
boolapplyFix()
protected
applyFix(SplFileInfo $file, Tokens $tokens) : void
Parameters
- $file : SplFileInfo
- $tokens : Tokens
findParamAnnotationByIdentifier()
Return the indices of the lines of a specific parameter annotation.
private
findParamAnnotationByIdentifier(array<int, Annotation> $paramAnnotations, string $identifier) : array<int, int>|null
Parameters
- $paramAnnotations : array<int, Annotation>
- $identifier : string
Return values
array<int, int>|nullgetFunctionParamNames()
private
getFunctionParamNames(Tokens $tokens, int $paramBlockStart) : array<int, Token>
Parameters
- $tokens : Tokens
- $paramBlockStart : int
Return values
array<int, Token>getOtherAnnotationsBetweenParams()
Fetch all annotations except the param ones.
private
getOtherAnnotationsBetweenParams(DocBlock $doc, array<int, Annotation> $paramAnnotations) : array<int, string>
Parameters
- $doc : DocBlock
- $paramAnnotations : array<int, Annotation>
Return values
array<int, string>rewriteDocBlock()
Overwrite the param annotations in order.
private
rewriteDocBlock(DocBlock $doc, array<int, Token> $paramNames, array<int, Annotation> $paramAnnotations) : DocBlock
Parameters
- $doc : DocBlock
- $paramNames : array<int, Token>
- $paramAnnotations : array<int, Annotation>
Return values
DocBlocksortParamAnnotations()
Sort the param annotations according to the function parameters.
private
sortParamAnnotations(array<int, Token> $funcParamNames, array<int, Annotation> $paramAnnotations) : array<int, string>
Parameters
- $funcParamNames : array<int, Token>
- $paramAnnotations : array<int, Annotation>