Completed
Pull Request — develop (#1492)
by Zack
28:58 queued 09:00
created
PHPCompatibility/Sniffs/ParameterValues/NewFopenModesSniff.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     {
44 44
         // Version used here should be (above) the highest version from the `newModes` control,
45 45
         // structure below, i.e. the last PHP version in which a new mode was introduced.
46
-        return ($this->supportsBelow('7.1') === false);
46
+        return ( $this->supportsBelow( '7.1' ) === false );
47 47
     }
48 48
 
49 49
 
@@ -58,52 +58,52 @@  discard block
 block discarded – undo
58 58
      * @return int|void Integer stack pointer to skip forward or void to continue
59 59
      *                  normal file processing.
60 60
      */
61
-    public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters)
61
+    public function processParameters( File $phpcsFile, $stackPtr, $functionName, $parameters )
62 62
     {
63
-        if (isset($parameters[2]) === false) {
63
+        if ( isset( $parameters[ 2 ] ) === false ) {
64 64
             return;
65 65
         }
66 66
 
67 67
         $tokens      = $phpcsFile->getTokens();
68
-        $targetParam = $parameters[2];
68
+        $targetParam = $parameters[ 2 ];
69 69
         $errors      = array();
70 70
 
71
-        for ($i = $targetParam['start']; $i <= $targetParam['end']; $i++) {
72
-            if ($tokens[$i]['code'] !== \T_CONSTANT_ENCAPSED_STRING) {
71
+        for ( $i = $targetParam[ 'start' ]; $i <= $targetParam[ 'end' ]; $i++ ) {
72
+            if ( $tokens[ $i ][ 'code' ] !== \T_CONSTANT_ENCAPSED_STRING ) {
73 73
                 continue;
74 74
             }
75 75
 
76
-            if (strpos($tokens[$i]['content'], 'c+') !== false && $this->supportsBelow('5.2.5')) {
77
-                $errors['cplusFound'] = array(
76
+            if ( strpos( $tokens[ $i ][ 'content' ], 'c+' ) !== false && $this->supportsBelow( '5.2.5' ) ) {
77
+                $errors[ 'cplusFound' ] = array(
78 78
                     'c+',
79 79
                     '5.2.5',
80
-                    $targetParam['raw'],
80
+                    $targetParam[ 'raw' ],
81 81
                 );
82
-            } elseif (strpos($tokens[$i]['content'], 'c') !== false && $this->supportsBelow('5.2.5')) {
83
-                $errors['cFound'] = array(
82
+            } elseif ( strpos( $tokens[ $i ][ 'content' ], 'c' ) !== false && $this->supportsBelow( '5.2.5' ) ) {
83
+                $errors[ 'cFound' ] = array(
84 84
                     'c',
85 85
                     '5.2.5',
86
-                    $targetParam['raw'],
86
+                    $targetParam[ 'raw' ],
87 87
                 );
88 88
             }
89 89
 
90
-            if (strpos($tokens[$i]['content'], 'e') !== false && $this->supportsBelow('7.0.15')) {
91
-                $errors['eFound'] = array(
90
+            if ( strpos( $tokens[ $i ][ 'content' ], 'e' ) !== false && $this->supportsBelow( '7.0.15' ) ) {
91
+                $errors[ 'eFound' ] = array(
92 92
                     'e',
93 93
                     '7.0.15',
94
-                    $targetParam['raw'],
94
+                    $targetParam[ 'raw' ],
95 95
                 );
96 96
             }
97 97
         }
98 98
 
99
-        if (empty($errors) === true) {
99
+        if ( empty( $errors ) === true ) {
100 100
             return;
101 101
         }
102 102
 
103
-        foreach ($errors as $errorCode => $errorData) {
103
+        foreach ( $errors as $errorCode => $errorData ) {
104 104
             $phpcsFile->addError(
105 105
                 'Passing "%s" as the $mode to fopen() is not supported in PHP %s or lower. Found %s',
106
-                $targetParam['start'],
106
+                $targetParam[ 'start' ],
107 107
                 $errorCode,
108 108
                 $errorData
109 109
             );
Please login to merge, or discard this patch.
PHPCompatibility/Sniffs/ParameterValues/RemovedMbstringModifiersSniff.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     {
53 53
         // Version used here should be the highest version from the `$newModifiers` array,
54 54
         // i.e. the last PHP version in which a new modifier was introduced.
55
-        return ($this->supportsAbove('7.1') === false);
55
+        return ( $this->supportsAbove( '7.1' ) === false );
56 56
     }
57 57
 
58 58
 
@@ -69,20 +69,20 @@  discard block
 block discarded – undo
69 69
      * @return int|void Integer stack pointer to skip forward or void to continue
70 70
      *                  normal file processing.
71 71
      */
72
-    public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters)
72
+    public function processParameters( File $phpcsFile, $stackPtr, $functionName, $parameters )
73 73
     {
74 74
         $tokens         = $phpcsFile->getTokens();
75
-        $functionNameLc = strtolower($functionName);
75
+        $functionNameLc = strtolower( $functionName );
76 76
 
77 77
         // Check whether the options parameter in the function call is passed.
78
-        if (isset($parameters[$this->targetFunctions[$functionNameLc]]) === false) {
78
+        if ( isset( $parameters[ $this->targetFunctions[ $functionNameLc ] ] ) === false ) {
79 79
             return;
80 80
         }
81 81
 
82
-        $optionsParam = $parameters[$this->targetFunctions[$functionNameLc]];
82
+        $optionsParam = $parameters[ $this->targetFunctions[ $functionNameLc ] ];
83 83
 
84
-        $stringToken = $phpcsFile->findNext(Tokens::$stringTokens, $optionsParam['start'], $optionsParam['end'] + 1);
85
-        if ($stringToken === false) {
84
+        $stringToken = $phpcsFile->findNext( Tokens::$stringTokens, $optionsParam[ 'start' ], $optionsParam[ 'end' ] + 1 );
85
+        if ( $stringToken === false ) {
86 86
             // No string token found in the options parameter, so skip it (e.g. variable passed in).
87 87
             return;
88 88
         }
@@ -92,31 +92,31 @@  discard block
 block discarded – undo
92 92
         /*
93 93
          * Get the content of any string tokens in the options parameter and remove the quotes and variables.
94 94
          */
95
-        for ($i = $stringToken; $i <= $optionsParam['end']; $i++) {
96
-            if (isset(Tokens::$stringTokens[$tokens[$i]['code']]) === false) {
95
+        for ( $i = $stringToken; $i <= $optionsParam[ 'end' ]; $i++ ) {
96
+            if ( isset( Tokens::$stringTokens[ $tokens[ $i ][ 'code' ] ] ) === false ) {
97 97
                 continue;
98 98
             }
99 99
 
100
-            $content = $this->stripQuotes($tokens[$i]['content']);
101
-            if ($tokens[$i]['code'] === \T_DOUBLE_QUOTED_STRING) {
102
-                $content = $this->stripVariables($content);
100
+            $content = $this->stripQuotes( $tokens[ $i ][ 'content' ] );
101
+            if ( $tokens[ $i ][ 'code' ] === \T_DOUBLE_QUOTED_STRING ) {
102
+                $content = $this->stripVariables( $content );
103 103
             }
104
-            $content = trim($content);
104
+            $content = trim( $content );
105 105
 
106
-            if (empty($content) === false) {
106
+            if ( empty( $content ) === false ) {
107 107
                 $options .= $content;
108 108
             }
109 109
         }
110 110
 
111
-        if (strpos($options, 'e') !== false) {
111
+        if ( strpos( $options, 'e' ) !== false ) {
112 112
             $error = 'The Mbstring regex "e" modifier is deprecated since PHP 7.1.';
113 113
 
114 114
             // The alternative mb_ereg_replace_callback() function is only available since 5.4.1.
115
-            if ($this->supportsBelow('5.4.1') === false) {
115
+            if ( $this->supportsBelow( '5.4.1' ) === false ) {
116 116
                 $error .= ' Use mb_ereg_replace_callback() instead (PHP 5.4.1+).';
117 117
             }
118 118
 
119
-            $phpcsFile->addWarning($error, $stackPtr, 'Deprecated');
119
+            $phpcsFile->addWarning( $error, $stackPtr, 'Deprecated' );
120 120
         }
121 121
     }
122 122
 }
Please login to merge, or discard this patch.
PHPCompatibility/Sniffs/ParameterValues/ForbiddenGetClassNullSniff.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     protected function bowOutEarly()
48 48
     {
49
-        return ($this->supportsAbove('7.2') === false);
49
+        return ( $this->supportsAbove( '7.2' ) === false );
50 50
     }
51 51
 
52 52
 
@@ -61,19 +61,19 @@  discard block
 block discarded – undo
61 61
      * @return int|void Integer stack pointer to skip forward or void to continue
62 62
      *                  normal file processing.
63 63
      */
64
-    public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters)
64
+    public function processParameters( File $phpcsFile, $stackPtr, $functionName, $parameters )
65 65
     {
66
-        if (isset($parameters[1]) === false) {
66
+        if ( isset( $parameters[ 1 ] ) === false ) {
67 67
             return;
68 68
         }
69 69
 
70
-        if ($parameters[1]['raw'] !== 'null') {
70
+        if ( $parameters[ 1 ][ 'raw' ] !== 'null' ) {
71 71
             return;
72 72
         }
73 73
 
74 74
         $phpcsFile->addError(
75 75
             'Passing "null" as the $object to get_class() is not allowed since PHP 7.2.',
76
-            $parameters[1]['start'],
76
+            $parameters[ 1 ][ 'start' ],
77 77
             'Found'
78 78
         );
79 79
     }
Please login to merge, or discard this patch.
PHPCompatibility/Sniffs/ParameterValues/RemovedPCREModifiersSniff.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -66,49 +66,49 @@  discard block
 block discarded – undo
66 66
      * @return int|void Integer stack pointer to skip forward or void to continue
67 67
      *                  normal file processing.
68 68
      */
69
-    public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters)
69
+    public function processParameters( File $phpcsFile, $stackPtr, $functionName, $parameters )
70 70
     {
71 71
         // Check the first parameter in the function call as that should contain the regex(es).
72
-        if (isset($parameters[1]) === false) {
72
+        if ( isset( $parameters[ 1 ] ) === false ) {
73 73
             return;
74 74
         }
75 75
 
76 76
         $tokens         = $phpcsFile->getTokens();
77
-        $functionNameLc = strtolower($functionName);
78
-        $firstParam     = $parameters[1];
77
+        $functionNameLc = strtolower( $functionName );
78
+        $firstParam     = $parameters[ 1 ];
79 79
 
80 80
         // Differentiate between an array of patterns passed and a single pattern.
81
-        $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $firstParam['start'], ($firstParam['end'] + 1), true);
82
-        if ($nextNonEmpty !== false && ($tokens[$nextNonEmpty]['code'] === \T_ARRAY || $tokens[$nextNonEmpty]['code'] === \T_OPEN_SHORT_ARRAY)) {
83
-            $arrayValues = $this->getFunctionCallParameters($phpcsFile, $nextNonEmpty);
84
-            if ($functionNameLc === 'preg_replace_callback_array') {
81
+        $nextNonEmpty = $phpcsFile->findNext( Tokens::$emptyTokens, $firstParam[ 'start' ], ( $firstParam[ 'end' ] + 1 ), true );
82
+        if ( $nextNonEmpty !== false && ( $tokens[ $nextNonEmpty ][ 'code' ] === \T_ARRAY || $tokens[ $nextNonEmpty ][ 'code' ] === \T_OPEN_SHORT_ARRAY ) ) {
83
+            $arrayValues = $this->getFunctionCallParameters( $phpcsFile, $nextNonEmpty );
84
+            if ( $functionNameLc === 'preg_replace_callback_array' ) {
85 85
                 // For preg_replace_callback_array(), the patterns will be in the array keys.
86
-                foreach ($arrayValues as $value) {
87
-                    $hasKey = $phpcsFile->findNext(\T_DOUBLE_ARROW, $value['start'], ($value['end'] + 1));
88
-                    if ($hasKey === false) {
86
+                foreach ( $arrayValues as $value ) {
87
+                    $hasKey = $phpcsFile->findNext( \T_DOUBLE_ARROW, $value[ 'start' ], ( $value[ 'end' ] + 1 ) );
88
+                    if ( $hasKey === false ) {
89 89
                         continue;
90 90
                     }
91 91
 
92
-                    $value['end'] = ($hasKey - 1);
93
-                    $value['raw'] = trim($phpcsFile->getTokensAsString($value['start'], ($hasKey - $value['start'])));
94
-                    $this->processRegexPattern($value, $phpcsFile, $value['end'], $functionName);
92
+                    $value[ 'end' ] = ( $hasKey - 1 );
93
+                    $value[ 'raw' ] = trim( $phpcsFile->getTokensAsString( $value[ 'start' ], ( $hasKey - $value[ 'start' ] ) ) );
94
+                    $this->processRegexPattern( $value, $phpcsFile, $value[ 'end' ], $functionName );
95 95
                 }
96 96
 
97 97
             } else {
98 98
                 // Otherwise, the patterns will be in the array values.
99
-                foreach ($arrayValues as $value) {
100
-                    $hasKey = $phpcsFile->findNext(\T_DOUBLE_ARROW, $value['start'], ($value['end'] + 1));
101
-                    if ($hasKey !== false) {
102
-                        $value['start'] = ($hasKey + 1);
103
-                        $value['raw']   = trim($phpcsFile->getTokensAsString($value['start'], (($value['end'] + 1) - $value['start'])));
99
+                foreach ( $arrayValues as $value ) {
100
+                    $hasKey = $phpcsFile->findNext( \T_DOUBLE_ARROW, $value[ 'start' ], ( $value[ 'end' ] + 1 ) );
101
+                    if ( $hasKey !== false ) {
102
+                        $value[ 'start' ] = ( $hasKey + 1 );
103
+                        $value[ 'raw' ]   = trim( $phpcsFile->getTokensAsString( $value[ 'start' ], ( ( $value[ 'end' ] + 1 ) - $value[ 'start' ] ) ) );
104 104
                     }
105 105
 
106
-                    $this->processRegexPattern($value, $phpcsFile, $value['end'], $functionName);
106
+                    $this->processRegexPattern( $value, $phpcsFile, $value[ 'end' ], $functionName );
107 107
                 }
108 108
             }
109 109
 
110 110
         } else {
111
-            $this->processRegexPattern($firstParam, $phpcsFile, $stackPtr, $functionName);
111
+            $this->processRegexPattern( $firstParam, $phpcsFile, $stackPtr, $functionName );
112 112
         }
113 113
     }
114 114
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      */
121 121
     protected function bowOutEarly()
122 122
     {
123
-        return ($this->supportsAbove('5.5') === false);
123
+        return ( $this->supportsAbove( '5.5' ) === false );
124 124
     }
125 125
 
126 126
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      *
138 138
      * @return void
139 139
      */
140
-    protected function processRegexPattern($pattern, File $phpcsFile, $stackPtr, $functionName)
140
+    protected function processRegexPattern( $pattern, File $phpcsFile, $stackPtr, $functionName )
141 141
     {
142 142
         $tokens = $phpcsFile->getTokens();
143 143
 
@@ -146,44 +146,44 @@  discard block
 block discarded – undo
146 146
          * and function calls. We are only concerned with the strings.
147 147
          */
148 148
         $regex = '';
149
-        for ($i = $pattern['start']; $i <= $pattern['end']; $i++) {
150
-            if (isset(Tokens::$stringTokens[$tokens[$i]['code']]) === true) {
151
-                $content = $this->stripQuotes($tokens[$i]['content']);
152
-                if ($tokens[$i]['code'] === \T_DOUBLE_QUOTED_STRING) {
153
-                    $content = $this->stripVariables($content);
149
+        for ( $i = $pattern[ 'start' ]; $i <= $pattern[ 'end' ]; $i++ ) {
150
+            if ( isset( Tokens::$stringTokens[ $tokens[ $i ][ 'code' ] ] ) === true ) {
151
+                $content = $this->stripQuotes( $tokens[ $i ][ 'content' ] );
152
+                if ( $tokens[ $i ][ 'code' ] === \T_DOUBLE_QUOTED_STRING ) {
153
+                    $content = $this->stripVariables( $content );
154 154
                 }
155 155
 
156
-                $regex .= trim($content);
156
+                $regex .= trim( $content );
157 157
             }
158 158
         }
159 159
 
160 160
         // Deal with multi-line regexes which were broken up in several string tokens.
161
-        if ($tokens[$pattern['start']]['line'] !== $tokens[$pattern['end']]['line']) {
162
-            $regex = $this->stripQuotes($regex);
161
+        if ( $tokens[ $pattern[ 'start' ] ][ 'line' ] !== $tokens[ $pattern[ 'end' ] ][ 'line' ] ) {
162
+            $regex = $this->stripQuotes( $regex );
163 163
         }
164 164
 
165
-        if ($regex === '') {
165
+        if ( $regex === '' ) {
166 166
             // No string token found in the first parameter, so skip it (e.g. if variable passed in).
167 167
             return;
168 168
         }
169 169
 
170
-        $regexFirstChar = substr($regex, 0, 1);
170
+        $regexFirstChar = substr( $regex, 0, 1 );
171 171
 
172 172
         // Make sure that the character identified as the delimiter is valid.
173 173
         // Otherwise, it is a false positive caused by the string concatenation.
174
-        if (preg_match('`[a-z0-9\\\\ ]`i', $regexFirstChar) === 1) {
174
+        if ( preg_match( '`[a-z0-9\\\\ ]`i', $regexFirstChar ) === 1 ) {
175 175
             return;
176 176
         }
177 177
 
178
-        if (isset($this->doublesSeparators[$regexFirstChar])) {
179
-            $regexEndPos = strrpos($regex, $this->doublesSeparators[$regexFirstChar]);
178
+        if ( isset( $this->doublesSeparators[ $regexFirstChar ] ) ) {
179
+            $regexEndPos = strrpos( $regex, $this->doublesSeparators[ $regexFirstChar ] );
180 180
         } else {
181
-            $regexEndPos = strrpos($regex, $regexFirstChar);
181
+            $regexEndPos = strrpos( $regex, $regexFirstChar );
182 182
         }
183 183
 
184
-        if ($regexEndPos !== false) {
185
-            $modifiers = substr($regex, $regexEndPos + 1);
186
-            $this->examineModifiers($phpcsFile, $stackPtr, $functionName, $modifiers);
184
+        if ( $regexEndPos !== false ) {
185
+            $modifiers = substr( $regex, $regexEndPos + 1 );
186
+            $this->examineModifiers( $phpcsFile, $stackPtr, $functionName, $modifiers );
187 187
         }
188 188
     }
189 189
 
@@ -199,21 +199,21 @@  discard block
 block discarded – undo
199 199
      *
200 200
      * @return void
201 201
      */
202
-    protected function examineModifiers(File $phpcsFile, $stackPtr, $functionName, $modifiers)
202
+    protected function examineModifiers( File $phpcsFile, $stackPtr, $functionName, $modifiers )
203 203
     {
204
-        if (strpos($modifiers, 'e') !== false) {
204
+        if ( strpos( $modifiers, 'e' ) !== false ) {
205 205
             $error     = '%s() - /e modifier is deprecated since PHP 5.5';
206 206
             $isError   = false;
207 207
             $errorCode = 'Deprecated';
208
-            $data      = array($functionName);
208
+            $data      = array( $functionName );
209 209
 
210
-            if ($this->supportsAbove('7.0')) {
210
+            if ( $this->supportsAbove( '7.0' ) ) {
211 211
                 $error    .= ' and removed since PHP 7.0';
212 212
                 $isError   = true;
213 213
                 $errorCode = 'Removed';
214 214
             }
215 215
 
216
-            $this->addMessage($phpcsFile, $error, $stackPtr, $isError, $errorCode, $data);
216
+            $this->addMessage( $phpcsFile, $error, $stackPtr, $isError, $errorCode, $data );
217 217
         }
218 218
     }
219 219
 }
Please login to merge, or discard this patch.
PHPCompatibility/Sniffs/ParameterValues/RemovedIconvEncodingSniff.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     protected function bowOutEarly()
51 51
     {
52
-        return ($this->supportsAbove('5.6') === false);
52
+        return ( $this->supportsAbove( '5.6' ) === false );
53 53
     }
54 54
 
55 55
 
@@ -64,17 +64,17 @@  discard block
 block discarded – undo
64 64
      * @return int|void Integer stack pointer to skip forward or void to continue
65 65
      *                  normal file processing.
66 66
      */
67
-    public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters)
67
+    public function processParameters( File $phpcsFile, $stackPtr, $functionName, $parameters )
68 68
     {
69
-        if (isset($parameters[1]) === false) {
69
+        if ( isset( $parameters[ 1 ] ) === false ) {
70 70
             return;
71 71
         }
72 72
 
73 73
         $phpcsFile->addWarning(
74 74
             'All previously accepted values for the $type parameter of iconv_set_encoding() have been deprecated since PHP 5.6. Found %s',
75
-            $parameters[1]['start'],
75
+            $parameters[ 1 ][ 'start' ],
76 76
             'DeprecatedValueFound',
77
-            $parameters[1]['raw']
77
+            $parameters[ 1 ][ 'raw' ]
78 78
         );
79 79
     }
80 80
 }
Please login to merge, or discard this patch.
PHPCompatibility/Sniffs/ParameterValues/RemovedSetlocaleStringSniff.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     protected function bowOutEarly()
50 50
     {
51
-        return ($this->supportsAbove('4.2') === false);
51
+        return ( $this->supportsAbove( '4.2' ) === false );
52 52
     }
53 53
 
54 54
 
@@ -63,18 +63,18 @@  discard block
 block discarded – undo
63 63
      * @return int|void Integer stack pointer to skip forward or void to continue
64 64
      *                  normal file processing.
65 65
      */
66
-    public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters)
66
+    public function processParameters( File $phpcsFile, $stackPtr, $functionName, $parameters )
67 67
     {
68
-        if (isset($parameters[1]) === false) {
68
+        if ( isset( $parameters[ 1 ] ) === false ) {
69 69
             return;
70 70
         }
71 71
 
72 72
         $tokens      = $phpcsFile->getTokens();
73
-        $targetParam = $parameters[1];
73
+        $targetParam = $parameters[ 1 ];
74 74
 
75
-        for ($i = $targetParam['start']; $i <= $targetParam['end']; $i++) {
76
-            if ($tokens[$i]['code'] !== \T_CONSTANT_ENCAPSED_STRING
77
-                && $tokens[$i]['code'] !== \T_DOUBLE_QUOTED_STRING
75
+        for ( $i = $targetParam[ 'start' ]; $i <= $targetParam[ 'end' ]; $i++ ) {
76
+            if ( $tokens[ $i ][ 'code' ] !== \T_CONSTANT_ENCAPSED_STRING
77
+                && $tokens[ $i ][ 'code' ] !== \T_DOUBLE_QUOTED_STRING
78 78
             ) {
79 79
                 continue;
80 80
             }
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
             $message   = 'Passing the $category as a string to setlocale() has been deprecated since PHP 4.2';
83 83
             $isError   = false;
84 84
             $errorCode = 'Deprecated';
85
-            $data      = array($targetParam['raw']);
85
+            $data      = array( $targetParam[ 'raw' ] );
86 86
 
87
-            if ($this->supportsAbove('7.0') === true) {
87
+            if ( $this->supportsAbove( '7.0' ) === true ) {
88 88
                 $message  .= ' and is removed since PHP 7.0';
89 89
                 $isError   = true;
90 90
                 $errorCode = 'Removed';
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
             $message .= '; Pass one of the LC_* constants instead. Found: %s';
94 94
 
95
-            $this->addMessage($phpcsFile, $message, $i, $isError, $errorCode, $data);
95
+            $this->addMessage( $phpcsFile, $message, $i, $isError, $errorCode, $data );
96 96
             break;
97 97
         }
98 98
     }
Please login to merge, or discard this patch.
PHPCompatibility/Sniffs/ParameterValues/NewHashAlgorithmsSniff.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function register()
111 111
     {
112
-        return array(\T_STRING);
112
+        return array( \T_STRING );
113 113
     }
114 114
 
115 115
 
@@ -122,15 +122,15 @@  discard block
 block discarded – undo
122 122
      *
123 123
      * @return void
124 124
      */
125
-    public function process(File $phpcsFile, $stackPtr)
125
+    public function process( File $phpcsFile, $stackPtr )
126 126
     {
127
-        $algo = $this->getHashAlgorithmParameter($phpcsFile, $stackPtr);
128
-        if (empty($algo) || \is_string($algo) === false) {
127
+        $algo = $this->getHashAlgorithmParameter( $phpcsFile, $stackPtr );
128
+        if ( empty( $algo ) || \is_string( $algo ) === false ) {
129 129
             return;
130 130
         }
131 131
 
132 132
         // Bow out if not one of the algorithms we're targetting.
133
-        if (isset($this->newAlgorithms[$algo]) === false) {
133
+        if ( isset( $this->newAlgorithms[ $algo ] ) === false ) {
134 134
             return;
135 135
         }
136 136
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         $itemInfo = array(
139 139
             'name'   => $algo,
140 140
         );
141
-        $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
141
+        $this->handleFeature( $phpcsFile, $stackPtr, $itemInfo );
142 142
     }
143 143
 
144 144
 
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
      *
150 150
      * @return array Version and other information about the item.
151 151
      */
152
-    public function getItemArray(array $itemInfo)
152
+    public function getItemArray( array $itemInfo )
153 153
     {
154
-        return $this->newAlgorithms[$itemInfo['name']];
154
+        return $this->newAlgorithms[ $itemInfo[ 'name' ] ];
155 155
     }
156 156
 
157 157
 
Please login to merge, or discard this patch.
PHPCompatibility/Sniffs/LanguageConstructs/NewEmptyNonVariableSniff.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public function register()
38 38
     {
39
-        return array(\T_EMPTY);
39
+        return array( \T_EMPTY );
40 40
     }
41 41
 
42 42
     /**
@@ -48,30 +48,30 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @return void
50 50
      */
51
-    public function process(File $phpcsFile, $stackPtr)
51
+    public function process( File $phpcsFile, $stackPtr )
52 52
     {
53
-        if ($this->supportsBelow('5.4') === false) {
53
+        if ( $this->supportsBelow( '5.4' ) === false ) {
54 54
             return;
55 55
         }
56 56
 
57 57
         $tokens = $phpcsFile->getTokens();
58 58
 
59
-        $open = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true);
60
-        if ($open === false
61
-            || $tokens[$open]['code'] !== \T_OPEN_PARENTHESIS
62
-            || isset($tokens[$open]['parenthesis_closer']) === false
59
+        $open = $phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true, null, true );
60
+        if ( $open === false
61
+            || $tokens[ $open ][ 'code' ] !== \T_OPEN_PARENTHESIS
62
+            || isset( $tokens[ $open ][ 'parenthesis_closer' ] ) === false
63 63
         ) {
64 64
             return;
65 65
         }
66 66
 
67
-        $close = $tokens[$open]['parenthesis_closer'];
67
+        $close = $tokens[ $open ][ 'parenthesis_closer' ];
68 68
 
69 69
         $nestingLevel = 0;
70
-        if ($close !== ($open + 1) && isset($tokens[$open + 1]['nested_parenthesis'])) {
71
-            $nestingLevel = \count($tokens[$open + 1]['nested_parenthesis']);
70
+        if ( $close !== ( $open + 1 ) && isset( $tokens[ $open + 1 ][ 'nested_parenthesis' ] ) ) {
71
+            $nestingLevel = \count( $tokens[ $open + 1 ][ 'nested_parenthesis' ] );
72 72
         }
73 73
 
74
-        if ($this->isVariable($phpcsFile, ($open + 1), $close, $nestingLevel) === true) {
74
+        if ( $this->isVariable( $phpcsFile, ( $open + 1 ), $close, $nestingLevel ) === true ) {
75 75
             return;
76 76
         }
77 77
 
Please login to merge, or discard this patch.
PHPCompatibility/Sniffs/LanguageConstructs/NewLanguageConstructsSniff.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
     public function register()
55 55
     {
56 56
         $tokens = array();
57
-        foreach ($this->newConstructs as $token => $versions) {
58
-            $tokens[] = constant($token);
57
+        foreach ( $this->newConstructs as $token => $versions ) {
58
+            $tokens[ ] = constant( $token );
59 59
         }
60 60
         return $tokens;
61 61
     }
@@ -70,15 +70,15 @@  discard block
 block discarded – undo
70 70
      *
71 71
      * @return void
72 72
      */
73
-    public function process(File $phpcsFile, $stackPtr)
73
+    public function process( File $phpcsFile, $stackPtr )
74 74
     {
75 75
         $tokens    = $phpcsFile->getTokens();
76
-        $tokenType = $tokens[$stackPtr]['type'];
76
+        $tokenType = $tokens[ $stackPtr ][ 'type' ];
77 77
 
78 78
         $itemInfo = array(
79 79
             'name' => $tokenType,
80 80
         );
81
-        $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
81
+        $this->handleFeature( $phpcsFile, $stackPtr, $itemInfo );
82 82
     }
83 83
 
84 84
 
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
      *
90 90
      * @return array Version and other information about the item.
91 91
      */
92
-    public function getItemArray(array $itemInfo)
92
+    public function getItemArray( array $itemInfo )
93 93
     {
94
-        return $this->newConstructs[$itemInfo['name']];
94
+        return $this->newConstructs[ $itemInfo[ 'name' ] ];
95 95
     }
96 96
 
97 97
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      */
103 103
     protected function getNonVersionArrayKeys()
104 104
     {
105
-        return array('description');
105
+        return array( 'description' );
106 106
     }
107 107
 
108 108
 
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
      *
115 115
      * @return array
116 116
      */
117
-    public function getErrorInfo(array $itemArray, array $itemInfo)
117
+    public function getErrorInfo( array $itemArray, array $itemInfo )
118 118
     {
119
-        $errorInfo                = parent::getErrorInfo($itemArray, $itemInfo);
120
-        $errorInfo['description'] = $itemArray['description'];
119
+        $errorInfo                = parent::getErrorInfo( $itemArray, $itemInfo );
120
+        $errorInfo[ 'description' ] = $itemArray[ 'description' ];
121 121
 
122 122
         return $errorInfo;
123 123
     }
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
      *
133 133
      * @return array
134 134
      */
135
-    protected function filterErrorData(array $data, array $itemInfo, array $errorInfo)
135
+    protected function filterErrorData( array $data, array $itemInfo, array $errorInfo )
136 136
     {
137
-        $data[0] = $errorInfo['description'];
137
+        $data[ 0 ] = $errorInfo[ 'description' ];
138 138
         return $data;
139 139
     }
140 140
 }
Please login to merge, or discard this patch.