Documentation

SimplifiedNullReturnFixer extends AbstractFixer
in package

FinalYes
Tags
author

Graham Campbell hello@gjcampbell.co.uk

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

getPriority()

{@inheritdoc}

public getPriority() : int

Must run before NoUselessReturnFixer, VoidReturnFixer.

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

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
Return values
bool

        
On this page

Search results