EregToPregFixer
extends AbstractFixer
in package
Tags
Table of Contents
- $delimiters : array<string|int, mixed>
- $functions : array<string|int, mixed>
- getDefinition() : mixed
- {@inheritdoc}
- isCandidate() : mixed
- {@inheritdoc}
- isRisky() : mixed
- {@inheritdoc}
- applyFix() : mixed
- {@inheritdoc}
- 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<string|int, mixed>
$delimiters
= ['/', '#', '!']
$functions
private
static array<string|int, mixed>
$functions
= [['ereg', 'preg_match', ''], ['eregi', 'preg_match', 'i'], ['ereg_replace', 'preg_replace', ''], ['eregi_replace', 'preg_replace', 'i'], ['split', 'preg_split', ''], ['spliti', 'preg_split', 'i']]
Methods
getDefinition()
{@inheritdoc}
public
getDefinition() : mixed
Return values
mixed —isCandidate()
{@inheritdoc}
public
isCandidate(Tokens $tokens) : mixed
Parameters
- $tokens : Tokens
Return values
mixed —isRisky()
{@inheritdoc}
public
isRisky() : mixed
Return values
mixed —applyFix()
{@inheritdoc}
protected
applyFix(SplFileInfo $file, Tokens $tokens) : mixed
Parameters
- $file : SplFileInfo
- $tokens : Tokens
Return values
mixed —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