1 | <?php |
||
23 | class PCRENewModifiersSniff extends PregReplaceEModifierSniff |
||
24 | { |
||
25 | |||
26 | /** |
||
27 | * Functions to check for. |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $functions = array( |
||
32 | 'preg_replace' => true, |
||
33 | 'preg_filter' => true, |
||
34 | 'preg_grep' => true, |
||
35 | 'preg_match_all' => true, |
||
36 | 'preg_match' => true, |
||
37 | 'preg_replace_callback_array' => true, |
||
38 | 'preg_replace_callback' => true, |
||
39 | 'preg_replace' => true, |
||
40 | 'preg_split' => true, |
||
41 | ); |
||
42 | |||
43 | /** |
||
44 | * Array listing newly introduced regex modifiers. |
||
45 | * |
||
46 | * The key should be the modifier (case-sensitive!). |
||
47 | * The value should be the PHP version in which the modifier was introduced. |
||
48 | * |
||
49 | * @var array |
||
50 | */ |
||
51 | protected $newModifiers = array( |
||
52 | 'J' => array( |
||
53 | '7.1' => false, |
||
54 | '7.2' => true, |
||
55 | ), |
||
56 | ); |
||
57 | |||
58 | |||
59 | /** |
||
60 | * Do a version check to determine if this sniff needs to run at all. |
||
61 | * |
||
62 | * @return bool |
||
63 | */ |
||
64 | protected function bowOutEarly() |
||
70 | |||
71 | |||
72 | /** |
||
73 | * Examine the regex modifier string. |
||
74 | * |
||
75 | * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. |
||
76 | * @param int $stackPtr The position of the current token in the |
||
77 | * stack passed in $tokens. |
||
78 | * @param string $functionName The function which contained the pattern. |
||
79 | * @param string $modifiers The regex modifiers found. |
||
80 | * |
||
81 | * @return void |
||
82 | */ |
||
83 | protected function examineModifiers(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $functionName, $modifiers) |
||
114 | |||
115 | }//end class |
||
116 |