1 | <?php |
||
30 | class NewPasswordAlgoConstantValuesSniff extends AbstractFunctionCallParameterSniff |
||
31 | { |
||
32 | |||
33 | /** |
||
34 | * Functions to check for. |
||
35 | * |
||
36 | * Key is the function name, value the 1-based parameter position of |
||
37 | * the $encoding parameter. |
||
38 | * |
||
39 | * @since 9.3.0 |
||
40 | * |
||
41 | * @var array |
||
42 | */ |
||
43 | protected $targetFunctions = array( |
||
44 | 'password_hash' => 2, |
||
45 | 'password_needs_rehash' => 2, |
||
46 | ); |
||
47 | |||
48 | /** |
||
49 | * Tokens types which indicate that the parameter passed is not the PHP native constant. |
||
50 | * |
||
51 | * @since 9.3.0 |
||
52 | * |
||
53 | * @var array |
||
54 | */ |
||
55 | private $invalidTokenTypes = array( |
||
56 | \T_NULL => true, |
||
57 | \T_TRUE => true, |
||
58 | \T_FALSE => true, |
||
59 | \T_LNUMBER => true, |
||
60 | \T_DNUMBER => true, |
||
61 | \T_CONSTANT_ENCAPSED_STRING => true, |
||
62 | \T_DOUBLE_QUOTED_STRING => true, |
||
63 | \T_HEREDOC => true, |
||
64 | \T_NOWDOC => true, |
||
65 | ); |
||
66 | |||
67 | |||
68 | /** |
||
69 | * Do a version check to determine if this sniff needs to run at all. |
||
70 | * |
||
71 | * @since 9.3.0 |
||
72 | * |
||
73 | * @return bool |
||
74 | */ |
||
75 | protected function bowOutEarly() |
||
79 | |||
80 | |||
81 | /** |
||
82 | * Process the parameters of a matched function. |
||
83 | * |
||
84 | * @since 9.3.0 |
||
85 | * |
||
86 | * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. |
||
87 | * @param int $stackPtr The position of the current token in the stack. |
||
88 | * @param string $functionName The token content (function name) which was matched. |
||
89 | * @param array $parameters Array with information about the parameters. |
||
90 | * |
||
91 | * @return int|void Integer stack pointer to skip forward or void to continue |
||
92 | * normal file processing. |
||
93 | */ |
||
94 | public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) |
||
124 | } |
||
125 |