SimplifiedNullReturnFixer
extends AbstractFixer
in package
FinalYes
Tags
Table of Contents
Methods
- getDefinition() : FixerDefinitionInterface
- getPriority() : int
- {@inheritdoc}
- isCandidate() : bool
- applyFix() : void
- clear() : void
- 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()
public
getDefinition() : FixerDefinitionInterface
Return values
FixerDefinitionInterfacegetPriority()
{@inheritdoc}
public
getPriority() : int
Must run before NoUselessReturnFixer, VoidReturnFixer.
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
clear()
Clear the return statement located at a given index.
private
clear(Tokens $tokens, int $index) : void
Parameters
- $tokens : Tokens
- $index : int
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
boolneedFixing()
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
boolshouldClearToken()
Should we clear the specific token?
private
shouldClearToken(Tokens $tokens, int $index) : bool
We'll leave it alone if
- token is a comment
- token is whitespace that is immediately before a comment
- token is whitespace that is immediately before the PHP close tag
- token is whitespace that is immediately after a comment and before a semicolon
Parameters
- $tokens : Tokens
- $index : int