@@ -15,8 +15,7 @@ discard block |
||
15 | 15 | use PHP_CodeSniffer\Sniffs\Sniff; |
16 | 16 | use PHP_CodeSniffer\Files\File; |
17 | 17 | |
18 | -class ForbiddenFunctionsSniff implements Sniff |
|
19 | -{ |
|
18 | +class ForbiddenFunctionsSniff implements Sniff { |
|
20 | 19 | |
21 | 20 | /** |
22 | 21 | * A list of forbidden functions with their alternatives. |
@@ -58,8 +57,7 @@ discard block |
||
58 | 57 | * |
59 | 58 | * @return array |
60 | 59 | */ |
61 | - public function register() |
|
62 | - { |
|
60 | + public function register() { |
|
63 | 61 | // Everyone has had a chance to figure out what forbidden functions |
64 | 62 | // they want to check for, so now we can cache out the list. |
65 | 63 | $this->forbiddenFunctionNames = array_keys($this->forbiddenFunctions); |
@@ -115,8 +113,7 @@ discard block |
||
115 | 113 | * |
116 | 114 | * @return void |
117 | 115 | */ |
118 | - public function process(File $phpcsFile, $stackPtr) |
|
119 | - { |
|
116 | + public function process(File $phpcsFile, $stackPtr) { |
|
120 | 117 | $tokens = $phpcsFile->getTokens(); |
121 | 118 | |
122 | 119 | $ignore = [ |
@@ -203,8 +200,7 @@ discard block |
||
203 | 200 | * |
204 | 201 | * @return void |
205 | 202 | */ |
206 | - protected function addError($phpcsFile, $stackPtr, $function, $pattern=null) |
|
207 | - { |
|
203 | + protected function addError($phpcsFile, $stackPtr, $function, $pattern=null) { |
|
208 | 204 | $data = [$function]; |
209 | 205 | $error = 'The use of function %s() is '; |
210 | 206 | if ($this->error === true) { |
@@ -10,8 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace PHP_CodeSniffer\Standards\Generic\Sniffs\PHP; |
12 | 12 | |
13 | -class DeprecatedFunctionsSniff extends ForbiddenFunctionsSniff |
|
14 | -{ |
|
13 | +class DeprecatedFunctionsSniff extends ForbiddenFunctionsSniff { |
|
15 | 14 | |
16 | 15 | /** |
17 | 16 | * A list of forbidden functions with their alternatives. |
@@ -29,8 +28,7 @@ discard block |
||
29 | 28 | * |
30 | 29 | * Uses the Reflection API to get a list of deprecated functions. |
31 | 30 | */ |
32 | - public function __construct() |
|
33 | - { |
|
31 | + public function __construct() { |
|
34 | 32 | $functions = get_defined_functions(); |
35 | 33 | |
36 | 34 | foreach ($functions['internal'] as $functionName) { |
@@ -58,8 +56,7 @@ discard block |
||
58 | 56 | * |
59 | 57 | * @return void |
60 | 58 | */ |
61 | - protected function addError($phpcsFile, $stackPtr, $function, $pattern=null) |
|
62 | - { |
|
59 | + protected function addError($phpcsFile, $stackPtr, $function, $pattern=null) { |
|
63 | 60 | $data = [$function]; |
64 | 61 | $error = 'Function %s() has been deprecated'; |
65 | 62 | $type = 'Deprecated'; |
@@ -19,8 +19,7 @@ discard block |
||
19 | 19 | use PHP_CodeSniffer\Sniffs\Sniff; |
20 | 20 | use PHP_CodeSniffer\Files\File; |
21 | 21 | |
22 | -class NoSilencedErrorsSniff implements Sniff |
|
23 | -{ |
|
22 | +class NoSilencedErrorsSniff implements Sniff { |
|
24 | 23 | |
25 | 24 | /** |
26 | 25 | * If true, an error will be thrown; otherwise a warning. |
@@ -35,8 +34,7 @@ discard block |
||
35 | 34 | * |
36 | 35 | * @return array |
37 | 36 | */ |
38 | - public function register() |
|
39 | - { |
|
37 | + public function register() { |
|
40 | 38 | return [T_ASPERAND]; |
41 | 39 | |
42 | 40 | }//end register() |
@@ -51,8 +49,7 @@ discard block |
||
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 | // Prepare the "Found" string to display. |
57 | 54 | $contextLength = 4; |
58 | 55 | $endOfStatement = $phpcsFile->findEndOfStatement($stackPtr, T_COMMA); |
@@ -12,8 +12,7 @@ discard block |
||
12 | 12 | use PHP_CodeSniffer\Sniffs\Sniff; |
13 | 13 | use PHP_CodeSniffer\Files\File; |
14 | 14 | |
15 | -class DiscourageGotoSniff implements Sniff |
|
16 | -{ |
|
15 | +class DiscourageGotoSniff implements Sniff { |
|
17 | 16 | |
18 | 17 | |
19 | 18 | /** |
@@ -21,8 +20,7 @@ discard block |
||
21 | 20 | * |
22 | 21 | * @return array |
23 | 22 | */ |
24 | - public function register() |
|
25 | - { |
|
23 | + public function register() { |
|
26 | 24 | return [ |
27 | 25 | T_GOTO, |
28 | 26 | T_GOTO_LABEL, |
@@ -40,8 +38,7 @@ discard block |
||
40 | 38 | * |
41 | 39 | * @return void |
42 | 40 | */ |
43 | - public function process(File $phpcsFile, $stackPtr) |
|
44 | - { |
|
41 | + public function process(File $phpcsFile, $stackPtr) { |
|
45 | 42 | $phpcsFile->addWarning('Use of the GOTO language construct is discouraged', $stackPtr, 'Found'); |
46 | 43 | |
47 | 44 | }//end process() |
@@ -12,8 +12,7 @@ discard block |
||
12 | 12 | use PHP_CodeSniffer\Sniffs\Sniff; |
13 | 13 | use PHP_CodeSniffer\Files\File; |
14 | 14 | |
15 | -class GitMergeConflictSniff implements Sniff |
|
16 | -{ |
|
15 | +class GitMergeConflictSniff implements Sniff { |
|
17 | 16 | |
18 | 17 | /** |
19 | 18 | * A list of tokenizers this sniff supports. |
@@ -32,8 +31,7 @@ discard block |
||
32 | 31 | * |
33 | 32 | * @return array |
34 | 33 | */ |
35 | - public function register() |
|
36 | - { |
|
34 | + public function register() { |
|
37 | 35 | return [T_OPEN_TAG]; |
38 | 36 | |
39 | 37 | }//end register() |
@@ -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 | $tokens = $phpcsFile->getTokens(); |
54 | 51 | $error = 'Merge conflict boundary found; type: %s'; |
55 | 52 |
@@ -13,8 +13,7 @@ discard block |
||
13 | 13 | use PHP_CodeSniffer\Sniffs\Sniff; |
14 | 14 | use PHP_CodeSniffer\Files\File; |
15 | 15 | |
16 | -class SubversionPropertiesSniff implements Sniff |
|
17 | -{ |
|
16 | +class SubversionPropertiesSniff implements Sniff { |
|
18 | 17 | |
19 | 18 | /** |
20 | 19 | * The Subversion properties that should be set. |
@@ -36,8 +35,7 @@ discard block |
||
36 | 35 | * |
37 | 36 | * @return array |
38 | 37 | */ |
39 | - public function register() |
|
40 | - { |
|
38 | + public function register() { |
|
41 | 39 | return [T_OPEN_TAG]; |
42 | 40 | |
43 | 41 | }//end register() |
@@ -52,8 +50,7 @@ discard block |
||
52 | 50 | * |
53 | 51 | * @return void |
54 | 52 | */ |
55 | - public function process(File $phpcsFile, $stackPtr) |
|
56 | - { |
|
53 | + public function process(File $phpcsFile, $stackPtr) { |
|
57 | 54 | $path = $phpcsFile->getFileName(); |
58 | 55 | $properties = $this->getProperties($path); |
59 | 56 | if ($properties === null) { |
@@ -117,8 +114,7 @@ discard block |
||
117 | 114 | * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If Subversion properties file could |
118 | 115 | * not be opened. |
119 | 116 | */ |
120 | - protected function getProperties($path) |
|
121 | - { |
|
117 | + protected function getProperties($path) { |
|
122 | 118 | $properties = []; |
123 | 119 | |
124 | 120 | $paths = []; |
@@ -12,8 +12,7 @@ discard block |
||
12 | 12 | use PHP_CodeSniffer\Sniffs\Sniff; |
13 | 13 | use PHP_CodeSniffer\Files\File; |
14 | 14 | |
15 | -class DuplicateClassNameSniff implements Sniff |
|
16 | -{ |
|
15 | +class DuplicateClassNameSniff implements Sniff { |
|
17 | 16 | |
18 | 17 | /** |
19 | 18 | * List of classes that have been found during checking. |
@@ -28,8 +27,7 @@ discard block |
||
28 | 27 | * |
29 | 28 | * @return int[] |
30 | 29 | */ |
31 | - public function register() |
|
32 | - { |
|
30 | + public function register() { |
|
33 | 31 | return [T_OPEN_TAG]; |
34 | 32 | |
35 | 33 | }//end register() |
@@ -44,8 +42,7 @@ discard block |
||
44 | 42 | * |
45 | 43 | * @return void |
46 | 44 | */ |
47 | - public function process(File $phpcsFile, $stackPtr) |
|
48 | - { |
|
45 | + public function process(File $phpcsFile, $stackPtr) { |
|
49 | 46 | $tokens = $phpcsFile->getTokens(); |
50 | 47 | |
51 | 48 | $namespace = ''; |
@@ -12,8 +12,7 @@ discard block |
||
12 | 12 | use PHP_CodeSniffer\Sniffs\Sniff; |
13 | 13 | use PHP_CodeSniffer\Files\File; |
14 | 14 | |
15 | -class OpeningBraceSameLineSniff implements Sniff |
|
16 | -{ |
|
15 | +class OpeningBraceSameLineSniff implements Sniff { |
|
17 | 16 | |
18 | 17 | |
19 | 18 | /** |
@@ -21,8 +20,7 @@ discard block |
||
21 | 20 | * |
22 | 21 | * @return array |
23 | 22 | */ |
24 | - public function register() |
|
25 | - { |
|
23 | + public function register() { |
|
26 | 24 | return [ |
27 | 25 | T_CLASS, |
28 | 26 | T_INTERFACE, |
@@ -41,8 +39,7 @@ discard block |
||
41 | 39 | * |
42 | 40 | * @return void |
43 | 41 | */ |
44 | - public function process(File $phpcsFile, $stackPtr) |
|
45 | - { |
|
42 | + public function process(File $phpcsFile, $stackPtr) { |
|
46 | 43 | $tokens = $phpcsFile->getTokens(); |
47 | 44 | $scopeIdentifier = $phpcsFile->findNext(T_STRING, ($stackPtr + 1)); |
48 | 45 | $errorData = [strtolower($tokens[$stackPtr]['content']).' '.$tokens[$scopeIdentifier]['content']]; |
@@ -32,8 +32,7 @@ discard block |
||
32 | 32 | use PHP_CodeSniffer\Sniffs\Sniff; |
33 | 33 | use PHP_CodeSniffer\Files\File; |
34 | 34 | |
35 | -class JumbledIncrementerSniff implements Sniff |
|
36 | -{ |
|
35 | +class JumbledIncrementerSniff implements Sniff { |
|
37 | 36 | |
38 | 37 | |
39 | 38 | /** |
@@ -41,8 +40,7 @@ discard block |
||
41 | 40 | * |
42 | 41 | * @return int[] |
43 | 42 | */ |
44 | - public function register() |
|
45 | - { |
|
43 | + public function register() { |
|
46 | 44 | return [T_FOR]; |
47 | 45 | |
48 | 46 | }//end register() |
@@ -57,8 +55,7 @@ discard block |
||
57 | 55 | * |
58 | 56 | * @return void |
59 | 57 | */ |
60 | - public function process(File $phpcsFile, $stackPtr) |
|
61 | - { |
|
58 | + public function process(File $phpcsFile, $stackPtr) { |
|
62 | 59 | $tokens = $phpcsFile->getTokens(); |
63 | 60 | $token = $tokens[$stackPtr]; |
64 | 61 | |
@@ -105,8 +102,7 @@ discard block |
||
105 | 102 | * |
106 | 103 | * @return string[] List of all found incrementer variables. |
107 | 104 | */ |
108 | - protected function findIncrementers(array $tokens, array $token) |
|
109 | - { |
|
105 | + protected function findIncrementers(array $tokens, array $token) { |
|
110 | 106 | // Skip invalid statement. |
111 | 107 | if (isset($token['parenthesis_opener']) === false) { |
112 | 108 | return []; |