1 | <?php |
||
23 | class ArrayReduceInitialTypeSniff extends AbstractFunctionCallParameterSniff |
||
24 | { |
||
25 | |||
26 | /** |
||
27 | * Functions to check for. |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $targetFunctions = array( |
||
32 | 'array_reduce' => true, |
||
33 | ); |
||
34 | |||
35 | /** |
||
36 | * Tokens which, for the purposes of this sniff, indicate that there is |
||
37 | * a variable element to the value passed. |
||
38 | * |
||
39 | * @var array |
||
40 | */ |
||
41 | private $variableValueTokens = array( |
||
42 | T_VARIABLE, |
||
43 | T_STRING, |
||
44 | T_SELF, |
||
45 | T_PARENT, |
||
46 | T_STATIC, |
||
47 | T_DOUBLE_QUOTED_STRING, |
||
48 | ); |
||
49 | |||
50 | |||
51 | /** |
||
52 | * Do a version check to determine if this sniff needs to run at all. |
||
53 | * |
||
54 | * @return bool |
||
55 | */ |
||
56 | protected function bowOutEarly() |
||
60 | |||
61 | |||
62 | /** |
||
63 | * Process the parameters of a matched function. |
||
64 | * |
||
65 | * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. |
||
66 | * @param int $stackPtr The position of the current token in the stack. |
||
67 | * @param string $functionName The token content (function name) which was matched. |
||
68 | * @param array $parameters Array with information about the parameters. |
||
69 | * |
||
70 | * @return int|void Integer stack pointer to skip forward or void to continue |
||
71 | * normal file processing. |
||
72 | */ |
||
73 | public function processParameters(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $functionName, $parameters) |
||
105 | } |
||
106 |