@@ -21,8 +21,7 @@ discard block |
||
21 | 21 | * @package PHPCompatibility |
22 | 22 | * @author Juliette Reinders Folmer <[email protected]> |
23 | 23 | */ |
24 | -class NewMagicMethodsSniff extends AbstractNewFeatureSniff |
|
25 | -{ |
|
24 | +class NewMagicMethodsSniff extends AbstractNewFeatureSniff { |
|
26 | 25 | |
27 | 26 | /** |
28 | 27 | * A list of new magic methods, not considered magic in older versions. |
@@ -81,8 +80,7 @@ discard block |
||
81 | 80 | * |
82 | 81 | * @return array |
83 | 82 | */ |
84 | - public function register() |
|
85 | - { |
|
83 | + public function register() { |
|
86 | 84 | return array(\T_FUNCTION); |
87 | 85 | } |
88 | 86 | |
@@ -96,8 +94,7 @@ discard block |
||
96 | 94 | * |
97 | 95 | * @return void |
98 | 96 | */ |
99 | - public function process(File $phpcsFile, $stackPtr) |
|
100 | - { |
|
97 | + public function process(File $phpcsFile, $stackPtr) { |
|
101 | 98 | $functionName = $phpcsFile->getDeclarationName($stackPtr); |
102 | 99 | $functionNameLc = strtolower($functionName); |
103 | 100 | |
@@ -124,8 +121,7 @@ discard block |
||
124 | 121 | * |
125 | 122 | * @return array Version and other information about the item. |
126 | 123 | */ |
127 | - public function getItemArray(array $itemInfo) |
|
128 | - { |
|
124 | + public function getItemArray(array $itemInfo) { |
|
129 | 125 | return $this->newMagicMethods[$itemInfo['nameLc']]; |
130 | 126 | } |
131 | 127 | |
@@ -135,8 +131,7 @@ discard block |
||
135 | 131 | * |
136 | 132 | * @return array |
137 | 133 | */ |
138 | - protected function getNonVersionArrayKeys() |
|
139 | - { |
|
134 | + protected function getNonVersionArrayKeys() { |
|
140 | 135 | return array('message'); |
141 | 136 | } |
142 | 137 | |
@@ -149,8 +144,7 @@ discard block |
||
149 | 144 | * |
150 | 145 | * @return array |
151 | 146 | */ |
152 | - public function getErrorInfo(array $itemArray, array $itemInfo) |
|
153 | - { |
|
147 | + public function getErrorInfo(array $itemArray, array $itemInfo) { |
|
154 | 148 | $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); |
155 | 149 | $errorInfo['error'] = false; // Warning, not error. |
156 | 150 | $errorInfo['message'] = ''; |
@@ -168,8 +162,7 @@ discard block |
||
168 | 162 | * |
169 | 163 | * @return string |
170 | 164 | */ |
171 | - protected function getErrorMsgTemplate() |
|
172 | - { |
|
165 | + protected function getErrorMsgTemplate() { |
|
173 | 166 | return 'The method %s() was not magical in PHP version %s and earlier. The associated magic functionality will not be invoked.'; |
174 | 167 | } |
175 | 168 | |
@@ -183,8 +176,7 @@ discard block |
||
183 | 176 | * |
184 | 177 | * @return string |
185 | 178 | */ |
186 | - protected function filterErrorMsg($error, array $itemInfo, array $errorInfo) |
|
187 | - { |
|
179 | + protected function filterErrorMsg($error, array $itemInfo, array $errorInfo) { |
|
188 | 180 | if ($errorInfo['message'] !== '') { |
189 | 181 | $error = $errorInfo['message']; |
190 | 182 | } |
@@ -24,16 +24,14 @@ discard block |
||
24 | 24 | * @package PHPCompatibility |
25 | 25 | * @author Koen Eelen <[email protected]> |
26 | 26 | */ |
27 | -class RemovedPHP4StyleConstructorsSniff extends Sniff |
|
28 | -{ |
|
27 | +class RemovedPHP4StyleConstructorsSniff extends Sniff { |
|
29 | 28 | |
30 | 29 | /** |
31 | 30 | * Returns an array of tokens this test wants to listen for. |
32 | 31 | * |
33 | 32 | * @return array |
34 | 33 | */ |
35 | - public function register() |
|
36 | - { |
|
34 | + public function register() { |
|
37 | 35 | return array( |
38 | 36 | \T_CLASS, |
39 | 37 | \T_INTERFACE, |
@@ -49,8 +47,7 @@ discard block |
||
49 | 47 | * |
50 | 48 | * @return void |
51 | 49 | */ |
52 | - public function process(File $phpcsFile, $stackPtr) |
|
53 | - { |
|
50 | + public function process(File $phpcsFile, $stackPtr) { |
|
54 | 51 | if ($this->supportsAbove('7.0') === false) { |
55 | 52 | return; |
56 | 53 | } |
@@ -34,14 +34,12 @@ discard block |
||
34 | 34 | * @package PHPCompatibility |
35 | 35 | * @author Juliette Reinders Folmer <[email protected]> |
36 | 36 | */ |
37 | -class ReservedFunctionNamesSniff extends PHPCS_CamelCapsFunctionNameSniff |
|
38 | -{ |
|
37 | +class ReservedFunctionNamesSniff extends PHPCS_CamelCapsFunctionNameSniff { |
|
39 | 38 | |
40 | 39 | /** |
41 | 40 | * Overload the constructor to work round various PHPCS cross-version compatibility issues. |
42 | 41 | */ |
43 | - public function __construct() |
|
44 | - { |
|
42 | + public function __construct() { |
|
45 | 43 | $scopeTokens = array(\T_CLASS, \T_INTERFACE, \T_TRAIT); |
46 | 44 | if (\defined('T_ANON_CLASS')) { |
47 | 45 | $scopeTokens[] = \T_ANON_CLASS; |
@@ -65,8 +63,7 @@ discard block |
||
65 | 63 | * |
66 | 64 | * @return void |
67 | 65 | */ |
68 | - protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope) |
|
69 | - { |
|
66 | + protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope) { |
|
70 | 67 | $tokens = $phpcsFile->getTokens(); |
71 | 68 | |
72 | 69 | /* |
@@ -120,8 +117,7 @@ discard block |
||
120 | 117 | * |
121 | 118 | * @return void |
122 | 119 | */ |
123 | - protected function processTokenOutsideScope(File $phpcsFile, $stackPtr) |
|
124 | - { |
|
120 | + protected function processTokenOutsideScope(File $phpcsFile, $stackPtr) { |
|
125 | 121 | $functionName = $phpcsFile->getDeclarationName($stackPtr); |
126 | 122 | if ($functionName === null) { |
127 | 123 | // Ignore closures. |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | * @package PHPCompatibility |
27 | 27 | * @author Juliette Reinders Folmer <[email protected]> |
28 | 28 | */ |
29 | -class NewNegativeStringOffsetSniff extends AbstractFunctionCallParameterSniff |
|
30 | -{ |
|
29 | +class NewNegativeStringOffsetSniff extends AbstractFunctionCallParameterSniff { |
|
31 | 30 | |
32 | 31 | /** |
33 | 32 | * Functions to check for. |
@@ -81,8 +80,7 @@ discard block |
||
81 | 80 | * |
82 | 81 | * @return bool |
83 | 82 | */ |
84 | - protected function bowOutEarly() |
|
85 | - { |
|
83 | + protected function bowOutEarly() { |
|
86 | 84 | return ($this->supportsBelow('7.0') === false); |
87 | 85 | } |
88 | 86 | |
@@ -97,8 +95,7 @@ discard block |
||
97 | 95 | * @return int|void Integer stack pointer to skip forward or void to continue |
98 | 96 | * normal file processing. |
99 | 97 | */ |
100 | - public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) |
|
101 | - { |
|
98 | + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) { |
|
102 | 99 | $functionLC = strtolower($functionName); |
103 | 100 | foreach ($this->targetFunctions[$functionLC] as $pos => $name) { |
104 | 101 | if (isset($parameters[$pos]) === false) { |
@@ -21,8 +21,7 @@ discard block |
||
21 | 21 | * @package PHPCompatibility |
22 | 22 | * @author Juliette Reinders Folmer <[email protected]> |
23 | 23 | */ |
24 | -class NewPCREModifiersSniff extends RemovedPCREModifiersSniff |
|
25 | -{ |
|
24 | +class NewPCREModifiersSniff extends RemovedPCREModifiersSniff { |
|
26 | 25 | |
27 | 26 | /** |
28 | 27 | * Functions to check for. |
@@ -62,8 +61,7 @@ discard block |
||
62 | 61 | * |
63 | 62 | * @return bool |
64 | 63 | */ |
65 | - protected function bowOutEarly() |
|
66 | - { |
|
64 | + protected function bowOutEarly() { |
|
67 | 65 | // Version used here should be the highest version from the `$newModifiers` array, |
68 | 66 | // i.e. the last PHP version in which a new modifier was introduced. |
69 | 67 | return ($this->supportsBelow('7.2') === false); |
@@ -81,8 +79,7 @@ discard block |
||
81 | 79 | * |
82 | 80 | * @return void |
83 | 81 | */ |
84 | - protected function examineModifiers(File $phpcsFile, $stackPtr, $functionName, $modifiers) |
|
85 | - { |
|
82 | + protected function examineModifiers(File $phpcsFile, $stackPtr, $functionName, $modifiers) { |
|
86 | 83 | $error = 'The PCRE regex modifier "%s" is not present in PHP version %s or earlier'; |
87 | 84 | |
88 | 85 | foreach ($this->newModifiers as $modifier => $versionArray) { |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | * @package PHPCompatibility |
27 | 27 | * @author Juliette Reinders Folmer <[email protected]> |
28 | 28 | */ |
29 | -class RemovedNonCryptoHashSniff extends AbstractFunctionCallParameterSniff |
|
30 | -{ |
|
29 | +class RemovedNonCryptoHashSniff extends AbstractFunctionCallParameterSniff { |
|
31 | 30 | |
32 | 31 | /** |
33 | 32 | * Functions to check for. |
@@ -63,8 +62,7 @@ discard block |
||
63 | 62 | * |
64 | 63 | * @return bool |
65 | 64 | */ |
66 | - protected function bowOutEarly() |
|
67 | - { |
|
65 | + protected function bowOutEarly() { |
|
68 | 66 | return ($this->supportsAbove('7.2') === false); |
69 | 67 | } |
70 | 68 | |
@@ -80,8 +78,7 @@ discard block |
||
80 | 78 | * @return int|void Integer stack pointer to skip forward or void to continue |
81 | 79 | * normal file processing. |
82 | 80 | */ |
83 | - public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) |
|
84 | - { |
|
81 | + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) { |
|
85 | 82 | if (isset($parameters[1]) === false) { |
86 | 83 | return; |
87 | 84 | } |
@@ -27,8 +27,7 @@ discard block |
||
27 | 27 | * @author Wim Godden <[email protected]> |
28 | 28 | * @copyright 2012 Cu.be Solutions bvba |
29 | 29 | */ |
30 | -class RemovedHashAlgorithmsSniff extends AbstractRemovedFeatureSniff |
|
31 | -{ |
|
30 | +class RemovedHashAlgorithmsSniff extends AbstractRemovedFeatureSniff { |
|
32 | 31 | |
33 | 32 | /** |
34 | 33 | * A list of removed hash algorithms, which were present in older versions. |
@@ -52,8 +51,7 @@ discard block |
||
52 | 51 | * |
53 | 52 | * @return array |
54 | 53 | */ |
55 | - public function register() |
|
56 | - { |
|
54 | + public function register() { |
|
57 | 55 | return array(\T_STRING); |
58 | 56 | } |
59 | 57 | |
@@ -67,8 +65,7 @@ discard block |
||
67 | 65 | * |
68 | 66 | * @return void |
69 | 67 | */ |
70 | - public function process(File $phpcsFile, $stackPtr) |
|
71 | - { |
|
68 | + public function process(File $phpcsFile, $stackPtr) { |
|
72 | 69 | $algo = $this->getHashAlgorithmParameter($phpcsFile, $stackPtr); |
73 | 70 | if (empty($algo) || \is_string($algo) === false) { |
74 | 71 | return; |
@@ -93,8 +90,7 @@ discard block |
||
93 | 90 | * |
94 | 91 | * @return array Version and other information about the item. |
95 | 92 | */ |
96 | - public function getItemArray(array $itemInfo) |
|
97 | - { |
|
93 | + public function getItemArray(array $itemInfo) { |
|
98 | 94 | return $this->removedAlgorithms[$itemInfo['name']]; |
99 | 95 | } |
100 | 96 | |
@@ -104,8 +100,7 @@ discard block |
||
104 | 100 | * |
105 | 101 | * @return string |
106 | 102 | */ |
107 | - protected function getErrorMsgTemplate() |
|
108 | - { |
|
103 | + protected function getErrorMsgTemplate() { |
|
109 | 104 | return 'The %s hash algorithm is '; |
110 | 105 | } |
111 | 106 | } |
@@ -21,8 +21,7 @@ discard block |
||
21 | 21 | * @package PHPCompatibility |
22 | 22 | * @author Juliette Reinders Folmer <[email protected]> |
23 | 23 | */ |
24 | -class NewArrayReduceInitialTypeSniff extends AbstractFunctionCallParameterSniff |
|
25 | -{ |
|
24 | +class NewArrayReduceInitialTypeSniff extends AbstractFunctionCallParameterSniff { |
|
26 | 25 | |
27 | 26 | /** |
28 | 27 | * Functions to check for. |
@@ -54,8 +53,7 @@ discard block |
||
54 | 53 | * |
55 | 54 | * @return bool |
56 | 55 | */ |
57 | - protected function bowOutEarly() |
|
58 | - { |
|
56 | + protected function bowOutEarly() { |
|
59 | 57 | return ($this->supportsBelow('5.2') === false); |
60 | 58 | } |
61 | 59 | |
@@ -71,8 +69,7 @@ discard block |
||
71 | 69 | * @return int|void Integer stack pointer to skip forward or void to continue |
72 | 70 | * normal file processing. |
73 | 71 | */ |
74 | - public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) |
|
75 | - { |
|
72 | + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) { |
|
76 | 73 | if (isset($parameters[3]) === false) { |
77 | 74 | return; |
78 | 75 | } |
@@ -21,8 +21,7 @@ discard block |
||
21 | 21 | * @package PHPCompatibility |
22 | 22 | * @author Juliette Reinders Folmer <[email protected]> |
23 | 23 | */ |
24 | -class NewPackFormatSniff extends AbstractFunctionCallParameterSniff |
|
25 | -{ |
|
24 | +class NewPackFormatSniff extends AbstractFunctionCallParameterSniff { |
|
26 | 25 | |
27 | 26 | /** |
28 | 27 | * Functions to check for. |
@@ -59,8 +58,7 @@ discard block |
||
59 | 58 | * |
60 | 59 | * @return bool |
61 | 60 | */ |
62 | - protected function bowOutEarly() |
|
63 | - { |
|
61 | + protected function bowOutEarly() { |
|
64 | 62 | return ($this->supportsBelow('7.1') === false); |
65 | 63 | } |
66 | 64 | |
@@ -76,8 +74,7 @@ discard block |
||
76 | 74 | * @return int|void Integer stack pointer to skip forward or void to continue |
77 | 75 | * normal file processing. |
78 | 76 | */ |
79 | - public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) |
|
80 | - { |
|
77 | + public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) { |
|
81 | 78 | if (isset($parameters[1]) === false) { |
82 | 79 | return; |
83 | 80 | } |