Documentation

EregToPregFixer extends AbstractFixer
in package

FinalYes
Tags
author

Matteo Beccati matteo@beccati.com

Table of Contents

Properties

$delimiters  : array<int, string>
$functions  : array<int, array<int, string>>

Methods

getDefinition()  : FixerDefinitionInterface
getPriority()  : int
{@inheritdoc}
isCandidate()  : bool
isRisky()  : bool
applyFix()  : void
checkPreg()  : bool
Check the validity of a PCRE.
getBestDelimiter()  : string
Get the delimiter that would require the least escaping in a regular expression.

Properties

$delimiters

private static array<int, string> $delimiters = ['/', '#', '!']

the list of preg delimiters, in order of preference

$functions

private static array<int, array<int, string>> $functions = [['ereg', 'preg_match', ''], ['eregi', 'preg_match', 'i'], ['ereg_replace', 'preg_replace', ''], ['eregi_replace', 'preg_replace', 'i'], ['split', 'preg_split', ''], ['spliti', 'preg_split', 'i']]

the list of the ext/ereg function names, their preg equivalent and the preg modifier(s), if any all condensed in an array of arrays

Methods

getPriority()

{@inheritdoc}

public getPriority() : int

Must run after NoUselessConcatOperatorFixer.

Return values
int

checkPreg()

Check the validity of a PCRE.

private checkPreg(string $pattern) : bool
Parameters
$pattern : string

the regular expression

Return values
bool

getBestDelimiter()

Get the delimiter that would require the least escaping in a regular expression.

private getBestDelimiter(string $pattern) : string
Parameters
$pattern : string

the regular expression

Return values
string

the preg delimiter


        
On this page

Search results