@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | \T_CLOSURE, |
46 | 46 | ); |
47 | 47 | |
48 | - if (\defined('T_RETURN_TYPE')) { |
|
49 | - $tokens[] = \T_RETURN_TYPE; |
|
48 | + if ( \defined( 'T_RETURN_TYPE' ) ) { |
|
49 | + $tokens[ ] = \T_RETURN_TYPE; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | return $tokens; |
@@ -62,26 +62,26 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return void |
64 | 64 | */ |
65 | - public function process(File $phpcsFile, $stackPtr) |
|
65 | + public function process( File $phpcsFile, $stackPtr ) |
|
66 | 66 | { |
67 | - if ($this->supportsBelow('7.0') === false) { |
|
67 | + if ( $this->supportsBelow( '7.0' ) === false ) { |
|
68 | 68 | return; |
69 | 69 | } |
70 | 70 | |
71 | 71 | $tokens = $phpcsFile->getTokens(); |
72 | - $tokenCode = $tokens[$stackPtr]['code']; |
|
72 | + $tokenCode = $tokens[ $stackPtr ][ 'code' ]; |
|
73 | 73 | |
74 | - if ($tokenCode === \T_FUNCTION || $tokenCode === \T_CLOSURE) { |
|
75 | - $this->processFunctionDeclaration($phpcsFile, $stackPtr); |
|
74 | + if ( $tokenCode === \T_FUNCTION || $tokenCode === \T_CLOSURE ) { |
|
75 | + $this->processFunctionDeclaration( $phpcsFile, $stackPtr ); |
|
76 | 76 | |
77 | 77 | // Deal with older PHPCS version which don't recognize return type hints |
78 | 78 | // as well as newer PHPCS versions (3.3.0+) where the tokenization has changed. |
79 | - $returnTypeHint = $this->getReturnTypeHintToken($phpcsFile, $stackPtr); |
|
80 | - if ($returnTypeHint !== false) { |
|
81 | - $this->processReturnType($phpcsFile, $returnTypeHint); |
|
79 | + $returnTypeHint = $this->getReturnTypeHintToken( $phpcsFile, $stackPtr ); |
|
80 | + if ( $returnTypeHint !== false ) { |
|
81 | + $this->processReturnType( $phpcsFile, $returnTypeHint ); |
|
82 | 82 | } |
83 | 83 | } else { |
84 | - $this->processReturnType($phpcsFile, $stackPtr); |
|
84 | + $this->processReturnType( $phpcsFile, $stackPtr ); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
@@ -95,18 +95,18 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return void |
97 | 97 | */ |
98 | - protected function processFunctionDeclaration(File $phpcsFile, $stackPtr) |
|
98 | + protected function processFunctionDeclaration( File $phpcsFile, $stackPtr ) |
|
99 | 99 | { |
100 | - $params = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr); |
|
100 | + $params = PHPCSHelper::getMethodParameters( $phpcsFile, $stackPtr ); |
|
101 | 101 | |
102 | - if (empty($params) === false && \is_array($params)) { |
|
103 | - foreach ($params as $param) { |
|
104 | - if ($param['nullable_type'] === true) { |
|
102 | + if ( empty( $params ) === false && \is_array( $params ) ) { |
|
103 | + foreach ( $params as $param ) { |
|
104 | + if ( $param[ 'nullable_type' ] === true ) { |
|
105 | 105 | $phpcsFile->addError( |
106 | 106 | 'Nullable type declarations are not supported in PHP 7.0 or earlier. Found: %s', |
107 | - $param['token'], |
|
107 | + $param[ 'token' ], |
|
108 | 108 | 'typeDeclarationFound', |
109 | - array($param['type_hint']) |
|
109 | + array( $param[ 'type_hint' ] ) |
|
110 | 110 | ); |
111 | 111 | } |
112 | 112 | } |
@@ -123,34 +123,34 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return void |
125 | 125 | */ |
126 | - protected function processReturnType(File $phpcsFile, $stackPtr) |
|
126 | + protected function processReturnType( File $phpcsFile, $stackPtr ) |
|
127 | 127 | { |
128 | 128 | $tokens = $phpcsFile->getTokens(); |
129 | 129 | |
130 | - if (isset($tokens[($stackPtr - 1)]['code']) === false) { |
|
130 | + if ( isset( $tokens[ ( $stackPtr - 1 ) ][ 'code' ] ) === false ) { |
|
131 | 131 | return; |
132 | 132 | } |
133 | 133 | |
134 | - $previous = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); |
|
134 | + $previous = $phpcsFile->findPrevious( Tokens::$emptyTokens, ( $stackPtr - 1 ), null, true ); |
|
135 | 135 | |
136 | 136 | // Deal with namespaced class names. |
137 | - if ($tokens[$previous]['code'] === \T_NS_SEPARATOR) { |
|
137 | + if ( $tokens[ $previous ][ 'code' ] === \T_NS_SEPARATOR ) { |
|
138 | 138 | $validTokens = Tokens::$emptyTokens; |
139 | - $validTokens[\T_STRING] = true; |
|
140 | - $validTokens[\T_NS_SEPARATOR] = true; |
|
139 | + $validTokens[ \T_STRING ] = true; |
|
140 | + $validTokens[ \T_NS_SEPARATOR ] = true; |
|
141 | 141 | |
142 | 142 | $stackPtr--; |
143 | 143 | |
144 | - while (isset($validTokens[$tokens[($stackPtr - 1)]['code']]) === true) { |
|
144 | + while ( isset( $validTokens[ $tokens[ ( $stackPtr - 1 ) ][ 'code' ] ] ) === true ) { |
|
145 | 145 | $stackPtr--; |
146 | 146 | } |
147 | 147 | |
148 | - $previous = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); |
|
148 | + $previous = $phpcsFile->findPrevious( Tokens::$emptyTokens, ( $stackPtr - 1 ), null, true ); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // T_NULLABLE token was introduced in PHPCS 2.7.2. Before that it identified as T_INLINE_THEN. |
152 | - if ((\defined('T_NULLABLE') === true && $tokens[$previous]['type'] === 'T_NULLABLE') |
|
153 | - || (\defined('T_NULLABLE') === false && $tokens[$previous]['code'] === \T_INLINE_THEN) |
|
152 | + if ( ( \defined( 'T_NULLABLE' ) === true && $tokens[ $previous ][ 'type' ] === 'T_NULLABLE' ) |
|
153 | + || ( \defined( 'T_NULLABLE' ) === false && $tokens[ $previous ][ 'code' ] === \T_INLINE_THEN ) |
|
154 | 154 | ) { |
155 | 155 | $phpcsFile->addError( |
156 | 156 | 'Nullable return types are not supported in PHP 7.0 or earlier.', |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | \T_TRAIT, |
90 | 90 | ); |
91 | 91 | |
92 | - if (\defined('T_ANON_CLASS')) { |
|
93 | - $targets[] = \T_ANON_CLASS; |
|
92 | + if ( \defined( 'T_ANON_CLASS' ) ) { |
|
93 | + $targets[ ] = \T_ANON_CLASS; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | return $targets; |
@@ -106,69 +106,69 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return void |
108 | 108 | */ |
109 | - public function process(File $phpcsFile, $stackPtr) |
|
109 | + public function process( File $phpcsFile, $stackPtr ) |
|
110 | 110 | { |
111 | 111 | // Should be removed, the requirement was previously also there, 5.3 just started throwing a warning about it. |
112 | - if ($this->supportsAbove('5.3') === false) { |
|
112 | + if ( $this->supportsAbove( '5.3' ) === false ) { |
|
113 | 113 | return; |
114 | 114 | } |
115 | 115 | |
116 | 116 | $tokens = $phpcsFile->getTokens(); |
117 | 117 | |
118 | - if (isset($tokens[$stackPtr]['scope_closer']) === false) { |
|
118 | + if ( isset( $tokens[ $stackPtr ][ 'scope_closer' ] ) === false ) { |
|
119 | 119 | return; |
120 | 120 | } |
121 | 121 | |
122 | - $classScopeCloser = $tokens[$stackPtr]['scope_closer']; |
|
122 | + $classScopeCloser = $tokens[ $stackPtr ][ 'scope_closer' ]; |
|
123 | 123 | $functionPtr = $stackPtr; |
124 | 124 | |
125 | 125 | // Find all the functions in this class or interface. |
126 | - while (($functionToken = $phpcsFile->findNext(\T_FUNCTION, $functionPtr, $classScopeCloser)) !== false) { |
|
126 | + while ( ( $functionToken = $phpcsFile->findNext( \T_FUNCTION, $functionPtr, $classScopeCloser ) ) !== false ) { |
|
127 | 127 | /* |
128 | 128 | * Get the scope closer for this function in order to know how |
129 | 129 | * to advance to the next function. |
130 | 130 | * If no body of function (e.g. for interfaces), there is |
131 | 131 | * no closing curly brace; advance the pointer differently. |
132 | 132 | */ |
133 | - if (isset($tokens[$functionToken]['scope_closer'])) { |
|
134 | - $scopeCloser = $tokens[$functionToken]['scope_closer']; |
|
133 | + if ( isset( $tokens[ $functionToken ][ 'scope_closer' ] ) ) { |
|
134 | + $scopeCloser = $tokens[ $functionToken ][ 'scope_closer' ]; |
|
135 | 135 | } else { |
136 | - $scopeCloser = ($functionToken + 1); |
|
136 | + $scopeCloser = ( $functionToken + 1 ); |
|
137 | 137 | } |
138 | 138 | |
139 | - $methodName = $phpcsFile->getDeclarationName($functionToken); |
|
140 | - $methodNameLc = strtolower($methodName); |
|
141 | - if (isset($this->magicMethods[$methodNameLc]) === false) { |
|
139 | + $methodName = $phpcsFile->getDeclarationName( $functionToken ); |
|
140 | + $methodNameLc = strtolower( $methodName ); |
|
141 | + if ( isset( $this->magicMethods[ $methodNameLc ] ) === false ) { |
|
142 | 142 | $functionPtr = $scopeCloser; |
143 | 143 | continue; |
144 | 144 | } |
145 | 145 | |
146 | - $methodProperties = $phpcsFile->getMethodProperties($functionToken); |
|
147 | - $errorCodeBase = $this->stringToErrorCode($methodNameLc); |
|
146 | + $methodProperties = $phpcsFile->getMethodProperties( $functionToken ); |
|
147 | + $errorCodeBase = $this->stringToErrorCode( $methodNameLc ); |
|
148 | 148 | |
149 | - if (isset($this->magicMethods[$methodNameLc]['visibility']) && $this->magicMethods[$methodNameLc]['visibility'] !== $methodProperties['scope']) { |
|
149 | + if ( isset( $this->magicMethods[ $methodNameLc ][ 'visibility' ] ) && $this->magicMethods[ $methodNameLc ][ 'visibility' ] !== $methodProperties[ 'scope' ] ) { |
|
150 | 150 | $error = 'Visibility for magic method %s must be %s. Found: %s'; |
151 | 151 | $errorCode = $errorCodeBase . 'MethodVisibility'; |
152 | 152 | $data = array( |
153 | 153 | $methodName, |
154 | - $this->magicMethods[$methodNameLc]['visibility'], |
|
155 | - $methodProperties['scope'], |
|
154 | + $this->magicMethods[ $methodNameLc ][ 'visibility' ], |
|
155 | + $methodProperties[ 'scope' ], |
|
156 | 156 | ); |
157 | 157 | |
158 | - $phpcsFile->addError($error, $functionToken, $errorCode, $data); |
|
158 | + $phpcsFile->addError( $error, $functionToken, $errorCode, $data ); |
|
159 | 159 | } |
160 | 160 | |
161 | - if (isset($this->magicMethods[$methodNameLc]['static']) && $this->magicMethods[$methodNameLc]['static'] !== $methodProperties['is_static']) { |
|
161 | + if ( isset( $this->magicMethods[ $methodNameLc ][ 'static' ] ) && $this->magicMethods[ $methodNameLc ][ 'static' ] !== $methodProperties[ 'is_static' ] ) { |
|
162 | 162 | $error = 'Magic method %s cannot be defined as static.'; |
163 | 163 | $errorCode = $errorCodeBase . 'MethodStatic'; |
164 | - $data = array($methodName); |
|
164 | + $data = array( $methodName ); |
|
165 | 165 | |
166 | - if ($this->magicMethods[$methodNameLc]['static'] === true) { |
|
166 | + if ( $this->magicMethods[ $methodNameLc ][ 'static' ] === true ) { |
|
167 | 167 | $error = 'Magic method %s must be defined as static.'; |
168 | 168 | $errorCode = $errorCodeBase . 'MethodNonStatic'; |
169 | 169 | } |
170 | 170 | |
171 | - $phpcsFile->addError($error, $functionToken, $errorCode, $data); |
|
171 | + $phpcsFile->addError( $error, $functionToken, $errorCode, $data ); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | // Advance to next function. |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | public function register() |
191 | 191 | { |
192 | 192 | // Handle case-insensitivity of function names. |
193 | - $this->removedExtensions = $this->arrayKeysToLowercase($this->removedExtensions); |
|
193 | + $this->removedExtensions = $this->arrayKeysToLowercase( $this->removedExtensions ); |
|
194 | 194 | |
195 | - return array(\T_STRING); |
|
195 | + return array( \T_STRING ); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -204,56 +204,56 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @return void |
206 | 206 | */ |
207 | - public function process(File $phpcsFile, $stackPtr) |
|
207 | + public function process( File $phpcsFile, $stackPtr ) |
|
208 | 208 | { |
209 | 209 | $tokens = $phpcsFile->getTokens(); |
210 | 210 | |
211 | 211 | // Find the next non-empty token. |
212 | - $openBracket = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); |
|
212 | + $openBracket = $phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true ); |
|
213 | 213 | |
214 | - if ($tokens[$openBracket]['code'] !== \T_OPEN_PARENTHESIS) { |
|
214 | + if ( $tokens[ $openBracket ][ 'code' ] !== \T_OPEN_PARENTHESIS ) { |
|
215 | 215 | // Not a function call. |
216 | 216 | return; |
217 | 217 | } |
218 | 218 | |
219 | - if (isset($tokens[$openBracket]['parenthesis_closer']) === false) { |
|
219 | + if ( isset( $tokens[ $openBracket ][ 'parenthesis_closer' ] ) === false ) { |
|
220 | 220 | // Not a function call. |
221 | 221 | return; |
222 | 222 | } |
223 | 223 | |
224 | 224 | // Find the previous non-empty token. |
225 | 225 | $search = Tokens::$emptyTokens; |
226 | - $search[] = \T_BITWISE_AND; |
|
227 | - $previous = $phpcsFile->findPrevious($search, ($stackPtr - 1), null, true); |
|
228 | - if ($tokens[$previous]['code'] === \T_FUNCTION) { |
|
226 | + $search[ ] = \T_BITWISE_AND; |
|
227 | + $previous = $phpcsFile->findPrevious( $search, ( $stackPtr - 1 ), null, true ); |
|
228 | + if ( $tokens[ $previous ][ 'code' ] === \T_FUNCTION ) { |
|
229 | 229 | // It's a function definition, not a function call. |
230 | 230 | return; |
231 | 231 | } |
232 | 232 | |
233 | - if ($tokens[$previous]['code'] === \T_NEW) { |
|
233 | + if ( $tokens[ $previous ][ 'code' ] === \T_NEW ) { |
|
234 | 234 | // We are creating an object, not calling a function. |
235 | 235 | return; |
236 | 236 | } |
237 | 237 | |
238 | - if ($tokens[$previous]['code'] === \T_OBJECT_OPERATOR) { |
|
238 | + if ( $tokens[ $previous ][ 'code' ] === \T_OBJECT_OPERATOR ) { |
|
239 | 239 | // We are calling a method of an object. |
240 | 240 | return; |
241 | 241 | } |
242 | 242 | |
243 | - $function = $tokens[$stackPtr]['content']; |
|
244 | - $functionLc = strtolower($function); |
|
243 | + $function = $tokens[ $stackPtr ][ 'content' ]; |
|
244 | + $functionLc = strtolower( $function ); |
|
245 | 245 | |
246 | - if ($this->isWhiteListed($functionLc) === true) { |
|
246 | + if ( $this->isWhiteListed( $functionLc ) === true ) { |
|
247 | 247 | // Function is whitelisted. |
248 | 248 | return; |
249 | 249 | } |
250 | 250 | |
251 | - foreach ($this->removedExtensions as $extension => $versionList) { |
|
252 | - if (strpos($functionLc, $extension) === 0) { |
|
251 | + foreach ( $this->removedExtensions as $extension => $versionList ) { |
|
252 | + if ( strpos( $functionLc, $extension ) === 0 ) { |
|
253 | 253 | $itemInfo = array( |
254 | 254 | 'name' => $extension, |
255 | 255 | ); |
256 | - $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); |
|
256 | + $this->handleFeature( $phpcsFile, $stackPtr, $itemInfo ); |
|
257 | 257 | break; |
258 | 258 | } |
259 | 259 | } |
@@ -269,23 +269,23 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return bool |
271 | 271 | */ |
272 | - protected function isWhiteListed($content) |
|
272 | + protected function isWhiteListed( $content ) |
|
273 | 273 | { |
274 | - if (isset($this->functionWhitelist) === false) { |
|
274 | + if ( isset( $this->functionWhitelist ) === false ) { |
|
275 | 275 | return false; |
276 | 276 | } |
277 | 277 | |
278 | - if (\is_string($this->functionWhitelist) === true) { |
|
279 | - if (strpos($this->functionWhitelist, ',') !== false) { |
|
280 | - $this->functionWhitelist = explode(',', $this->functionWhitelist); |
|
278 | + if ( \is_string( $this->functionWhitelist ) === true ) { |
|
279 | + if ( strpos( $this->functionWhitelist, ',' ) !== false ) { |
|
280 | + $this->functionWhitelist = explode( ',', $this->functionWhitelist ); |
|
281 | 281 | } else { |
282 | - $this->functionWhitelist = (array) $this->functionWhitelist; |
|
282 | + $this->functionWhitelist = (array)$this->functionWhitelist; |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | |
286 | - if (\is_array($this->functionWhitelist) === true) { |
|
287 | - $this->functionWhitelist = array_map('strtolower', $this->functionWhitelist); |
|
288 | - return \in_array($content, $this->functionWhitelist, true); |
|
286 | + if ( \is_array( $this->functionWhitelist ) === true ) { |
|
287 | + $this->functionWhitelist = array_map( 'strtolower', $this->functionWhitelist ); |
|
288 | + return \in_array( $content, $this->functionWhitelist, true ); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | return false; |
@@ -299,9 +299,9 @@ discard block |
||
299 | 299 | * |
300 | 300 | * @return array Version and other information about the item. |
301 | 301 | */ |
302 | - public function getItemArray(array $itemInfo) |
|
302 | + public function getItemArray( array $itemInfo ) |
|
303 | 303 | { |
304 | - return $this->removedExtensions[$itemInfo['name']]; |
|
304 | + return $this->removedExtensions[ $itemInfo[ 'name' ] ]; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function register() |
35 | 35 | { |
36 | - if (\defined('T_OPEN_USE_GROUP')) { |
|
37 | - return array(\T_OPEN_USE_GROUP); |
|
36 | + if ( \defined( 'T_OPEN_USE_GROUP' ) ) { |
|
37 | + return array( \T_OPEN_USE_GROUP ); |
|
38 | 38 | } else { |
39 | - return array(\T_USE); |
|
39 | + return array( \T_USE ); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
@@ -50,24 +50,24 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return void |
52 | 52 | */ |
53 | - public function process(File $phpcsFile, $stackPtr) |
|
53 | + public function process( File $phpcsFile, $stackPtr ) |
|
54 | 54 | { |
55 | - if ($this->supportsBelow('7.1') === false) { |
|
55 | + if ( $this->supportsBelow( '7.1' ) === false ) { |
|
56 | 56 | return; |
57 | 57 | } |
58 | 58 | |
59 | 59 | $tokens = $phpcsFile->getTokens(); |
60 | - $token = $tokens[$stackPtr]; |
|
60 | + $token = $tokens[ $stackPtr ]; |
|
61 | 61 | |
62 | 62 | // Deal with PHPCS pre-2.6.0. |
63 | - if ($token['code'] === \T_USE) { |
|
64 | - $hasCurlyBrace = $phpcsFile->findNext(\T_OPEN_CURLY_BRACKET, ($stackPtr + 1), null, false, null, true); |
|
65 | - if ($hasCurlyBrace === false) { |
|
63 | + if ( $token[ 'code' ] === \T_USE ) { |
|
64 | + $hasCurlyBrace = $phpcsFile->findNext( \T_OPEN_CURLY_BRACKET, ( $stackPtr + 1 ), null, false, null, true ); |
|
65 | + if ( $hasCurlyBrace === false ) { |
|
66 | 66 | return; |
67 | 67 | } |
68 | 68 | |
69 | - $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($hasCurlyBrace - 1), null, true); |
|
70 | - if ($prevToken === false || $tokens[$prevToken]['code'] !== \T_NS_SEPARATOR) { |
|
69 | + $prevToken = $phpcsFile->findPrevious( Tokens::$emptyTokens, ( $hasCurlyBrace - 1 ), null, true ); |
|
70 | + if ( $prevToken === false || $tokens[ $prevToken ][ 'code' ] !== \T_NS_SEPARATOR ) { |
|
71 | 71 | return; |
72 | 72 | } |
73 | 73 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | // Still here ? In that case, it is a group use statement. |
78 | - if ($this->supportsBelow('5.6') === true) { |
|
78 | + if ( $this->supportsBelow( '5.6' ) === true ) { |
|
79 | 79 | $phpcsFile->addError( |
80 | 80 | 'Group use declarations are not allowed in PHP 5.6 or earlier', |
81 | 81 | $stackPtr, |
@@ -83,18 +83,18 @@ discard block |
||
83 | 83 | ); |
84 | 84 | } |
85 | 85 | |
86 | - $closers = array(\T_CLOSE_CURLY_BRACKET); |
|
87 | - if (\defined('T_CLOSE_USE_GROUP')) { |
|
88 | - $closers[] = \T_CLOSE_USE_GROUP; |
|
86 | + $closers = array( \T_CLOSE_CURLY_BRACKET ); |
|
87 | + if ( \defined( 'T_CLOSE_USE_GROUP' ) ) { |
|
88 | + $closers[ ] = \T_CLOSE_USE_GROUP; |
|
89 | 89 | } |
90 | 90 | |
91 | - $closeCurly = $phpcsFile->findNext($closers, ($stackPtr + 1), null, false, null, true); |
|
92 | - if ($closeCurly === false) { |
|
91 | + $closeCurly = $phpcsFile->findNext( $closers, ( $stackPtr + 1 ), null, false, null, true ); |
|
92 | + if ( $closeCurly === false ) { |
|
93 | 93 | return; |
94 | 94 | } |
95 | 95 | |
96 | - $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($closeCurly - 1), null, true); |
|
97 | - if ($tokens[$prevToken]['code'] === \T_COMMA) { |
|
96 | + $prevToken = $phpcsFile->findPrevious( Tokens::$emptyTokens, ( $closeCurly - 1 ), null, true ); |
|
97 | + if ( $tokens[ $prevToken ][ 'code' ] === \T_COMMA ) { |
|
98 | 98 | $phpcsFile->addError( |
99 | 99 | 'Trailing comma\'s are not allowed in group use statements in PHP 7.1 or earlier', |
100 | 100 | $prevToken, |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function register() |
50 | 50 | { |
51 | - return array(\T_USE); |
|
51 | + return array( \T_USE ); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -61,31 +61,31 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return void |
63 | 63 | */ |
64 | - public function process(File $phpcsFile, $stackPtr) |
|
64 | + public function process( File $phpcsFile, $stackPtr ) |
|
65 | 65 | { |
66 | - if ($this->supportsBelow('5.5') !== true) { |
|
66 | + if ( $this->supportsBelow( '5.5' ) !== true ) { |
|
67 | 67 | return; |
68 | 68 | } |
69 | 69 | |
70 | 70 | $tokens = $phpcsFile->getTokens(); |
71 | 71 | |
72 | - $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); |
|
73 | - if ($nextNonEmpty === false) { |
|
72 | + $nextNonEmpty = $phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true ); |
|
73 | + if ( $nextNonEmpty === false ) { |
|
74 | 74 | // Live coding. |
75 | 75 | return; |
76 | 76 | } |
77 | 77 | |
78 | - if (isset($this->validUseNames[strtolower($tokens[$nextNonEmpty]['content'])]) === false) { |
|
78 | + if ( isset( $this->validUseNames[ strtolower( $tokens[ $nextNonEmpty ][ 'content' ] ) ] ) === false ) { |
|
79 | 79 | // Not a `use const` or `use function` statement. |
80 | 80 | return; |
81 | 81 | } |
82 | 82 | |
83 | 83 | // `use const` and `use function` have to be followed by the function/constant name. |
84 | - $functionOrConstName = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonEmpty + 1), null, true); |
|
85 | - if ($functionOrConstName === false |
|
84 | + $functionOrConstName = $phpcsFile->findNext( Tokens::$emptyTokens, ( $nextNonEmpty + 1 ), null, true ); |
|
85 | + if ( $functionOrConstName === false |
|
86 | 86 | // Identifies as T_AS or T_STRING, this covers both. |
87 | - || ($tokens[$functionOrConstName]['content'] === 'as' |
|
88 | - || $tokens[$functionOrConstName]['code'] === \T_COMMA) |
|
87 | + || ( $tokens[ $functionOrConstName ][ 'content' ] === 'as' |
|
88 | + || $tokens[ $functionOrConstName ][ 'code' ] === \T_COMMA ) |
|
89 | 89 | ) { |
90 | 90 | // Live coding or incorrect use of reserved keyword, but that is |
91 | 91 | // covered by the ForbiddenNames sniff. |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | public function register() |
47 | 47 | { |
48 | 48 | $tokens = array(); |
49 | - foreach ($this->deprecatedTypeCasts as $token => $versions) { |
|
50 | - $tokens[] = constant($token); |
|
49 | + foreach ( $this->deprecatedTypeCasts as $token => $versions ) { |
|
50 | + $tokens[ ] = constant( $token ); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | return $tokens; |
@@ -63,16 +63,16 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return void |
65 | 65 | */ |
66 | - public function process(File $phpcsFile, $stackPtr) |
|
66 | + public function process( File $phpcsFile, $stackPtr ) |
|
67 | 67 | { |
68 | 68 | $tokens = $phpcsFile->getTokens(); |
69 | - $tokenType = $tokens[$stackPtr]['type']; |
|
69 | + $tokenType = $tokens[ $stackPtr ][ 'type' ]; |
|
70 | 70 | |
71 | 71 | $itemInfo = array( |
72 | 72 | 'name' => $tokenType, |
73 | - 'description' => $this->deprecatedTypeCasts[$tokenType]['description'], |
|
73 | + 'description' => $this->deprecatedTypeCasts[ $tokenType ][ 'description' ], |
|
74 | 74 | ); |
75 | - $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); |
|
75 | + $this->handleFeature( $phpcsFile, $stackPtr, $itemInfo ); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | protected function getNonVersionArrayKeys() |
85 | 85 | { |
86 | - return array('description', 'alternative'); |
|
86 | + return array( 'description', 'alternative' ); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @return array Version and other information about the item. |
95 | 95 | */ |
96 | - public function getItemArray(array $itemInfo) |
|
96 | + public function getItemArray( array $itemInfo ) |
|
97 | 97 | { |
98 | - return $this->deprecatedTypeCasts[$itemInfo['name']]; |
|
98 | + return $this->deprecatedTypeCasts[ $itemInfo[ 'name' ] ]; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @return array |
121 | 121 | */ |
122 | - protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) |
|
122 | + protected function filterErrorData( array $data, array $itemInfo, array $errorInfo ) |
|
123 | 123 | { |
124 | - $data[0] = $itemInfo['description']; |
|
124 | + $data[ 0 ] = $itemInfo[ 'description' ]; |
|
125 | 125 | return $data; |
126 | 126 | } |
127 | 127 | } |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | public function register() |
54 | 54 | { |
55 | 55 | $tokens = array(); |
56 | - foreach ($this->newTypeCasts as $token => $versions) { |
|
57 | - if (\defined($token)) { |
|
58 | - $tokens[] = constant($token); |
|
56 | + foreach ( $this->newTypeCasts as $token => $versions ) { |
|
57 | + if ( \defined( $token ) ) { |
|
58 | + $tokens[ ] = constant( $token ); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @link https://github.com/squizlabs/PHP_CodeSniffer/issues/1574 |
70 | 70 | */ |
71 | - if (version_compare(PHPCSHelper::getVersion(), '3.4.0', '<') === true) { |
|
72 | - $tokens[] = \T_STRING_CAST; |
|
73 | - $tokens[] = \T_CONSTANT_ENCAPSED_STRING; |
|
71 | + if ( version_compare( PHPCSHelper::getVersion(), '3.4.0', '<' ) === true ) { |
|
72 | + $tokens[ ] = \T_STRING_CAST; |
|
73 | + $tokens[ ] = \T_CONSTANT_ENCAPSED_STRING; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | return $tokens; |
@@ -86,17 +86,17 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return void |
88 | 88 | */ |
89 | - public function process(File $phpcsFile, $stackPtr) |
|
89 | + public function process( File $phpcsFile, $stackPtr ) |
|
90 | 90 | { |
91 | 91 | $tokens = $phpcsFile->getTokens(); |
92 | - $tokenType = $tokens[$stackPtr]['type']; |
|
92 | + $tokenType = $tokens[ $stackPtr ][ 'type' ]; |
|
93 | 93 | |
94 | 94 | // Detect incorrectly tokenized binary casts. |
95 | - if (isset($this->newTypeCasts[$tokenType]) === false) { |
|
96 | - $tokenContent = $tokens[$stackPtr]['content']; |
|
97 | - switch ($tokenType) { |
|
95 | + if ( isset( $this->newTypeCasts[ $tokenType ] ) === false ) { |
|
96 | + $tokenContent = $tokens[ $stackPtr ][ 'content' ]; |
|
97 | + switch ( $tokenType ) { |
|
98 | 98 | case 'T_STRING_CAST': |
99 | - if (preg_match('`^\(\s*binary\s*\)$`i', $tokenContent) !== 1) { |
|
99 | + if ( preg_match( '`^\(\s*binary\s*\)$`i', $tokenContent ) !== 1 ) { |
|
100 | 100 | return; |
101 | 101 | } |
102 | 102 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | break; |
105 | 105 | |
106 | 106 | case 'T_CONSTANT_ENCAPSED_STRING': |
107 | - if ((strpos($tokenContent, 'b"') === 0 && substr($tokenContent, -1) === '"') |
|
108 | - || (strpos($tokenContent, "b'") === 0 && substr($tokenContent, -1) === "'") |
|
107 | + if ( ( strpos( $tokenContent, 'b"' ) === 0 && substr( $tokenContent, -1 ) === '"' ) |
|
108 | + || ( strpos( $tokenContent, "b'" ) === 0 && substr( $tokenContent, -1 ) === "'" ) |
|
109 | 109 | ) { |
110 | 110 | $tokenType = 'T_BINARY_CAST'; |
111 | 111 | } else { |
@@ -117,15 +117,15 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | // If the translation did not yield one of the tokens we are looking for, bow out. |
120 | - if (isset($this->newTypeCasts[$tokenType]) === false) { |
|
120 | + if ( isset( $this->newTypeCasts[ $tokenType ] ) === false ) { |
|
121 | 121 | return; |
122 | 122 | } |
123 | 123 | |
124 | 124 | $itemInfo = array( |
125 | 125 | 'name' => $tokenType, |
126 | - 'content' => $tokens[$stackPtr]['content'], |
|
126 | + 'content' => $tokens[ $stackPtr ][ 'content' ], |
|
127 | 127 | ); |
128 | - $this->handleFeature($phpcsFile, $stackPtr, $itemInfo); |
|
128 | + $this->handleFeature( $phpcsFile, $stackPtr, $itemInfo ); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return array Version and other information about the item. |
138 | 138 | */ |
139 | - public function getItemArray(array $itemInfo) |
|
139 | + public function getItemArray( array $itemInfo ) |
|
140 | 140 | { |
141 | - return $this->newTypeCasts[$itemInfo['name']]; |
|
141 | + return $this->newTypeCasts[ $itemInfo[ 'name' ] ]; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | protected function getNonVersionArrayKeys() |
151 | 151 | { |
152 | - return array('description'); |
|
152 | + return array( 'description' ); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return array |
163 | 163 | */ |
164 | - public function getErrorInfo(array $itemArray, array $itemInfo) |
|
164 | + public function getErrorInfo( array $itemArray, array $itemInfo ) |
|
165 | 165 | { |
166 | - $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); |
|
167 | - $errorInfo['description'] = $itemArray['description']; |
|
166 | + $errorInfo = parent::getErrorInfo( $itemArray, $itemInfo ); |
|
167 | + $errorInfo[ 'description' ] = $itemArray[ 'description' ]; |
|
168 | 168 | |
169 | 169 | return $errorInfo; |
170 | 170 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @return string |
181 | 181 | */ |
182 | - protected function filterErrorMsg($error, array $itemInfo, array $errorInfo) |
|
182 | + protected function filterErrorMsg( $error, array $itemInfo, array $errorInfo ) |
|
183 | 183 | { |
184 | 184 | return $error . '. Found: %s'; |
185 | 185 | } |
@@ -194,10 +194,10 @@ discard block |
||
194 | 194 | * |
195 | 195 | * @return array |
196 | 196 | */ |
197 | - protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) |
|
197 | + protected function filterErrorData( array $data, array $itemInfo, array $errorInfo ) |
|
198 | 198 | { |
199 | - $data[0] = $errorInfo['description']; |
|
200 | - $data[] = $itemInfo['content']; |
|
199 | + $data[ 0 ] = $errorInfo[ 'description' ]; |
|
200 | + $data[ ] = $itemInfo[ 'content' ]; |
|
201 | 201 | return $data; |
202 | 202 | } |
203 | 203 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | */ |
290 | 290 | public function register() |
291 | 291 | { |
292 | - return array(\T_STRING); |
|
292 | + return array( \T_STRING ); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @return void |
303 | 303 | */ |
304 | - public function process(File $phpcsFile, $stackPtr) |
|
304 | + public function process( File $phpcsFile, $stackPtr ) |
|
305 | 305 | { |
306 | 306 | $tokens = $phpcsFile->getTokens(); |
307 | 307 | |
@@ -312,24 +312,24 @@ discard block |
||
312 | 312 | \T_CONST => true, |
313 | 313 | ); |
314 | 314 | |
315 | - $prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true); |
|
316 | - if (isset($ignore[$tokens[$prevToken]['code']]) === true) { |
|
315 | + $prevToken = $phpcsFile->findPrevious( \T_WHITESPACE, ( $stackPtr - 1 ), null, true ); |
|
316 | + if ( isset( $ignore[ $tokens[ $prevToken ][ 'code' ] ] ) === true ) { |
|
317 | 317 | // Not a call to a PHP function. |
318 | 318 | return; |
319 | 319 | } |
320 | 320 | |
321 | - $functionLc = strtolower($tokens[$stackPtr]['content']); |
|
322 | - if (isset($this->iniFunctions[$functionLc]) === false) { |
|
321 | + $functionLc = strtolower( $tokens[ $stackPtr ][ 'content' ] ); |
|
322 | + if ( isset( $this->iniFunctions[ $functionLc ] ) === false ) { |
|
323 | 323 | return; |
324 | 324 | } |
325 | 325 | |
326 | - $iniToken = $this->getFunctionCallParameter($phpcsFile, $stackPtr, $this->iniFunctions[$functionLc]); |
|
327 | - if ($iniToken === false) { |
|
326 | + $iniToken = $this->getFunctionCallParameter( $phpcsFile, $stackPtr, $this->iniFunctions[ $functionLc ] ); |
|
327 | + if ( $iniToken === false ) { |
|
328 | 328 | return; |
329 | 329 | } |
330 | 330 | |
331 | - $filteredToken = $this->stripQuotes($iniToken['raw']); |
|
332 | - if (isset($this->deprecatedIniDirectives[$filteredToken]) === false) { |
|
331 | + $filteredToken = $this->stripQuotes( $iniToken[ 'raw' ] ); |
|
332 | + if ( isset( $this->deprecatedIniDirectives[ $filteredToken ] ) === false ) { |
|
333 | 333 | return; |
334 | 334 | } |
335 | 335 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | 'name' => $filteredToken, |
338 | 338 | 'functionLc' => $functionLc, |
339 | 339 | ); |
340 | - $this->handleFeature($phpcsFile, $iniToken['end'], $itemInfo); |
|
340 | + $this->handleFeature( $phpcsFile, $iniToken[ 'end' ], $itemInfo ); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | |
@@ -348,9 +348,9 @@ discard block |
||
348 | 348 | * |
349 | 349 | * @return array Version and other information about the item. |
350 | 350 | */ |
351 | - public function getItemArray(array $itemInfo) |
|
351 | + public function getItemArray( array $itemInfo ) |
|
352 | 352 | { |
353 | - return $this->deprecatedIniDirectives[$itemInfo['name']]; |
|
353 | + return $this->deprecatedIniDirectives[ $itemInfo[ 'name' ] ]; |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | |
@@ -362,13 +362,13 @@ discard block |
||
362 | 362 | * |
363 | 363 | * @return array |
364 | 364 | */ |
365 | - public function getErrorInfo(array $itemArray, array $itemInfo) |
|
365 | + public function getErrorInfo( array $itemArray, array $itemInfo ) |
|
366 | 366 | { |
367 | - $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); |
|
367 | + $errorInfo = parent::getErrorInfo( $itemArray, $itemInfo ); |
|
368 | 368 | |
369 | 369 | // Lower error level to warning if the function used was ini_get. |
370 | - if ($errorInfo['error'] === true && $itemInfo['functionLc'] === 'ini_get') { |
|
371 | - $errorInfo['error'] = false; |
|
370 | + if ( $errorInfo[ 'error' ] === true && $itemInfo[ 'functionLc' ] === 'ini_get' ) { |
|
371 | + $errorInfo[ 'error' ] = false; |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | return $errorInfo; |
@@ -393,6 +393,6 @@ discard block |
||
393 | 393 | */ |
394 | 394 | protected function getAlternativeOptionTemplate() |
395 | 395 | { |
396 | - return str_replace("%s", "'%s'", parent::getAlternativeOptionTemplate()); |
|
396 | + return str_replace( "%s", "'%s'", parent::getAlternativeOptionTemplate() ); |
|
397 | 397 | } |
398 | 398 | } |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | */ |
512 | 512 | public function register() |
513 | 513 | { |
514 | - return array(\T_STRING); |
|
514 | + return array( \T_STRING ); |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | /** |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | * |
524 | 524 | * @return void |
525 | 525 | */ |
526 | - public function process(File $phpcsFile, $stackPtr) |
|
526 | + public function process( File $phpcsFile, $stackPtr ) |
|
527 | 527 | { |
528 | 528 | $tokens = $phpcsFile->getTokens(); |
529 | 529 | |
@@ -534,24 +534,24 @@ discard block |
||
534 | 534 | \T_CONST => true, |
535 | 535 | ); |
536 | 536 | |
537 | - $prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true); |
|
538 | - if (isset($ignore[$tokens[$prevToken]['code']]) === true) { |
|
537 | + $prevToken = $phpcsFile->findPrevious( \T_WHITESPACE, ( $stackPtr - 1 ), null, true ); |
|
538 | + if ( isset( $ignore[ $tokens[ $prevToken ][ 'code' ] ] ) === true ) { |
|
539 | 539 | // Not a call to a PHP function. |
540 | 540 | return; |
541 | 541 | } |
542 | 542 | |
543 | - $functionLc = strtolower($tokens[$stackPtr]['content']); |
|
544 | - if (isset($this->iniFunctions[$functionLc]) === false) { |
|
543 | + $functionLc = strtolower( $tokens[ $stackPtr ][ 'content' ] ); |
|
544 | + if ( isset( $this->iniFunctions[ $functionLc ] ) === false ) { |
|
545 | 545 | return; |
546 | 546 | } |
547 | 547 | |
548 | - $iniToken = $this->getFunctionCallParameter($phpcsFile, $stackPtr, $this->iniFunctions[$functionLc]); |
|
549 | - if ($iniToken === false) { |
|
548 | + $iniToken = $this->getFunctionCallParameter( $phpcsFile, $stackPtr, $this->iniFunctions[ $functionLc ] ); |
|
549 | + if ( $iniToken === false ) { |
|
550 | 550 | return; |
551 | 551 | } |
552 | 552 | |
553 | - $filteredToken = $this->stripQuotes($iniToken['raw']); |
|
554 | - if (isset($this->newIniDirectives[$filteredToken]) === false) { |
|
553 | + $filteredToken = $this->stripQuotes( $iniToken[ 'raw' ] ); |
|
554 | + if ( isset( $this->newIniDirectives[ $filteredToken ] ) === false ) { |
|
555 | 555 | return; |
556 | 556 | } |
557 | 557 | |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | 'name' => $filteredToken, |
560 | 560 | 'functionLc' => $functionLc, |
561 | 561 | ); |
562 | - $this->handleFeature($phpcsFile, $iniToken['end'], $itemInfo); |
|
562 | + $this->handleFeature( $phpcsFile, $iniToken[ 'end' ], $itemInfo ); |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | |
@@ -570,9 +570,9 @@ discard block |
||
570 | 570 | * |
571 | 571 | * @return array Version and other information about the item. |
572 | 572 | */ |
573 | - public function getItemArray(array $itemInfo) |
|
573 | + public function getItemArray( array $itemInfo ) |
|
574 | 574 | { |
575 | - return $this->newIniDirectives[$itemInfo['name']]; |
|
575 | + return $this->newIniDirectives[ $itemInfo[ 'name' ] ]; |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | */ |
584 | 584 | protected function getNonVersionArrayKeys() |
585 | 585 | { |
586 | - return array('alternative'); |
|
586 | + return array( 'alternative' ); |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | |
@@ -595,18 +595,18 @@ discard block |
||
595 | 595 | * |
596 | 596 | * @return array |
597 | 597 | */ |
598 | - public function getErrorInfo(array $itemArray, array $itemInfo) |
|
598 | + public function getErrorInfo( array $itemArray, array $itemInfo ) |
|
599 | 599 | { |
600 | - $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); |
|
601 | - $errorInfo['alternative'] = ''; |
|
600 | + $errorInfo = parent::getErrorInfo( $itemArray, $itemInfo ); |
|
601 | + $errorInfo[ 'alternative' ] = ''; |
|
602 | 602 | |
603 | - if (isset($itemArray['alternative']) === true) { |
|
604 | - $errorInfo['alternative'] = $itemArray['alternative']; |
|
603 | + if ( isset( $itemArray[ 'alternative' ] ) === true ) { |
|
604 | + $errorInfo[ 'alternative' ] = $itemArray[ 'alternative' ]; |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | // Lower error level to warning if the function used was ini_get. |
608 | - if ($errorInfo['error'] === true && $itemInfo['functionLc'] === 'ini_get') { |
|
609 | - $errorInfo['error'] = false; |
|
608 | + if ( $errorInfo[ 'error' ] === true && $itemInfo[ 'functionLc' ] === 'ini_get' ) { |
|
609 | + $errorInfo[ 'error' ] = false; |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | return $errorInfo; |
@@ -633,9 +633,9 @@ discard block |
||
633 | 633 | * |
634 | 634 | * @return string |
635 | 635 | */ |
636 | - protected function filterErrorMsg($error, array $itemInfo, array $errorInfo) |
|
636 | + protected function filterErrorMsg( $error, array $itemInfo, array $errorInfo ) |
|
637 | 637 | { |
638 | - if ($errorInfo['alternative'] !== '') { |
|
638 | + if ( $errorInfo[ 'alternative' ] !== '' ) { |
|
639 | 639 | $error .= ". This directive was previously called '%s'."; |
640 | 640 | } |
641 | 641 | |
@@ -652,10 +652,10 @@ discard block |
||
652 | 652 | * |
653 | 653 | * @return array |
654 | 654 | */ |
655 | - protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) |
|
655 | + protected function filterErrorData( array $data, array $itemInfo, array $errorInfo ) |
|
656 | 656 | { |
657 | - if ($errorInfo['alternative'] !== '') { |
|
658 | - $data[] = $errorInfo['alternative']; |
|
657 | + if ( $errorInfo[ 'alternative' ] !== '' ) { |
|
658 | + $data[ ] = $errorInfo[ 'alternative' ]; |
|
659 | 659 | } |
660 | 660 | |
661 | 661 | return $data; |