Documentation

VoidReturnFixer extends AbstractFixer
in package

FinalYes
Tags
author

Mark Nielsen

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

getPriority()

{@inheritdoc}

public getPriority() : int

Must run before PhpdocNoEmptyReturnFixer, ReturnTypeDeclarationFixer. Must run after NoSuperfluousPhpdocTagsFixer, SimplifiedNullReturnFixer.

Return values
int

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
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

Return values
bool

        
On this page

Search results