SimplifiedNullReturnFixer
extends AbstractFixer
in package
Tags
Table of Contents
- getDefinition() : mixed
- {@inheritdoc}
- getPriority() : mixed
- {@inheritdoc}
- isCandidate() : mixed
- {@inheritdoc}
- applyFix() : mixed
- {@inheritdoc}
- clear() : mixed
- Clear the return statement located at a given index.
- isStrictOrNullableReturnTypeFunction() : bool
- Is the return within a function with a non-void or nullable return type?
- needFixing() : bool
- Does the return statement located at a given index need fixing?
- shouldClearToken() : bool
- Should we clear the specific token?
Methods
getDefinition()
{@inheritdoc}
public
getDefinition() : mixed
Return values
mixed —getPriority()
{@inheritdoc}
public
getPriority() : mixed
Must run before NoUselessReturnFixer, VoidReturnFixer.
Return values
mixed —isCandidate()
{@inheritdoc}
public
isCandidate(Tokens $tokens) : mixed
Parameters
- $tokens : Tokens
Return values
mixed —applyFix()
{@inheritdoc}
protected
applyFix(SplFileInfo $file, Tokens $tokens) : mixed
Parameters
- $file : SplFileInfo
- $tokens : Tokens
Return values
mixed —clear()
Clear the return statement located at a given index.
private
clear(Tokens $tokens, int $index) : mixed
Parameters
- $tokens : Tokens
- $index : int
Return values
mixed —isStrictOrNullableReturnTypeFunction()
Is the return within a function with a non-void or nullable return type?
private
isStrictOrNullableReturnTypeFunction(Tokens $tokens, int $returnIndex) : bool
Parameters
- $tokens : Tokens
- $returnIndex : int
-
Current return token index
Return values
bool —needFixing()
Does the return statement located at a given index need fixing?
private
needFixing(Tokens $tokens, int $index) : bool
Parameters
- $tokens : Tokens
- $index : int
Return values
bool —shouldClearToken()
Should we clear the specific token?
private
shouldClearToken(Tokens $tokens, int $index) : bool
If the token is a comment, or is whitespace that is immediately before a comment, then we'll leave it alone.
Parameters
- $tokens : Tokens
- $index : int