VoidReturnFixer
extends AbstractFixer
in package
Tags
Table of Contents
Methods
- getDefinition() : FixerDefinitionInterface
- getPriority() : int
- {@inheritdoc}
- isCandidate() : bool
- isRisky() : bool
- applyFix() : void
- findReturnAnnotations() : array<int, Annotation>
- Find all the return annotations in the function's PHPDoc comment.
- fixFunctionDefinition() : void
- hasReturnAnnotation() : bool
- Determine whether there is a non-void return annotation in the function's PHPDoc comment.
- hasReturnTypeHint() : bool
- Determine whether the function already has a return type hint.
- hasVoidReturn() : bool
- Determine whether the function has a void return.
- hasVoidReturnAnnotation() : bool
- Determine whether there is a void return annotation in the function's PHPDoc comment.
Methods
getDefinition()
public
getDefinition() : FixerDefinitionInterface
Return values
FixerDefinitionInterfacegetPriority()
{@inheritdoc}
public
getPriority() : int
Must run before PhpdocNoEmptyReturnFixer, ReturnTypeDeclarationFixer. Must run after NoSuperfluousPhpdocTagsFixer, SimplifiedNullReturnFixer.
Return values
intisCandidate()
public
isCandidate(Tokens $tokens) : bool
Parameters
- $tokens : Tokens
Return values
boolisRisky()
public
isRisky() : bool
Return values
boolapplyFix()
protected
applyFix(SplFileInfo $file, Tokens $tokens) : void
Parameters
- $file : SplFileInfo
- $tokens : Tokens
findReturnAnnotations()
Find all the return annotations in the function's PHPDoc comment.
private
findReturnAnnotations(Tokens $tokens, int $index) : array<int, Annotation>
Parameters
- $tokens : Tokens
- $index : int
-
The index of the function token
Return values
array<int, Annotation>fixFunctionDefinition()
private
fixFunctionDefinition(Tokens $tokens, int $index) : void
Parameters
- $tokens : Tokens
- $index : int
-
The index of the end of the function definition line, EG at { or ;
hasReturnAnnotation()
Determine whether there is a non-void return annotation in the function's PHPDoc comment.
private
hasReturnAnnotation(Tokens $tokens, int $index) : bool
Parameters
- $tokens : Tokens
- $index : int
-
The index of the function token
Return values
boolhasReturnTypeHint()
Determine whether the function already has a return type hint.
private
hasReturnTypeHint(Tokens $tokens, int $index) : bool
Parameters
- $tokens : Tokens
- $index : int
-
The index of the end of the function definition line, EG at { or ;
Return values
boolhasVoidReturn()
Determine whether the function has a void return.
private
hasVoidReturn(Tokens $tokens, int $startIndex, int $endIndex) : bool
Parameters
- $tokens : Tokens
- $startIndex : int
-
Start of function body
- $endIndex : int
-
End of function body
Return values
boolhasVoidReturnAnnotation()
Determine whether there is a void return annotation in the function's PHPDoc comment.
private
hasVoidReturnAnnotation(Tokens $tokens, int $index) : bool
Parameters
- $tokens : Tokens
- $index : int
-
The index of the function token