@@ -80,10 +80,10 @@ |
||
80 | 80 | |
81 | 81 | // Ignore function calls. |
82 | 82 | $ignore = array( |
83 | - T_STRING, |
|
84 | - T_WHITESPACE, |
|
85 | - T_OBJECT_OPERATOR, |
|
86 | - ); |
|
83 | + T_STRING, |
|
84 | + T_WHITESPACE, |
|
85 | + T_OBJECT_OPERATOR, |
|
86 | + ); |
|
87 | 87 | |
88 | 88 | $next = $phpcsFile->findNext($ignore, ($stackPtr + 1), null, true); |
89 | 89 | if ($tokens[$next]['code'] === T_OPEN_PARENTHESIS |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | * @var array |
37 | 37 | */ |
38 | 38 | public $supportedTokenizers = array( |
39 | - 'PHP', |
|
40 | - 'CSS', |
|
41 | - ); |
|
39 | + 'PHP', |
|
40 | + 'CSS', |
|
41 | + ); |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * If a comment is more than $maxPercentage% code, a warning will be shown. |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | T_ENCAPSED_AND_WHITESPACE => true, |
159 | 159 | T_NONE => true, |
160 | 160 | T_COMMENT => true, |
161 | - ); |
|
161 | + ); |
|
162 | 162 | |
163 | 163 | $numTokens = count($stringTokens); |
164 | 164 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * Returns an array of tokens this test wants to listen for. |
28 | 28 | * |
29 | - * @return array |
|
29 | + * @return integer[] |
|
30 | 30 | */ |
31 | 31 | public function register() |
32 | 32 | { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | /** |
39 | 39 | * Processes this sniff when one of its tokens is encountered. |
40 | 40 | * |
41 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
41 | + * @param File $phpcsFile The file being scanned. |
|
42 | 42 | * @param int $stackPtr The position of the current token |
43 | 43 | * in the stack passed in $tokens. |
44 | 44 | * |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | * @var array |
35 | 35 | */ |
36 | 36 | public $supportedTokenizers = array( |
37 | - 'PHP', |
|
38 | - 'JS', |
|
39 | - ); |
|
37 | + 'PHP', |
|
38 | + 'JS', |
|
39 | + ); |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * An array of functions we don't want in the condition of loops. |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | * @return array |
45 | 45 | */ |
46 | 46 | protected $forbiddenFunctions = array( |
47 | - 'PHP' => array( |
|
48 | - 'sizeof' => true, |
|
49 | - 'strlen' => true, |
|
50 | - 'count' => true, |
|
51 | - ), |
|
52 | - 'JS' => array('length' => true), |
|
47 | + 'PHP' => array( |
|
48 | + 'sizeof' => true, |
|
49 | + 'strlen' => true, |
|
50 | + 'count' => true, |
|
51 | + ), |
|
52 | + 'JS' => array('length' => true), |
|
53 | 53 | ); |
54 | 54 | |
55 | 55 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | return array( |
64 | 64 | T_WHILE, |
65 | 65 | T_FOR, |
66 | - ); |
|
66 | + ); |
|
67 | 67 | |
68 | 68 | }//end register() |
69 | 69 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * Returns an array of tokens this test wants to listen for. |
28 | 28 | * |
29 | - * @return array |
|
29 | + * @return integer[] |
|
30 | 30 | */ |
31 | 31 | public function register() |
32 | 32 | { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | /** |
39 | 39 | * Processes this sniff when one of its tokens is encountered. |
40 | 40 | * |
41 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
41 | + * @param File $phpcsFile The file being scanned. |
|
42 | 42 | * @param int $stackPtr The position of the current token |
43 | 43 | * in the stack passed in $tokens. |
44 | 44 | * |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | return array( |
42 | 42 | T_CONSTANT_ENCAPSED_STRING, |
43 | 43 | T_DOUBLE_QUOTED_STRING, |
44 | - ); |
|
44 | + ); |
|
45 | 45 | |
46 | 46 | }//end register() |
47 | 47 | |
@@ -102,24 +102,24 @@ discard block |
||
102 | 102 | }//end if |
103 | 103 | |
104 | 104 | $allowedChars = array( |
105 | - '\0', |
|
106 | - '\1', |
|
107 | - '\2', |
|
108 | - '\3', |
|
109 | - '\4', |
|
110 | - '\5', |
|
111 | - '\6', |
|
112 | - '\7', |
|
113 | - '\n', |
|
114 | - '\r', |
|
115 | - '\f', |
|
116 | - '\t', |
|
117 | - '\v', |
|
118 | - '\x', |
|
119 | - '\b', |
|
120 | - '\e', |
|
121 | - '\u', |
|
122 | - '\'', |
|
105 | + '\0', |
|
106 | + '\1', |
|
107 | + '\2', |
|
108 | + '\3', |
|
109 | + '\4', |
|
110 | + '\5', |
|
111 | + '\6', |
|
112 | + '\7', |
|
113 | + '\n', |
|
114 | + '\r', |
|
115 | + '\f', |
|
116 | + '\t', |
|
117 | + '\v', |
|
118 | + '\x', |
|
119 | + '\b', |
|
120 | + '\e', |
|
121 | + '\u', |
|
122 | + '\'', |
|
123 | 123 | ); |
124 | 124 | |
125 | 125 | foreach ($allowedChars as $testChar) { |
@@ -62,13 +62,13 @@ |
||
62 | 62 | $prev = $phpcsFile->findPrevious($allowedTokens, ($stackPtr - 1), null, true); |
63 | 63 | |
64 | 64 | $allowedTokens = array( |
65 | - T_EQUAL => true, |
|
66 | - T_DOUBLE_ARROW => true, |
|
67 | - T_THROW => true, |
|
68 | - T_RETURN => true, |
|
69 | - T_INLINE_THEN => true, |
|
70 | - T_INLINE_ELSE => true, |
|
71 | - ); |
|
65 | + T_EQUAL => true, |
|
66 | + T_DOUBLE_ARROW => true, |
|
67 | + T_THROW => true, |
|
68 | + T_RETURN => true, |
|
69 | + T_INLINE_THEN => true, |
|
70 | + T_INLINE_ELSE => true, |
|
71 | + ); |
|
72 | 72 | |
73 | 73 | if (isset($allowedTokens[$tokens[$prev]['code']]) === false) { |
74 | 74 | $error = 'New objects must be assigned to a variable'; |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | |
64 | 64 | $properties = array(); |
65 | 65 | $wantedTokens = array( |
66 | - T_PROPERTY, |
|
67 | - T_OBJECT, |
|
66 | + T_PROPERTY, |
|
67 | + T_OBJECT, |
|
68 | 68 | ); |
69 | 69 | |
70 | 70 | $next = $phpcsFile->findNext($wantedTokens, ($stackPtr + 1), $tokens[$stackPtr]['bracket_closer']); |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | if (isset($properties[$propName]) === true) { |
78 | 78 | $error = 'Duplicate property definition found for "%s"; previously defined on line %s'; |
79 | 79 | $data = array( |
80 | - $propName, |
|
81 | - $tokens[$properties[$propName]]['line'], |
|
82 | - ); |
|
80 | + $propName, |
|
81 | + $tokens[$properties[$propName]]['line'], |
|
82 | + ); |
|
83 | 83 | $phpcsFile->addError($error, $next, 'Found', $data); |
84 | 84 | } |
85 | 85 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | return array( |
43 | 43 | T_CLASS, |
44 | 44 | T_INTERFACE, |
45 | - ); |
|
45 | + ); |
|
46 | 46 | |
47 | 47 | }//end register() |
48 | 48 | |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | if ($tokens[$decName]['content'] !== $fileName) { |
72 | 72 | $error = '%s name doesn\'t match filename; expected "%s %s"'; |
73 | 73 | $data = array( |
74 | - ucfirst($tokens[$stackPtr]['content']), |
|
75 | - $tokens[$stackPtr]['content'], |
|
76 | - $fileName, |
|
77 | - ); |
|
74 | + ucfirst($tokens[$stackPtr]['content']), |
|
75 | + $tokens[$stackPtr]['content'], |
|
76 | + $fileName, |
|
77 | + ); |
|
78 | 78 | $phpcsFile->addError($error, $stackPtr, 'NoMatch', $data); |
79 | 79 | } |
80 | 80 |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | $type = strtolower($tokens[$stackPtr]['content']); |
92 | 92 | $error = 'Expected 0 spaces before %s keyword; %s found'; |
93 | 93 | $data = array( |
94 | - $type, |
|
95 | - $spaces, |
|
96 | - ); |
|
94 | + $type, |
|
95 | + $spaces, |
|
96 | + ); |
|
97 | 97 | |
98 | 98 | $fix = $phpcsFile->addFixableError($error, $stackPtr, 'SpaceBeforeKeyword', $data); |
99 | 99 | if ($fix === true) { |
@@ -188,9 +188,9 @@ discard block |
||
188 | 188 | if ($difference !== -1 && $difference !== 1) { |
189 | 189 | $error = 'Closing brace of a %s must be followed by a single blank line; found %s'; |
190 | 190 | $data = array( |
191 | - $tokens[$stackPtr]['content'], |
|
192 | - $difference, |
|
193 | - ); |
|
191 | + $tokens[$stackPtr]['content'], |
|
192 | + $difference, |
|
193 | + ); |
|
194 | 194 | $fix = $phpcsFile->addFixableError($error, $closeBrace, 'NewlinesAfterCloseBrace', $data); |
195 | 195 | if ($fix === true) { |
196 | 196 | if ($difference === 0) { |
@@ -191,7 +191,7 @@ |
||
191 | 191 | $tokens[$stackPtr]['content'], |
192 | 192 | $difference, |
193 | 193 | ); |
194 | - $fix = $phpcsFile->addFixableError($error, $closeBrace, 'NewlinesAfterCloseBrace', $data); |
|
194 | + $fix = $phpcsFile->addFixableError($error, $closeBrace, 'NewlinesAfterCloseBrace', $data); |
|
195 | 195 | if ($fix === true) { |
196 | 196 | if ($difference === 0) { |
197 | 197 | $first = $phpcsFile->findFirstOnLine(array(), $nextContent, true); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | /** |
39 | 39 | * Processes this test, when one of its tokens is encountered. |
40 | 40 | * |
41 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
41 | + * @param File $phpcsFile The file being scanned. |
|
42 | 42 | * @param int $stackPtr The position of the current token |
43 | 43 | * in the stack passed in $tokens. |
44 | 44 | * |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | /** |
61 | 61 | * Checks to ensure increment and decrement operators are not confusing. |
62 | 62 | * |
63 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
63 | + * @param File $phpcsFile The file being scanned. |
|
64 | 64 | * @param int $stackPtr The position of the current token |
65 | 65 | * in the stack passed in $tokens. |
66 | 66 | * |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | /** |
107 | 107 | * Checks to ensure increment and decrement operators are used. |
108 | 108 | * |
109 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
109 | + * @param File $phpcsFile The file being scanned. |
|
110 | 110 | * @param int $stackPtr The position of the current token |
111 | 111 | * in the stack passed in $tokens. |
112 | 112 | * |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | T_PRIVATE, |
45 | 45 | T_PROTECTED, |
46 | 46 | T_STATIC, |
47 | - ); |
|
47 | + ); |
|
48 | 48 | |
49 | 49 | }//end register() |
50 | 50 | |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | if ($content !== strtolower($content)) { |
67 | 67 | $error = '%s keyword must be lowercase; expected "%s" but found "%s"'; |
68 | 68 | $data = array( |
69 | - strtoupper($content), |
|
70 | - strtolower($content), |
|
71 | - $content, |
|
72 | - ); |
|
69 | + strtoupper($content), |
|
70 | + strtolower($content), |
|
71 | + $content, |
|
72 | + ); |
|
73 | 73 | $phpcsFile->addError($error, $stackPtr, 'FoundUppercase', $data); |
74 | 74 | } |
75 | 75 |