@@ -16,52 +16,52 @@ |
||
16 | 16 | { |
17 | 17 | |
18 | 18 | |
19 | - /** |
|
20 | - * Returns an array of tokens this test wants to listen for. |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function register() |
|
25 | - { |
|
26 | - return [ |
|
27 | - T_LOGICAL_AND, |
|
28 | - T_LOGICAL_OR, |
|
29 | - ]; |
|
19 | + /** |
|
20 | + * Returns an array of tokens this test wants to listen for. |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function register() |
|
25 | + { |
|
26 | + return [ |
|
27 | + T_LOGICAL_AND, |
|
28 | + T_LOGICAL_OR, |
|
29 | + ]; |
|
30 | 30 | |
31 | - }//end register() |
|
31 | + }//end register() |
|
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * Processes this test, when one of its tokens is encountered. |
|
36 | - * |
|
37 | - * @param \PHP_CodeSniffer\Files\File $phpcsFile The current file being scanned. |
|
38 | - * @param int $stackPtr The position of the current token in the |
|
39 | - * stack passed in $tokens. |
|
40 | - * |
|
41 | - * @return void |
|
42 | - */ |
|
43 | - public function process(File $phpcsFile, $stackPtr) |
|
44 | - { |
|
45 | - $tokens = $phpcsFile->getTokens(); |
|
34 | + /** |
|
35 | + * Processes this test, when one of its tokens is encountered. |
|
36 | + * |
|
37 | + * @param \PHP_CodeSniffer\Files\File $phpcsFile The current file being scanned. |
|
38 | + * @param int $stackPtr The position of the current token in the |
|
39 | + * stack passed in $tokens. |
|
40 | + * |
|
41 | + * @return void |
|
42 | + */ |
|
43 | + public function process(File $phpcsFile, $stackPtr) |
|
44 | + { |
|
45 | + $tokens = $phpcsFile->getTokens(); |
|
46 | 46 | |
47 | - $replacements = [ |
|
48 | - 'and' => '&&', |
|
49 | - 'or' => '||', |
|
50 | - ]; |
|
47 | + $replacements = [ |
|
48 | + 'and' => '&&', |
|
49 | + 'or' => '||', |
|
50 | + ]; |
|
51 | 51 | |
52 | - $operator = strtolower($tokens[$stackPtr]['content']); |
|
53 | - if (isset($replacements[$operator]) === false) { |
|
54 | - return; |
|
55 | - } |
|
52 | + $operator = strtolower($tokens[$stackPtr]['content']); |
|
53 | + if (isset($replacements[$operator]) === false) { |
|
54 | + return; |
|
55 | + } |
|
56 | 56 | |
57 | - $error = 'Logical operator "%s" is prohibited; use "%s" instead'; |
|
58 | - $data = [ |
|
59 | - $operator, |
|
60 | - $replacements[$operator], |
|
61 | - ]; |
|
62 | - $phpcsFile->addError($error, $stackPtr, 'NotAllowed', $data); |
|
57 | + $error = 'Logical operator "%s" is prohibited; use "%s" instead'; |
|
58 | + $data = [ |
|
59 | + $operator, |
|
60 | + $replacements[$operator], |
|
61 | + ]; |
|
62 | + $phpcsFile->addError($error, $stackPtr, 'NotAllowed', $data); |
|
63 | 63 | |
64 | - }//end process() |
|
64 | + }//end process() |
|
65 | 65 | |
66 | 66 | |
67 | 67 | }//end class |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | function myFunction($variable) { |
3 | - // $variable is unused. |
|
4 | - echo 'hi'; |
|
3 | + // $variable is unused. |
|
4 | + echo 'hi'; |
|
5 | 5 | } |
6 | 6 | ?> |
@@ -4,5 +4,5 @@ |
||
4 | 4 | //some code |
5 | 5 | function foo() |
6 | 6 | { |
7 | - return 'bar'; |
|
7 | + return 'bar'; |
|
8 | 8 | } |
@@ -2,5 +2,5 @@ |
||
2 | 2 | define("MAXSIZE", 100); |
3 | 3 | $defined = true; |
4 | 4 | if (defined('MINSIZE') === false) { |
5 | - $defined = false; |
|
5 | + $defined = false; |
|
6 | 6 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | const CONSTANT2 = 2; |
6 | 6 | |
7 | 7 | if ($something) { |
8 | - echo 'hi'; |
|
8 | + echo 'hi'; |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | $var = myFunction(); |
@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | |
17 | 17 | $c = new class extends Something{ |
18 | 18 | |
19 | - public function someMethod() |
|
20 | - { |
|
21 | - // ... |
|
22 | - } |
|
19 | + public function someMethod() |
|
20 | + { |
|
21 | + // ... |
|
22 | + } |
|
23 | 23 | |
24 | 24 | }; |
@@ -14,7 +14,7 @@ |
||
14 | 14 | echo $object -> define(); |
15 | 15 | Foo::define(); |
16 | 16 | |
17 | -$c = new class extends Something{ |
|
17 | +$c = new class extends Something { |
|
18 | 18 | |
19 | 19 | public function someMethod() |
20 | 20 | { |
@@ -4,5 +4,5 @@ |
||
4 | 4 | // phpcs:enable |
5 | 5 | $defined = true; |
6 | 6 | if (defined('MINSIZE') === false) { |
7 | - $defined = false; |
|
7 | + $defined = false; |
|
8 | 8 | } |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <html> |
2 | 2 | <?php |
3 | 3 | function printHead() { |
4 | - echo '<head></head>'; |
|
4 | + echo '<head></head>'; |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | printHead(); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return array<int, int> |
27 | 27 | */ |
28 | - public function getErrorList($testFile='') |
|
28 | + public function getErrorList($testFile = '') |
|
29 | 29 | { |
30 | 30 | return []; |
31 | 31 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return array<int, int> |
44 | 44 | */ |
45 | - public function getWarningList($testFile='') |
|
45 | + public function getWarningList($testFile = '') |
|
46 | 46 | { |
47 | 47 | switch ($testFile) { |
48 | 48 | case 'SideEffectsUnitTest.3.inc': |
@@ -15,66 +15,66 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * Set CLI values before the file is tested. |
|
20 | - * |
|
21 | - * @param string $testFile The name of the file being tested. |
|
22 | - * @param \PHP_CodeSniffer\Config $config The config data for the test run. |
|
23 | - * |
|
24 | - * @return void |
|
25 | - */ |
|
26 | - public function setCliValues($testFile, $config) |
|
27 | - { |
|
28 | - if ($testFile === 'SideEffectsUnitTest.12.inc') { |
|
29 | - $config->annotations = false; |
|
30 | - } |
|
18 | + /** |
|
19 | + * Set CLI values before the file is tested. |
|
20 | + * |
|
21 | + * @param string $testFile The name of the file being tested. |
|
22 | + * @param \PHP_CodeSniffer\Config $config The config data for the test run. |
|
23 | + * |
|
24 | + * @return void |
|
25 | + */ |
|
26 | + public function setCliValues($testFile, $config) |
|
27 | + { |
|
28 | + if ($testFile === 'SideEffectsUnitTest.12.inc') { |
|
29 | + $config->annotations = false; |
|
30 | + } |
|
31 | 31 | |
32 | - }//end setCliValues() |
|
32 | + }//end setCliValues() |
|
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * Returns the lines where errors should occur. |
|
37 | - * |
|
38 | - * The key of the array should represent the line number and the value |
|
39 | - * should represent the number of errors that should occur on that line. |
|
40 | - * |
|
41 | - * @param string $testFile The name of the file being tested. |
|
42 | - * |
|
43 | - * @return array<int, int> |
|
44 | - */ |
|
45 | - public function getErrorList($testFile='') |
|
46 | - { |
|
47 | - return []; |
|
35 | + /** |
|
36 | + * Returns the lines where errors should occur. |
|
37 | + * |
|
38 | + * The key of the array should represent the line number and the value |
|
39 | + * should represent the number of errors that should occur on that line. |
|
40 | + * |
|
41 | + * @param string $testFile The name of the file being tested. |
|
42 | + * |
|
43 | + * @return array<int, int> |
|
44 | + */ |
|
45 | + public function getErrorList($testFile='') |
|
46 | + { |
|
47 | + return []; |
|
48 | 48 | |
49 | - }//end getErrorList() |
|
49 | + }//end getErrorList() |
|
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * Returns the lines where warnings should occur. |
|
54 | - * |
|
55 | - * The key of the array should represent the line number and the value |
|
56 | - * should represent the number of warnings that should occur on that line. |
|
57 | - * |
|
58 | - * @param string $testFile The name of the file being tested. |
|
59 | - * |
|
60 | - * @return array<int, int> |
|
61 | - */ |
|
62 | - public function getWarningList($testFile='') |
|
63 | - { |
|
64 | - switch ($testFile) { |
|
65 | - case 'SideEffectsUnitTest.3.inc': |
|
66 | - case 'SideEffectsUnitTest.4.inc': |
|
67 | - case 'SideEffectsUnitTest.5.inc': |
|
68 | - case 'SideEffectsUnitTest.10.inc': |
|
69 | - case 'SideEffectsUnitTest.12.inc': |
|
70 | - case 'SideEffectsUnitTest.15.inc': |
|
71 | - case 'SideEffectsUnitTest.16.inc': |
|
72 | - return [1 => 1]; |
|
73 | - default: |
|
74 | - return []; |
|
75 | - }//end switch |
|
52 | + /** |
|
53 | + * Returns the lines where warnings should occur. |
|
54 | + * |
|
55 | + * The key of the array should represent the line number and the value |
|
56 | + * should represent the number of warnings that should occur on that line. |
|
57 | + * |
|
58 | + * @param string $testFile The name of the file being tested. |
|
59 | + * |
|
60 | + * @return array<int, int> |
|
61 | + */ |
|
62 | + public function getWarningList($testFile='') |
|
63 | + { |
|
64 | + switch ($testFile) { |
|
65 | + case 'SideEffectsUnitTest.3.inc': |
|
66 | + case 'SideEffectsUnitTest.4.inc': |
|
67 | + case 'SideEffectsUnitTest.5.inc': |
|
68 | + case 'SideEffectsUnitTest.10.inc': |
|
69 | + case 'SideEffectsUnitTest.12.inc': |
|
70 | + case 'SideEffectsUnitTest.15.inc': |
|
71 | + case 'SideEffectsUnitTest.16.inc': |
|
72 | + return [1 => 1]; |
|
73 | + default: |
|
74 | + return []; |
|
75 | + }//end switch |
|
76 | 76 | |
77 | - }//end getWarningList() |
|
77 | + }//end getWarningList() |
|
78 | 78 | |
79 | 79 | |
80 | 80 | }//end class |
@@ -62,16 +62,16 @@ |
||
62 | 62 | public function getWarningList($testFile='') |
63 | 63 | { |
64 | 64 | switch ($testFile) { |
65 | - case 'SideEffectsUnitTest.3.inc': |
|
66 | - case 'SideEffectsUnitTest.4.inc': |
|
67 | - case 'SideEffectsUnitTest.5.inc': |
|
68 | - case 'SideEffectsUnitTest.10.inc': |
|
69 | - case 'SideEffectsUnitTest.12.inc': |
|
70 | - case 'SideEffectsUnitTest.15.inc': |
|
71 | - case 'SideEffectsUnitTest.16.inc': |
|
72 | - return [1 => 1]; |
|
73 | - default: |
|
74 | - return []; |
|
65 | + case 'SideEffectsUnitTest.3.inc': |
|
66 | + case 'SideEffectsUnitTest.4.inc': |
|
67 | + case 'SideEffectsUnitTest.5.inc': |
|
68 | + case 'SideEffectsUnitTest.10.inc': |
|
69 | + case 'SideEffectsUnitTest.12.inc': |
|
70 | + case 'SideEffectsUnitTest.15.inc': |
|
71 | + case 'SideEffectsUnitTest.16.inc': |
|
72 | + return [1 => 1]; |
|
73 | + default: |
|
74 | + return []; |
|
75 | 75 | }//end switch |
76 | 76 | |
77 | 77 | }//end getWarningList() |
@@ -4,7 +4,7 @@ |
||
4 | 4 | define("MAXSIZE", 100); |
5 | 5 | $defined = true; |
6 | 6 | if (defined('MINSIZE') === false) { |
7 | - $defined = false; |
|
7 | + $defined = false; |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | // phpcs:enable PEAR |