VoidReturnFixer
extends AbstractFixer
in package
Tags
Table of Contents
- getDefinition() : mixed
- {@inheritdoc}
- getPriority() : mixed
- {@inheritdoc}
- isCandidate() : mixed
- {@inheritdoc}
- isRisky() : mixed
- {@inheritdoc}
- applyFix() : mixed
- {@inheritdoc}
- findReturnAnnotations() : array<string|int, Annotation>
- Find all the return annotations in the function's PHPDoc comment.
- fixFunctionDefinition() : mixed
- 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()
{@inheritdoc}
public
getDefinition() : mixed
Return values
mixed —getPriority()
{@inheritdoc}
public
getPriority() : mixed
Must run before PhpdocNoEmptyReturnFixer, ReturnTypeDeclarationFixer. Must run after NoSuperfluousPhpdocTagsFixer, SimplifiedNullReturnFixer.
Return values
mixed —isCandidate()
{@inheritdoc}
public
isCandidate(Tokens $tokens) : mixed
Parameters
- $tokens : Tokens
Return values
mixed —isRisky()
{@inheritdoc}
public
isRisky() : mixed
Return values
mixed —applyFix()
{@inheritdoc}
protected
applyFix(SplFileInfo $file, Tokens $tokens) : mixed
Parameters
- $file : SplFileInfo
- $tokens : Tokens
Return values
mixed —findReturnAnnotations()
Find all the return annotations in the function's PHPDoc comment.
private
findReturnAnnotations(Tokens $tokens, int $index) : array<string|int, Annotation>
Parameters
- $tokens : Tokens
- $index : int
-
The index of the function token
Return values
array<string|int, Annotation> —fixFunctionDefinition()
private
fixFunctionDefinition(Tokens $tokens, int $index) : mixed
Parameters
- $tokens : Tokens
- $index : int
-
The index of the end of the function definition line, EG at { or ;
Return values
mixed —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
bool —hasReturnTypeHint()
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
bool —hasVoidReturn()
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
bool —hasVoidReturnAnnotation()
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