Completed
Pull Request — develop (#1492)
by Zack
28:58 queued 09:00
created
PHPCompatibility/Sniffs/ControlStructures/NewExecutionDirectivesSniff.php 1 patch
Braces   +12 added lines, -24 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@  discard block
 block discarded – undo
21 21
  * @package  PHPCompatibility
22 22
  * @author   Juliette Reinders Folmer <[email protected]>
23 23
  */
24
-class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
25
-{
24
+class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff {
26 25
 
27 26
     /**
28 27
      * A list of new execution directives
@@ -66,8 +65,7 @@  discard block
 block discarded – undo
66 65
      *
67 66
      * @return array
68 67
      */
69
-    public function register()
70
-    {
68
+    public function register() {
71 69
         $this->ignoreTokens           = Tokens::$emptyTokens;
72 70
         $this->ignoreTokens[\T_EQUAL] = \T_EQUAL;
73 71
 
@@ -84,8 +82,7 @@  discard block
 block discarded – undo
84 82
      *
85 83
      * @return void
86 84
      */
87
-    public function process(File $phpcsFile, $stackPtr)
88
-    {
85
+    public function process(File $phpcsFile, $stackPtr) {
89 86
         $tokens = $phpcsFile->getTokens();
90 87
 
91 88
         if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === true) {
@@ -145,8 +142,7 @@  discard block
 block discarded – undo
145 142
      *
146 143
      * @return bool
147 144
      */
148
-    protected function shouldThrowError(array $errorInfo)
149
-    {
145
+    protected function shouldThrowError(array $errorInfo) {
150 146
         return ($errorInfo['not_in_version'] !== '' || $errorInfo['conditional_version'] !== '');
151 147
     }
152 148
 
@@ -158,8 +154,7 @@  discard block
 block discarded – undo
158 154
      *
159 155
      * @return array Version and other information about the item.
160 156
      */
161
-    public function getItemArray(array $itemInfo)
162
-    {
157
+    public function getItemArray(array $itemInfo) {
163 158
         return $this->newDirectives[$itemInfo['name']];
164 159
     }
165 160
 
@@ -169,8 +164,7 @@  discard block
 block discarded – undo
169 164
      *
170 165
      * @return array
171 166
      */
172
-    protected function getNonVersionArrayKeys()
173
-    {
167
+    protected function getNonVersionArrayKeys() {
174 168
         return array(
175 169
             'valid_value_callback',
176 170
             'valid_values',
@@ -186,8 +180,7 @@  discard block
 block discarded – undo
186 180
      *
187 181
      * @return array
188 182
      */
189
-    public function getErrorInfo(array $itemArray, array $itemInfo)
190
-    {
183
+    public function getErrorInfo(array $itemArray, array $itemInfo) {
191 184
         $errorInfo                        = parent::getErrorInfo($itemArray, $itemInfo);
192 185
         $errorInfo['conditional_version'] = '';
193 186
         $errorInfo['condition']           = '';
@@ -213,8 +206,7 @@  discard block
 block discarded – undo
213 206
      *
214 207
      * @return string
215 208
      */
216
-    protected function getErrorMsgTemplate()
217
-    {
209
+    protected function getErrorMsgTemplate() {
218 210
         return 'Directive ' . parent::getErrorMsgTemplate();
219 211
     }
220 212
 
@@ -231,8 +223,7 @@  discard block
 block discarded – undo
231 223
      *
232 224
      * @return void
233 225
      */
234
-    public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo)
235
-    {
226
+    public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo) {
236 227
         if ($errorInfo['not_in_version'] !== '') {
237 228
             parent::addError($phpcsFile, $stackPtr, $itemInfo, $errorInfo);
238 229
         } elseif ($errorInfo['conditional_version'] !== '') {
@@ -259,8 +250,7 @@  discard block
 block discarded – undo
259 250
      *
260 251
      * @return void
261 252
      */
262
-    protected function addWarningOnInvalidValue(File $phpcsFile, $stackPtr, $directive)
263
-    {
253
+    protected function addWarningOnInvalidValue(File $phpcsFile, $stackPtr, $directive) {
264 254
         $tokens = $phpcsFile->getTokens();
265 255
 
266 256
         $value = $tokens[$stackPtr]['content'];
@@ -302,8 +292,7 @@  discard block
 block discarded – undo
302 292
      *
303 293
      * @return bool
304 294
      */
305
-    protected function isNumeric($value)
306
-    {
295
+    protected function isNumeric($value) {
307 296
         return is_numeric($value);
308 297
     }
309 298
 
@@ -317,8 +306,7 @@  discard block
 block discarded – undo
317 306
      *
318 307
      * @return bool
319 308
      */
320
-    protected function validEncoding($value)
321
-    {
309
+    protected function validEncoding($value) {
322 310
         static $encodings;
323 311
         if (isset($encodings) === false && function_exists('mb_list_encodings')) {
324 312
             $encodings = mb_list_encodings();
Please login to merge, or discard this patch.
Sniffs/FunctionDeclarations/NewReturnTypeDeclarationsSniff.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,8 +23,7 @@  discard block
 block discarded – undo
23 23
  * @package  PHPCompatibility
24 24
  * @author   Wim Godden <[email protected]>
25 25
  */
26
-class NewReturnTypeDeclarationsSniff extends AbstractNewFeatureSniff
27
-{
26
+class NewReturnTypeDeclarationsSniff extends AbstractNewFeatureSniff {
28 27
 
29 28
     /**
30 29
      * A list of new types
@@ -93,8 +92,7 @@  discard block
 block discarded – undo
93 92
      *
94 93
      * @return array
95 94
      */
96
-    public function register()
97
-    {
95
+    public function register() {
98 96
         $tokens = array(
99 97
             \T_FUNCTION,
100 98
             \T_CLOSURE,
@@ -117,8 +115,7 @@  discard block
 block discarded – undo
117 115
      *
118 116
      * @return void
119 117
      */
120
-    public function process(File $phpcsFile, $stackPtr)
121
-    {
118
+    public function process(File $phpcsFile, $stackPtr) {
122 119
         $tokens = $phpcsFile->getTokens();
123 120
 
124 121
         // Deal with older PHPCS version which don't recognize return type hints
@@ -155,8 +152,7 @@  discard block
 block discarded – undo
155 152
      *
156 153
      * @return array Version and other information about the item.
157 154
      */
158
-    public function getItemArray(array $itemInfo)
159
-    {
155
+    public function getItemArray(array $itemInfo) {
160 156
         return $this->newTypes[$itemInfo['name']];
161 157
     }
162 158
 
@@ -166,8 +162,7 @@  discard block
 block discarded – undo
166 162
      *
167 163
      * @return string
168 164
      */
169
-    protected function getErrorMsgTemplate()
170
-    {
165
+    protected function getErrorMsgTemplate() {
171 166
         return '%s return type is not present in PHP version %s or earlier';
172 167
     }
173 168
 }
Please login to merge, or discard this patch.
Sniffs/FunctionDeclarations/NewParamTypeDeclarationsSniff.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -20,8 +20,7 @@  discard block
 block discarded – undo
20 20
  * @package  PHPCompatibility
21 21
  * @author   Wim Godden <[email protected]>
22 22
  */
23
-class NewParamTypeDeclarationsSniff extends AbstractNewFeatureSniff
24
-{
23
+class NewParamTypeDeclarationsSniff extends AbstractNewFeatureSniff {
25 24
 
26 25
     /**
27 26
      * A list of new types.
@@ -94,8 +93,7 @@  discard block
 block discarded – undo
94 93
      *
95 94
      * @return array
96 95
      */
97
-    public function register()
98
-    {
96
+    public function register() {
99 97
         return array(
100 98
             \T_FUNCTION,
101 99
             \T_CLOSURE,
@@ -112,8 +110,7 @@  discard block
 block discarded – undo
112 110
      *
113 111
      * @return void
114 112
      */
115
-    public function process(File $phpcsFile, $stackPtr)
116
-    {
113
+    public function process(File $phpcsFile, $stackPtr) {
117 114
         // Get all parameters from method signature.
118 115
         $paramNames = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
119 116
         if (empty($paramNames)) {
@@ -177,8 +174,7 @@  discard block
 block discarded – undo
177 174
      *
178 175
      * @return array Version and other information about the item.
179 176
      */
180
-    public function getItemArray(array $itemInfo)
181
-    {
177
+    public function getItemArray(array $itemInfo) {
182 178
         return $this->newTypes[$itemInfo['name']];
183 179
     }
184 180
 
@@ -188,8 +184,7 @@  discard block
 block discarded – undo
188 184
      *
189 185
      * @return string
190 186
      */
191
-    protected function getErrorMsgTemplate()
192
-    {
187
+    protected function getErrorMsgTemplate() {
193 188
         return "'%s' type declaration is not present in PHP version %s or earlier";
194 189
     }
195 190
 }
Please login to merge, or discard this patch.
Sniffs/FunctionDeclarations/ForbiddenToStringParametersSniff.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @since 9.2.0
27 27
  */
28
-class ForbiddenToStringParametersSniff extends Sniff
29
-{
28
+class ForbiddenToStringParametersSniff extends Sniff {
30 29
 
31 30
     /**
32 31
      * Valid scopes for the __toString() method to live in.
@@ -49,8 +48,7 @@  discard block
 block discarded – undo
49 48
      *
50 49
      * @return array
51 50
      */
52
-    public function register()
53
-    {
51
+    public function register() {
54 52
         return array(\T_FUNCTION);
55 53
     }
56 54
 
@@ -65,8 +63,7 @@  discard block
 block discarded – undo
65 63
      *
66 64
      * @return void
67 65
      */
68
-    public function process(File $phpcsFile, $stackPtr)
69
-    {
66
+    public function process(File $phpcsFile, $stackPtr) {
70 67
         if ($this->supportsAbove('5.3') === false) {
71 68
             return;
72 69
         }
Please login to merge, or discard this patch.
Sniffs/FunctionDeclarations/ForbiddenVariableNamesInClosureUseSniff.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,16 +28,14 @@  discard block
 block discarded – undo
28 28
  * @package  PHPCompatibility
29 29
  * @author   Juliette Reinders Folmer <[email protected]>
30 30
  */
31
-class ForbiddenVariableNamesInClosureUseSniff extends Sniff
32
-{
31
+class ForbiddenVariableNamesInClosureUseSniff extends Sniff {
33 32
 
34 33
     /**
35 34
      * Returns an array of tokens this test wants to listen for.
36 35
      *
37 36
      * @return array
38 37
      */
39
-    public function register()
40
-    {
38
+    public function register() {
41 39
         return array(\T_USE);
42 40
     }
43 41
 
@@ -50,8 +48,7 @@  discard block
 block discarded – undo
50 48
      *
51 49
      * @return void
52 50
      */
53
-    public function process(File $phpcsFile, $stackPtr)
54
-    {
51
+    public function process(File $phpcsFile, $stackPtr) {
55 52
         if ($this->supportsAbove('7.1') === false) {
56 53
             return;
57 54
         }
Please login to merge, or discard this patch.
Sniffs/FunctionDeclarations/ForbiddenParameterShadowSuperGlobalsSniff.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,16 +30,14 @@  discard block
 block discarded – undo
30 30
  * @author    Declan Kelly <[email protected]>
31 31
  * @copyright 2015 Declan Kelly
32 32
  */
33
-class ForbiddenParameterShadowSuperGlobalsSniff extends Sniff
34
-{
33
+class ForbiddenParameterShadowSuperGlobalsSniff extends Sniff {
35 34
 
36 35
     /**
37 36
      * Register the tokens to listen for.
38 37
      *
39 38
      * @return array
40 39
      */
41
-    public function register()
42
-    {
40
+    public function register() {
43 41
         return array(
44 42
             \T_FUNCTION,
45 43
             \T_CLOSURE,
@@ -54,8 +52,7 @@  discard block
 block discarded – undo
54 52
      *
55 53
      * @return void
56 54
      */
57
-    public function process(File $phpcsFile, $stackPtr)
58
-    {
55
+    public function process(File $phpcsFile, $stackPtr) {
59 56
         if ($this->supportsAbove('5.4') === false) {
60 57
             return;
61 58
         }
Please login to merge, or discard this patch.
Sniffs/FunctionDeclarations/ForbiddenParametersWithSameNameSniff.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,16 +26,14 @@  discard block
 block discarded – undo
26 26
  * @package  PHPCompatibility
27 27
  * @author   Wim Godden <[email protected]>
28 28
  */
29
-class ForbiddenParametersWithSameNameSniff extends Sniff
30
-{
29
+class ForbiddenParametersWithSameNameSniff extends Sniff {
31 30
 
32 31
     /**
33 32
      * Returns an array of tokens this test wants to listen for.
34 33
      *
35 34
      * @return array
36 35
      */
37
-    public function register()
38
-    {
36
+    public function register() {
39 37
         return array(
40 38
             \T_FUNCTION,
41 39
             \T_CLOSURE,
@@ -51,8 +49,7 @@  discard block
 block discarded – undo
51 49
      *
52 50
      * @return void
53 51
      */
54
-    public function process(File $phpcsFile, $stackPtr)
55
-    {
52
+    public function process(File $phpcsFile, $stackPtr) {
56 53
         if ($this->supportsAbove('7.0') === false) {
57 54
             return;
58 55
         }
Please login to merge, or discard this patch.
Sniffs/FunctionDeclarations/NewExceptionsFromToStringSniff.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
  *
23 23
  * @since 9.2.0
24 24
  */
25
-class NewExceptionsFromToStringSniff extends Sniff
26
-{
25
+class NewExceptionsFromToStringSniff extends Sniff {
27 26
 
28 27
     /**
29 28
      * Valid scopes for the __toString() method to live in.
@@ -45,8 +44,7 @@  discard block
 block discarded – undo
45 44
      *
46 45
      * @return array
47 46
      */
48
-    public function register()
49
-    {
47
+    public function register() {
50 48
         return array(\T_FUNCTION);
51 49
     }
52 50
 
@@ -61,8 +59,7 @@  discard block
 block discarded – undo
61 59
      *
62 60
      * @return void
63 61
      */
64
-    public function process(File $phpcsFile, $stackPtr)
65
-    {
62
+    public function process(File $phpcsFile, $stackPtr) {
66 63
         if ($this->supportsBelow('7.3') === false) {
67 64
             return;
68 65
         }
Please login to merge, or discard this patch.
PHPCompatibility/Sniffs/FunctionDeclarations/NewClosureSniff.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,15 +26,13 @@  discard block
 block discarded – undo
26 26
  * @package  PHPCompatibility
27 27
  * @author   Wim Godden <[email protected]>
28 28
  */
29
-class NewClosureSniff extends Sniff
30
-{
29
+class NewClosureSniff extends Sniff {
31 30
     /**
32 31
      * Returns an array of tokens this test wants to listen for.
33 32
      *
34 33
      * @return array
35 34
      */
36
-    public function register()
37
-    {
35
+    public function register() {
38 36
         return array(\T_CLOSURE);
39 37
     }
40 38
 
@@ -47,8 +45,7 @@  discard block
 block discarded – undo
47 45
      *
48 46
      * @return void
49 47
      */
50
-    public function process(File $phpcsFile, $stackPtr)
51
-    {
48
+    public function process(File $phpcsFile, $stackPtr) {
52 49
         if ($this->supportsBelow('5.2')) {
53 50
             $phpcsFile->addError(
54 51
                 'Closures / anonymous functions are not available in PHP 5.2 or earlier',
@@ -167,8 +164,7 @@  discard block
 block discarded – undo
167 164
      *
168 165
      * @return bool
169 166
      */
170
-    protected function isClosureStatic(File $phpcsFile, $stackPtr)
171
-    {
167
+    protected function isClosureStatic(File $phpcsFile, $stackPtr) {
172 168
         $tokens    = $phpcsFile->getTokens();
173 169
         $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true);
174 170
 
@@ -186,8 +182,7 @@  discard block
 block discarded – undo
186 182
      * @return int|false The stackPtr to the first $this usage if found or false if
187 183
      *                   $this is not used.
188 184
      */
189
-    protected function findThisUsageInClosure(File $phpcsFile, $startToken, $endToken)
190
-    {
185
+    protected function findThisUsageInClosure(File $phpcsFile, $startToken, $endToken) {
191 186
         // Make sure the $startToken is valid.
192 187
         if ($startToken >= $endToken) {
193 188
             return false;
@@ -212,8 +207,7 @@  discard block
 block discarded – undo
212 207
      * @return int|false The stackPtr to the first classRef usage if found or false if
213 208
      *                   they are not used.
214 209
      */
215
-    protected function findClassRefUsageInClosure(File $phpcsFile, $startToken, $endToken)
216
-    {
210
+    protected function findClassRefUsageInClosure(File $phpcsFile, $startToken, $endToken) {
217 211
         // Make sure the $startToken is valid.
218 212
         if ($startToken >= $endToken) {
219 213
             return false;
Please login to merge, or discard this patch.