Documentation

ModernizeStrposFixer extends AbstractFixer
in package

FinalYes
Tags
author

Alexander M. Turek me@derrabus.de

Table of Contents

Constants

REPLACEMENTS  = [['operator' => [T_IS_IDENTICAL, '==='], 'operand' => [T_LNUMBER, '0'], 'replacement' => [T_STRING, 'str_starts_with'], 'negate' => false], ['operator' => [T_IS_NOT_IDENTICAL, '!=='], 'operand' => [T_LNUMBER, '0'], 'replacement' => [T_STRING, 'str_starts_with'], 'negate' => true], ['operator' => [T_IS_NOT_IDENTICAL, '!=='], 'operand' => [T_STRING, 'false'], 'replacement' => [T_STRING, 'str_contains'], 'negate' => false], ['operator' => [T_IS_IDENTICAL, '==='], 'operand' => [T_STRING, 'false'], 'replacement' => [T_STRING, 'str_contains'], 'negate' => true]]

Methods

getDefinition()  : FixerDefinitionInterface
getPriority()  : int
{@inheritdoc}
isCandidate()  : bool
isRisky()  : bool
applyFix()  : void
fixCall()  : void
getCompareTokens()  : null|array{operator_index: int, operand_index: int}
isOfHigherPrecedence()  : bool

Constants

REPLACEMENTS

private mixed REPLACEMENTS = [['operator' => [T_IS_IDENTICAL, '==='], 'operand' => [T_LNUMBER, '0'], 'replacement' => [T_STRING, 'str_starts_with'], 'negate' => false], ['operator' => [T_IS_NOT_IDENTICAL, '!=='], 'operand' => [T_LNUMBER, '0'], 'replacement' => [T_STRING, 'str_starts_with'], 'negate' => true], ['operator' => [T_IS_NOT_IDENTICAL, '!=='], 'operand' => [T_STRING, 'false'], 'replacement' => [T_STRING, 'str_contains'], 'negate' => false], ['operator' => [T_IS_IDENTICAL, '==='], 'operand' => [T_STRING, 'false'], 'replacement' => [T_STRING, 'str_contains'], 'negate' => true]]

Methods

getPriority()

{@inheritdoc}

public getPriority() : int

Must run before BinaryOperatorSpacesFixer, NoExtraBlankLinesFixer, NoSpacesInsideParenthesisFixer, NoTrailingWhitespaceFixer, NotOperatorWithSpaceFixer, NotOperatorWithSuccessorSpaceFixer, PhpUnitDedicateAssertFixer, SingleSpaceAfterConstructFixer, SingleSpaceAroundConstructFixer, SpacesInsideParenthesesFixer. Must run after StrictComparisonFixer.

Return values
int

fixCall()

private fixCall(Tokens $tokens, int $functionIndex, array{operator_index: int, operand_index: int} $operatorIndices) : void
Parameters
$tokens : Tokens
$functionIndex : int
$operatorIndices : array{operator_index: int, operand_index: int}

getCompareTokens()

private getCompareTokens(Tokens $tokens, int $offsetIndex, -1|1 $direction) : null|array{operator_index: int, operand_index: int}
Parameters
$tokens : Tokens
$offsetIndex : int
$direction : -1|1
Return values
null|array{operator_index: int, operand_index: int}

        
On this page

Search results