@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | * @package PHPCompatibility |
25 | 25 | * @author Juliette Reinders Folmer <[email protected]> |
26 | 26 | */ |
27 | -class RemovedMbstringModifiersSniff extends AbstractFunctionCallParameterSniff |
|
28 | -{ |
|
27 | +class RemovedMbstringModifiersSniff extends AbstractFunctionCallParameterSniff { |
|
29 | 28 | |
30 | 29 | /** |
31 | 30 | * Functions to check for. |
@@ -48,8 +47,7 @@ discard block |
||
48 | 47 | * |
49 | 48 | * @return bool |
50 | 49 | */ |
51 | - protected function bowOutEarly() |
|
52 | - { |
|
50 | + protected function bowOutEarly() { |
|
53 | 51 | // Version used here should be the highest version from the `$newModifiers` array, |
54 | 52 | // i.e. the last PHP version in which a new modifier was introduced. |
55 | 53 | return ($this->supportsAbove('7.1') === false); |
@@ -69,8 +67,7 @@ discard block |
||
69 | 67 | * @return int|void Integer stack pointer to skip forward or void to continue |
70 | 68 | * normal file processing. |
71 | 69 | */ |
72 | - public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) |
|
73 | - { |
|
70 | + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) { |
|
74 | 71 | $tokens = $phpcsFile->getTokens(); |
75 | 72 | $functionNameLc = strtolower($functionName); |
76 | 73 |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | * @package PHPCompatibility |
27 | 27 | * @author Juliette Reinders Folmer <[email protected]> |
28 | 28 | */ |
29 | -class ForbiddenGetClassNullSniff extends AbstractFunctionCallParameterSniff |
|
30 | -{ |
|
29 | +class ForbiddenGetClassNullSniff extends AbstractFunctionCallParameterSniff { |
|
31 | 30 | |
32 | 31 | /** |
33 | 32 | * Functions to check for. |
@@ -44,8 +43,7 @@ discard block |
||
44 | 43 | * |
45 | 44 | * @return bool |
46 | 45 | */ |
47 | - protected function bowOutEarly() |
|
48 | - { |
|
46 | + protected function bowOutEarly() { |
|
49 | 47 | return ($this->supportsAbove('7.2') === false); |
50 | 48 | } |
51 | 49 | |
@@ -61,8 +59,7 @@ discard block |
||
61 | 59 | * @return int|void Integer stack pointer to skip forward or void to continue |
62 | 60 | * normal file processing. |
63 | 61 | */ |
64 | - public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) |
|
65 | - { |
|
62 | + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) { |
|
66 | 63 | if (isset($parameters[1]) === false) { |
67 | 64 | return; |
68 | 65 | } |
@@ -29,8 +29,7 @@ discard block |
||
29 | 29 | * @author Wim Godden <[email protected]> |
30 | 30 | * @copyright 2014 Cu.be Solutions bvba |
31 | 31 | */ |
32 | -class RemovedPCREModifiersSniff extends AbstractFunctionCallParameterSniff |
|
33 | -{ |
|
32 | +class RemovedPCREModifiersSniff extends AbstractFunctionCallParameterSniff { |
|
34 | 33 | |
35 | 34 | /** |
36 | 35 | * Functions to check for. |
@@ -66,8 +65,7 @@ discard block |
||
66 | 65 | * @return int|void Integer stack pointer to skip forward or void to continue |
67 | 66 | * normal file processing. |
68 | 67 | */ |
69 | - public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) |
|
70 | - { |
|
68 | + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) { |
|
71 | 69 | // Check the first parameter in the function call as that should contain the regex(es). |
72 | 70 | if (isset($parameters[1]) === false) { |
73 | 71 | return; |
@@ -118,8 +116,7 @@ discard block |
||
118 | 116 | * |
119 | 117 | * @return bool |
120 | 118 | */ |
121 | - protected function bowOutEarly() |
|
122 | - { |
|
119 | + protected function bowOutEarly() { |
|
123 | 120 | return ($this->supportsAbove('5.5') === false); |
124 | 121 | } |
125 | 122 | |
@@ -137,8 +134,7 @@ discard block |
||
137 | 134 | * |
138 | 135 | * @return void |
139 | 136 | */ |
140 | - protected function processRegexPattern($pattern, File $phpcsFile, $stackPtr, $functionName) |
|
141 | - { |
|
137 | + protected function processRegexPattern($pattern, File $phpcsFile, $stackPtr, $functionName) { |
|
142 | 138 | $tokens = $phpcsFile->getTokens(); |
143 | 139 | |
144 | 140 | /* |
@@ -199,8 +195,7 @@ discard block |
||
199 | 195 | * |
200 | 196 | * @return void |
201 | 197 | */ |
202 | - protected function examineModifiers(File $phpcsFile, $stackPtr, $functionName, $modifiers) |
|
203 | - { |
|
198 | + protected function examineModifiers(File $phpcsFile, $stackPtr, $functionName, $modifiers) { |
|
204 | 199 | if (strpos($modifiers, 'e') !== false) { |
205 | 200 | $error = '%s() - /e modifier is deprecated since PHP 5.5'; |
206 | 201 | $isError = false; |
@@ -29,8 +29,7 @@ discard block |
||
29 | 29 | * @package PHPCompatibility |
30 | 30 | * @author Juliette Reinders Folmer <[email protected]> |
31 | 31 | */ |
32 | -class RemovedIconvEncodingSniff extends AbstractFunctionCallParameterSniff |
|
33 | -{ |
|
32 | +class RemovedIconvEncodingSniff extends AbstractFunctionCallParameterSniff { |
|
34 | 33 | |
35 | 34 | /** |
36 | 35 | * Functions to check for. |
@@ -47,8 +46,7 @@ discard block |
||
47 | 46 | * |
48 | 47 | * @return bool |
49 | 48 | */ |
50 | - protected function bowOutEarly() |
|
51 | - { |
|
49 | + protected function bowOutEarly() { |
|
52 | 50 | return ($this->supportsAbove('5.6') === false); |
53 | 51 | } |
54 | 52 | |
@@ -64,8 +62,7 @@ discard block |
||
64 | 62 | * @return int|void Integer stack pointer to skip forward or void to continue |
65 | 63 | * normal file processing. |
66 | 64 | */ |
67 | - public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) |
|
68 | - { |
|
65 | + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) { |
|
69 | 66 | if (isset($parameters[1]) === false) { |
70 | 67 | return; |
71 | 68 | } |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | * @package PHPCompatibility |
29 | 29 | * @author Juliette Reinders Folmer <[email protected]> |
30 | 30 | */ |
31 | -class RemovedSetlocaleStringSniff extends AbstractFunctionCallParameterSniff |
|
32 | -{ |
|
31 | +class RemovedSetlocaleStringSniff extends AbstractFunctionCallParameterSniff { |
|
33 | 32 | |
34 | 33 | /** |
35 | 34 | * Functions to check for. |
@@ -46,8 +45,7 @@ discard block |
||
46 | 45 | * |
47 | 46 | * @return bool |
48 | 47 | */ |
49 | - protected function bowOutEarly() |
|
50 | - { |
|
48 | + protected function bowOutEarly() { |
|
51 | 49 | return ($this->supportsAbove('4.2') === false); |
52 | 50 | } |
53 | 51 | |
@@ -63,8 +61,7 @@ discard block |
||
63 | 61 | * @return int|void Integer stack pointer to skip forward or void to continue |
64 | 62 | * normal file processing. |
65 | 63 | */ |
66 | - public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) |
|
67 | - { |
|
64 | + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) { |
|
68 | 65 | if (isset($parameters[1]) === false) { |
69 | 66 | return; |
70 | 67 | } |
@@ -19,8 +19,7 @@ discard block |
||
19 | 19 | * @package PHPCompatibility |
20 | 20 | * @author Juliette Reinders Folmer <[email protected]> |
21 | 21 | */ |
22 | -class NewHashAlgorithmsSniff extends AbstractNewFeatureSniff |
|
23 | -{ |
|
22 | +class NewHashAlgorithmsSniff extends AbstractNewFeatureSniff { |
|
24 | 23 | /** |
25 | 24 | * A list of new hash algorithms, not present in older versions. |
26 | 25 | * |
@@ -107,8 +106,7 @@ discard block |
||
107 | 106 | * |
108 | 107 | * @return array |
109 | 108 | */ |
110 | - public function register() |
|
111 | - { |
|
109 | + public function register() { |
|
112 | 110 | return array(\T_STRING); |
113 | 111 | } |
114 | 112 | |
@@ -122,8 +120,7 @@ discard block |
||
122 | 120 | * |
123 | 121 | * @return void |
124 | 122 | */ |
125 | - public function process(File $phpcsFile, $stackPtr) |
|
126 | - { |
|
123 | + public function process(File $phpcsFile, $stackPtr) { |
|
127 | 124 | $algo = $this->getHashAlgorithmParameter($phpcsFile, $stackPtr); |
128 | 125 | if (empty($algo) || \is_string($algo) === false) { |
129 | 126 | return; |
@@ -149,8 +146,7 @@ discard block |
||
149 | 146 | * |
150 | 147 | * @return array Version and other information about the item. |
151 | 148 | */ |
152 | - public function getItemArray(array $itemInfo) |
|
153 | - { |
|
149 | + public function getItemArray(array $itemInfo) { |
|
154 | 150 | return $this->newAlgorithms[$itemInfo['name']]; |
155 | 151 | } |
156 | 152 | |
@@ -160,8 +156,7 @@ discard block |
||
160 | 156 | * |
161 | 157 | * @return string |
162 | 158 | */ |
163 | - protected function getErrorMsgTemplate() |
|
164 | - { |
|
159 | + protected function getErrorMsgTemplate() { |
|
165 | 160 | return 'The %s hash algorithm is not present in PHP version %s or earlier'; |
166 | 161 | } |
167 | 162 | } |
@@ -26,16 +26,14 @@ discard block |
||
26 | 26 | * @package PHPCompatibility |
27 | 27 | * @author Juliette Reinders Folmer <[email protected]> |
28 | 28 | */ |
29 | -class NewEmptyNonVariableSniff extends Sniff |
|
30 | -{ |
|
29 | +class NewEmptyNonVariableSniff 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(\T_EMPTY); |
40 | 38 | } |
41 | 39 | |
@@ -48,8 +46,7 @@ discard block |
||
48 | 46 | * |
49 | 47 | * @return void |
50 | 48 | */ |
51 | - public function process(File $phpcsFile, $stackPtr) |
|
52 | - { |
|
49 | + public function process(File $phpcsFile, $stackPtr) { |
|
53 | 50 | if ($this->supportsBelow('5.4') === false) { |
54 | 51 | return; |
55 | 52 | } |
@@ -21,8 +21,7 @@ discard block |
||
21 | 21 | * @author Wim Godden <[email protected]> |
22 | 22 | * @copyright 2013 Cu.be Solutions bvba |
23 | 23 | */ |
24 | -class NewLanguageConstructsSniff extends AbstractNewFeatureSniff |
|
25 | -{ |
|
24 | +class NewLanguageConstructsSniff extends AbstractNewFeatureSniff { |
|
26 | 25 | |
27 | 26 | /** |
28 | 27 | * A list of new language constructs, not present in older versions. |
@@ -51,8 +50,7 @@ discard block |
||
51 | 50 | * |
52 | 51 | * @return array |
53 | 52 | */ |
54 | - public function register() |
|
55 | - { |
|
53 | + public function register() { |
|
56 | 54 | $tokens = array(); |
57 | 55 | foreach ($this->newConstructs as $token => $versions) { |
58 | 56 | $tokens[] = constant($token); |
@@ -70,8 +68,7 @@ discard block |
||
70 | 68 | * |
71 | 69 | * @return void |
72 | 70 | */ |
73 | - public function process(File $phpcsFile, $stackPtr) |
|
74 | - { |
|
71 | + public function process(File $phpcsFile, $stackPtr) { |
|
75 | 72 | $tokens = $phpcsFile->getTokens(); |
76 | 73 | $tokenType = $tokens[$stackPtr]['type']; |
77 | 74 | |
@@ -89,8 +86,7 @@ discard block |
||
89 | 86 | * |
90 | 87 | * @return array Version and other information about the item. |
91 | 88 | */ |
92 | - public function getItemArray(array $itemInfo) |
|
93 | - { |
|
89 | + public function getItemArray(array $itemInfo) { |
|
94 | 90 | return $this->newConstructs[$itemInfo['name']]; |
95 | 91 | } |
96 | 92 | |
@@ -100,8 +96,7 @@ discard block |
||
100 | 96 | * |
101 | 97 | * @return array |
102 | 98 | */ |
103 | - protected function getNonVersionArrayKeys() |
|
104 | - { |
|
99 | + protected function getNonVersionArrayKeys() { |
|
105 | 100 | return array('description'); |
106 | 101 | } |
107 | 102 | |
@@ -114,8 +109,7 @@ discard block |
||
114 | 109 | * |
115 | 110 | * @return array |
116 | 111 | */ |
117 | - public function getErrorInfo(array $itemArray, array $itemInfo) |
|
118 | - { |
|
112 | + public function getErrorInfo(array $itemArray, array $itemInfo) { |
|
119 | 113 | $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); |
120 | 114 | $errorInfo['description'] = $itemArray['description']; |
121 | 115 | |
@@ -132,8 +126,7 @@ discard block |
||
132 | 126 | * |
133 | 127 | * @return array |
134 | 128 | */ |
135 | - protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) |
|
136 | - { |
|
129 | + protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) { |
|
137 | 130 | $data[0] = $errorInfo['description']; |
138 | 131 | return $data; |
139 | 132 | } |
@@ -18,8 +18,7 @@ discard block |
||
18 | 18 | * @package PHPCompatibility |
19 | 19 | * @author Juliette Reinders Folmer <[email protected]> |
20 | 20 | */ |
21 | -abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff |
|
22 | -{ |
|
21 | +abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff { |
|
23 | 22 | |
24 | 23 | |
25 | 24 | /** |
@@ -29,8 +28,7 @@ discard block |
||
29 | 28 | * |
30 | 29 | * @return bool |
31 | 30 | */ |
32 | - protected function shouldThrowError(array $errorInfo) |
|
33 | - { |
|
31 | + protected function shouldThrowError(array $errorInfo) { |
|
34 | 32 | return ($errorInfo['deprecated'] !== '' || $errorInfo['removed'] !== ''); |
35 | 33 | } |
36 | 34 | |
@@ -42,8 +40,7 @@ discard block |
||
42 | 40 | * |
43 | 41 | * @return array |
44 | 42 | */ |
45 | - protected function getNonVersionArrayKeys() |
|
46 | - { |
|
43 | + protected function getNonVersionArrayKeys() { |
|
47 | 44 | return array('alternative'); |
48 | 45 | } |
49 | 46 | |
@@ -56,8 +53,7 @@ discard block |
||
56 | 53 | * |
57 | 54 | * @return array |
58 | 55 | */ |
59 | - public function getErrorInfo(array $itemArray, array $itemInfo) |
|
60 | - { |
|
56 | + public function getErrorInfo(array $itemArray, array $itemInfo) { |
|
61 | 57 | $errorInfo = array( |
62 | 58 | 'deprecated' => '', |
63 | 59 | 'removed' => '', |
@@ -93,8 +89,7 @@ discard block |
||
93 | 89 | * |
94 | 90 | * @return string |
95 | 91 | */ |
96 | - protected function getAlternativeOptionTemplate() |
|
97 | - { |
|
92 | + protected function getAlternativeOptionTemplate() { |
|
98 | 93 | return '; Use %s instead'; |
99 | 94 | } |
100 | 95 | |
@@ -111,8 +106,7 @@ discard block |
||
111 | 106 | * |
112 | 107 | * @return void |
113 | 108 | */ |
114 | - public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo) |
|
115 | - { |
|
109 | + public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo) { |
|
116 | 110 | $itemName = $this->getItemName($itemInfo, $errorInfo); |
117 | 111 | $error = $this->getErrorMsgTemplate(); |
118 | 112 |