@@ -15,52 +15,52 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * Returns the lines where errors should occur. |
|
20 | - * |
|
21 | - * The key of the array should represent the line number and the value |
|
22 | - * should represent the number of errors that should occur on that line. |
|
23 | - * |
|
24 | - * @param string $testFile The name of the file being tested. |
|
25 | - * |
|
26 | - * @return array<int, int> |
|
27 | - */ |
|
28 | - public function getErrorList($testFile='IncrementDecrementSpacingUnitTest.inc') |
|
29 | - { |
|
30 | - switch ($testFile) { |
|
31 | - case 'IncrementDecrementSpacingUnitTest.inc': |
|
32 | - case 'IncrementDecrementSpacingUnitTest.js': |
|
33 | - return [ |
|
34 | - 5 => 1, |
|
35 | - 6 => 1, |
|
36 | - 8 => 1, |
|
37 | - 10 => 1, |
|
38 | - 13 => 1, |
|
39 | - 14 => 1, |
|
40 | - 16 => 1, |
|
41 | - 17 => 1, |
|
42 | - ]; |
|
18 | + /** |
|
19 | + * Returns the lines where errors should occur. |
|
20 | + * |
|
21 | + * The key of the array should represent the line number and the value |
|
22 | + * should represent the number of errors that should occur on that line. |
|
23 | + * |
|
24 | + * @param string $testFile The name of the file being tested. |
|
25 | + * |
|
26 | + * @return array<int, int> |
|
27 | + */ |
|
28 | + public function getErrorList($testFile='IncrementDecrementSpacingUnitTest.inc') |
|
29 | + { |
|
30 | + switch ($testFile) { |
|
31 | + case 'IncrementDecrementSpacingUnitTest.inc': |
|
32 | + case 'IncrementDecrementSpacingUnitTest.js': |
|
33 | + return [ |
|
34 | + 5 => 1, |
|
35 | + 6 => 1, |
|
36 | + 8 => 1, |
|
37 | + 10 => 1, |
|
38 | + 13 => 1, |
|
39 | + 14 => 1, |
|
40 | + 16 => 1, |
|
41 | + 17 => 1, |
|
42 | + ]; |
|
43 | 43 | |
44 | - default: |
|
45 | - return []; |
|
46 | - }//end switch |
|
44 | + default: |
|
45 | + return []; |
|
46 | + }//end switch |
|
47 | 47 | |
48 | - }//end getErrorList() |
|
48 | + }//end getErrorList() |
|
49 | 49 | |
50 | 50 | |
51 | - /** |
|
52 | - * Returns the lines where warnings should occur. |
|
53 | - * |
|
54 | - * The key of the array should represent the line number and the value |
|
55 | - * should represent the number of warnings that should occur on that line. |
|
56 | - * |
|
57 | - * @return array<int, int> |
|
58 | - */ |
|
59 | - public function getWarningList() |
|
60 | - { |
|
61 | - return []; |
|
51 | + /** |
|
52 | + * Returns the lines where warnings should occur. |
|
53 | + * |
|
54 | + * The key of the array should represent the line number and the value |
|
55 | + * should represent the number of warnings that should occur on that line. |
|
56 | + * |
|
57 | + * @return array<int, int> |
|
58 | + */ |
|
59 | + public function getWarningList() |
|
60 | + { |
|
61 | + return []; |
|
62 | 62 | |
63 | - }//end getWarningList() |
|
63 | + }//end getWarningList() |
|
64 | 64 | |
65 | 65 | |
66 | 66 | }//end class |
@@ -28,21 +28,21 @@ |
||
28 | 28 | public function getErrorList($testFile='IncrementDecrementSpacingUnitTest.inc') |
29 | 29 | { |
30 | 30 | switch ($testFile) { |
31 | - case 'IncrementDecrementSpacingUnitTest.inc': |
|
32 | - case 'IncrementDecrementSpacingUnitTest.js': |
|
33 | - return [ |
|
34 | - 5 => 1, |
|
35 | - 6 => 1, |
|
36 | - 8 => 1, |
|
37 | - 10 => 1, |
|
38 | - 13 => 1, |
|
39 | - 14 => 1, |
|
40 | - 16 => 1, |
|
41 | - 17 => 1, |
|
42 | - ]; |
|
31 | + case 'IncrementDecrementSpacingUnitTest.inc': |
|
32 | + case 'IncrementDecrementSpacingUnitTest.js': |
|
33 | + return [ |
|
34 | + 5 => 1, |
|
35 | + 6 => 1, |
|
36 | + 8 => 1, |
|
37 | + 10 => 1, |
|
38 | + 13 => 1, |
|
39 | + 14 => 1, |
|
40 | + 16 => 1, |
|
41 | + 17 => 1, |
|
42 | + ]; |
|
43 | 43 | |
44 | - default: |
|
45 | - return []; |
|
44 | + default: |
|
45 | + return []; |
|
46 | 46 | }//end switch |
47 | 47 | |
48 | 48 | }//end getErrorList() |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return array<int, int> |
27 | 27 | */ |
28 | - public function getErrorList($testFile='IncrementDecrementSpacingUnitTest.inc') |
|
28 | + public function getErrorList( $testFile = 'IncrementDecrementSpacingUnitTest.inc' ) |
|
29 | 29 | { |
30 | - switch ($testFile) { |
|
30 | + switch ( $testFile ) { |
|
31 | 31 | case 'IncrementDecrementSpacingUnitTest.inc': |
32 | 32 | case 'IncrementDecrementSpacingUnitTest.js': |
33 | 33 | return [ |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | ]; |
43 | 43 | |
44 | 44 | default: |
45 | - return []; |
|
45 | + return [ ]; |
|
46 | 46 | }//end switch |
47 | 47 | |
48 | 48 | }//end getErrorList() |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function getWarningList() |
60 | 60 | { |
61 | - return []; |
|
61 | + return [ ]; |
|
62 | 62 | |
63 | 63 | }//end getWarningList() |
64 | 64 |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class IncrementDecrementSpacingUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class IncrementDecrementSpacingUnitTest extends AbstractSniffUnitTest { |
|
16 | 15 | |
17 | 16 | |
18 | 17 | /** |
@@ -25,8 +24,7 @@ discard block |
||
25 | 24 | * |
26 | 25 | * @return array<int, int> |
27 | 26 | */ |
28 | - public function getErrorList($testFile='IncrementDecrementSpacingUnitTest.inc') |
|
29 | - { |
|
27 | + public function getErrorList($testFile='IncrementDecrementSpacingUnitTest.inc') { |
|
30 | 28 | switch ($testFile) { |
31 | 29 | case 'IncrementDecrementSpacingUnitTest.inc': |
32 | 30 | case 'IncrementDecrementSpacingUnitTest.js': |
@@ -56,8 +54,7 @@ discard block |
||
56 | 54 | * |
57 | 55 | * @return array<int, int> |
58 | 56 | */ |
59 | - public function getWarningList() |
|
60 | - { |
|
57 | + public function getWarningList() { |
|
61 | 58 | return []; |
62 | 59 | |
63 | 60 | }//end getWarningList() |
@@ -15,109 +15,109 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * Get a list of CLI values to set 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 | - $config->tabWidth = 4; |
|
18 | + /** |
|
19 | + * Get a list of CLI values to set 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 | + $config->tabWidth = 4; |
|
29 | 29 | |
30 | - }//end setCliValues() |
|
30 | + }//end setCliValues() |
|
31 | 31 | |
32 | 32 | |
33 | - /** |
|
34 | - * Returns the lines where errors should occur. |
|
35 | - * |
|
36 | - * The key of the array should represent the line number and the value |
|
37 | - * should represent the number of errors that should occur on that line. |
|
38 | - * |
|
39 | - * @param string $testFile The name of the file being tested. |
|
40 | - * |
|
41 | - * @return array<int, int> |
|
42 | - */ |
|
43 | - public function getErrorList($testFile='DisallowTabIndentUnitTest.inc') |
|
44 | - { |
|
45 | - switch ($testFile) { |
|
46 | - case 'DisallowTabIndentUnitTest.inc': |
|
47 | - return [ |
|
48 | - 5 => 2, |
|
49 | - 9 => 1, |
|
50 | - 15 => 1, |
|
51 | - 20 => 2, |
|
52 | - 21 => 1, |
|
53 | - 22 => 2, |
|
54 | - 23 => 1, |
|
55 | - 24 => 2, |
|
56 | - 31 => 1, |
|
57 | - 32 => 2, |
|
58 | - 33 => 2, |
|
59 | - 41 => 1, |
|
60 | - 42 => 1, |
|
61 | - 43 => 1, |
|
62 | - 44 => 1, |
|
63 | - 45 => 1, |
|
64 | - 46 => 1, |
|
65 | - 47 => 1, |
|
66 | - 48 => 1, |
|
67 | - 54 => 1, |
|
68 | - 55 => 1, |
|
69 | - 56 => 1, |
|
70 | - 57 => 1, |
|
71 | - 58 => 1, |
|
72 | - 59 => 1, |
|
73 | - 79 => 1, |
|
74 | - 80 => 1, |
|
75 | - 81 => 1, |
|
76 | - 82 => 1, |
|
77 | - 83 => 1, |
|
78 | - 85 => 1, |
|
79 | - 86 => 1, |
|
80 | - 87 => 1, |
|
81 | - 89 => 1, |
|
82 | - 90 => 1, |
|
83 | - 92 => 1, |
|
84 | - 93 => 1, |
|
85 | - ]; |
|
86 | - break; |
|
87 | - case 'DisallowTabIndentUnitTest.js': |
|
88 | - return [ |
|
89 | - 3 => 1, |
|
90 | - 5 => 1, |
|
91 | - 6 => 1, |
|
92 | - ]; |
|
93 | - break; |
|
94 | - case 'DisallowTabIndentUnitTest.css': |
|
95 | - return [ |
|
96 | - 1 => 1, |
|
97 | - 2 => 1, |
|
98 | - ]; |
|
99 | - break; |
|
100 | - default: |
|
101 | - return []; |
|
102 | - break; |
|
103 | - }//end switch |
|
33 | + /** |
|
34 | + * Returns the lines where errors should occur. |
|
35 | + * |
|
36 | + * The key of the array should represent the line number and the value |
|
37 | + * should represent the number of errors that should occur on that line. |
|
38 | + * |
|
39 | + * @param string $testFile The name of the file being tested. |
|
40 | + * |
|
41 | + * @return array<int, int> |
|
42 | + */ |
|
43 | + public function getErrorList($testFile='DisallowTabIndentUnitTest.inc') |
|
44 | + { |
|
45 | + switch ($testFile) { |
|
46 | + case 'DisallowTabIndentUnitTest.inc': |
|
47 | + return [ |
|
48 | + 5 => 2, |
|
49 | + 9 => 1, |
|
50 | + 15 => 1, |
|
51 | + 20 => 2, |
|
52 | + 21 => 1, |
|
53 | + 22 => 2, |
|
54 | + 23 => 1, |
|
55 | + 24 => 2, |
|
56 | + 31 => 1, |
|
57 | + 32 => 2, |
|
58 | + 33 => 2, |
|
59 | + 41 => 1, |
|
60 | + 42 => 1, |
|
61 | + 43 => 1, |
|
62 | + 44 => 1, |
|
63 | + 45 => 1, |
|
64 | + 46 => 1, |
|
65 | + 47 => 1, |
|
66 | + 48 => 1, |
|
67 | + 54 => 1, |
|
68 | + 55 => 1, |
|
69 | + 56 => 1, |
|
70 | + 57 => 1, |
|
71 | + 58 => 1, |
|
72 | + 59 => 1, |
|
73 | + 79 => 1, |
|
74 | + 80 => 1, |
|
75 | + 81 => 1, |
|
76 | + 82 => 1, |
|
77 | + 83 => 1, |
|
78 | + 85 => 1, |
|
79 | + 86 => 1, |
|
80 | + 87 => 1, |
|
81 | + 89 => 1, |
|
82 | + 90 => 1, |
|
83 | + 92 => 1, |
|
84 | + 93 => 1, |
|
85 | + ]; |
|
86 | + break; |
|
87 | + case 'DisallowTabIndentUnitTest.js': |
|
88 | + return [ |
|
89 | + 3 => 1, |
|
90 | + 5 => 1, |
|
91 | + 6 => 1, |
|
92 | + ]; |
|
93 | + break; |
|
94 | + case 'DisallowTabIndentUnitTest.css': |
|
95 | + return [ |
|
96 | + 1 => 1, |
|
97 | + 2 => 1, |
|
98 | + ]; |
|
99 | + break; |
|
100 | + default: |
|
101 | + return []; |
|
102 | + break; |
|
103 | + }//end switch |
|
104 | 104 | |
105 | - }//end getErrorList() |
|
105 | + }//end getErrorList() |
|
106 | 106 | |
107 | 107 | |
108 | - /** |
|
109 | - * Returns the lines where warnings should occur. |
|
110 | - * |
|
111 | - * The key of the array should represent the line number and the value |
|
112 | - * should represent the number of warnings that should occur on that line. |
|
113 | - * |
|
114 | - * @return array<int, int> |
|
115 | - */ |
|
116 | - public function getWarningList() |
|
117 | - { |
|
118 | - return []; |
|
108 | + /** |
|
109 | + * Returns the lines where warnings should occur. |
|
110 | + * |
|
111 | + * The key of the array should represent the line number and the value |
|
112 | + * should represent the number of warnings that should occur on that line. |
|
113 | + * |
|
114 | + * @return array<int, int> |
|
115 | + */ |
|
116 | + public function getWarningList() |
|
117 | + { |
|
118 | + return []; |
|
119 | 119 | |
120 | - }//end getWarningList() |
|
120 | + }//end getWarningList() |
|
121 | 121 | |
122 | 122 | |
123 | 123 | }//end class |
@@ -43,63 +43,63 @@ |
||
43 | 43 | public function getErrorList($testFile='DisallowTabIndentUnitTest.inc') |
44 | 44 | { |
45 | 45 | switch ($testFile) { |
46 | - case 'DisallowTabIndentUnitTest.inc': |
|
47 | - return [ |
|
48 | - 5 => 2, |
|
49 | - 9 => 1, |
|
50 | - 15 => 1, |
|
51 | - 20 => 2, |
|
52 | - 21 => 1, |
|
53 | - 22 => 2, |
|
54 | - 23 => 1, |
|
55 | - 24 => 2, |
|
56 | - 31 => 1, |
|
57 | - 32 => 2, |
|
58 | - 33 => 2, |
|
59 | - 41 => 1, |
|
60 | - 42 => 1, |
|
61 | - 43 => 1, |
|
62 | - 44 => 1, |
|
63 | - 45 => 1, |
|
64 | - 46 => 1, |
|
65 | - 47 => 1, |
|
66 | - 48 => 1, |
|
67 | - 54 => 1, |
|
68 | - 55 => 1, |
|
69 | - 56 => 1, |
|
70 | - 57 => 1, |
|
71 | - 58 => 1, |
|
72 | - 59 => 1, |
|
73 | - 79 => 1, |
|
74 | - 80 => 1, |
|
75 | - 81 => 1, |
|
76 | - 82 => 1, |
|
77 | - 83 => 1, |
|
78 | - 85 => 1, |
|
79 | - 86 => 1, |
|
80 | - 87 => 1, |
|
81 | - 89 => 1, |
|
82 | - 90 => 1, |
|
83 | - 92 => 1, |
|
84 | - 93 => 1, |
|
85 | - ]; |
|
86 | - break; |
|
87 | - case 'DisallowTabIndentUnitTest.js': |
|
88 | - return [ |
|
89 | - 3 => 1, |
|
90 | - 5 => 1, |
|
91 | - 6 => 1, |
|
92 | - ]; |
|
93 | - break; |
|
94 | - case 'DisallowTabIndentUnitTest.css': |
|
95 | - return [ |
|
96 | - 1 => 1, |
|
97 | - 2 => 1, |
|
98 | - ]; |
|
99 | - break; |
|
100 | - default: |
|
101 | - return []; |
|
102 | - break; |
|
46 | + case 'DisallowTabIndentUnitTest.inc': |
|
47 | + return [ |
|
48 | + 5 => 2, |
|
49 | + 9 => 1, |
|
50 | + 15 => 1, |
|
51 | + 20 => 2, |
|
52 | + 21 => 1, |
|
53 | + 22 => 2, |
|
54 | + 23 => 1, |
|
55 | + 24 => 2, |
|
56 | + 31 => 1, |
|
57 | + 32 => 2, |
|
58 | + 33 => 2, |
|
59 | + 41 => 1, |
|
60 | + 42 => 1, |
|
61 | + 43 => 1, |
|
62 | + 44 => 1, |
|
63 | + 45 => 1, |
|
64 | + 46 => 1, |
|
65 | + 47 => 1, |
|
66 | + 48 => 1, |
|
67 | + 54 => 1, |
|
68 | + 55 => 1, |
|
69 | + 56 => 1, |
|
70 | + 57 => 1, |
|
71 | + 58 => 1, |
|
72 | + 59 => 1, |
|
73 | + 79 => 1, |
|
74 | + 80 => 1, |
|
75 | + 81 => 1, |
|
76 | + 82 => 1, |
|
77 | + 83 => 1, |
|
78 | + 85 => 1, |
|
79 | + 86 => 1, |
|
80 | + 87 => 1, |
|
81 | + 89 => 1, |
|
82 | + 90 => 1, |
|
83 | + 92 => 1, |
|
84 | + 93 => 1, |
|
85 | + ]; |
|
86 | + break; |
|
87 | + case 'DisallowTabIndentUnitTest.js': |
|
88 | + return [ |
|
89 | + 3 => 1, |
|
90 | + 5 => 1, |
|
91 | + 6 => 1, |
|
92 | + ]; |
|
93 | + break; |
|
94 | + case 'DisallowTabIndentUnitTest.css': |
|
95 | + return [ |
|
96 | + 1 => 1, |
|
97 | + 2 => 1, |
|
98 | + ]; |
|
99 | + break; |
|
100 | + default: |
|
101 | + return []; |
|
102 | + break; |
|
103 | 103 | }//end switch |
104 | 104 | |
105 | 105 | }//end getErrorList() |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return void |
25 | 25 | */ |
26 | - public function setCliValues($testFile, $config) |
|
26 | + public function setCliValues( $testFile, $config ) |
|
27 | 27 | { |
28 | 28 | $config->tabWidth = 4; |
29 | 29 | |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return array<int, int> |
42 | 42 | */ |
43 | - public function getErrorList($testFile='DisallowTabIndentUnitTest.inc') |
|
43 | + public function getErrorList( $testFile = 'DisallowTabIndentUnitTest.inc' ) |
|
44 | 44 | { |
45 | - switch ($testFile) { |
|
45 | + switch ( $testFile ) { |
|
46 | 46 | case 'DisallowTabIndentUnitTest.inc': |
47 | 47 | return [ |
48 | 48 | 5 => 2, |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | ]; |
99 | 99 | break; |
100 | 100 | default: |
101 | - return []; |
|
101 | + return [ ]; |
|
102 | 102 | break; |
103 | 103 | }//end switch |
104 | 104 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function getWarningList() |
117 | 117 | { |
118 | - return []; |
|
118 | + return [ ]; |
|
119 | 119 | |
120 | 120 | }//end getWarningList() |
121 | 121 |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class DisallowTabIndentUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class DisallowTabIndentUnitTest extends AbstractSniffUnitTest { |
|
16 | 15 | |
17 | 16 | |
18 | 17 | /** |
@@ -23,8 +22,7 @@ discard block |
||
23 | 22 | * |
24 | 23 | * @return void |
25 | 24 | */ |
26 | - public function setCliValues($testFile, $config) |
|
27 | - { |
|
25 | + public function setCliValues($testFile, $config) { |
|
28 | 26 | $config->tabWidth = 4; |
29 | 27 | |
30 | 28 | }//end setCliValues() |
@@ -40,8 +38,7 @@ discard block |
||
40 | 38 | * |
41 | 39 | * @return array<int, int> |
42 | 40 | */ |
43 | - public function getErrorList($testFile='DisallowTabIndentUnitTest.inc') |
|
44 | - { |
|
41 | + public function getErrorList($testFile='DisallowTabIndentUnitTest.inc') { |
|
45 | 42 | switch ($testFile) { |
46 | 43 | case 'DisallowTabIndentUnitTest.inc': |
47 | 44 | return [ |
@@ -113,8 +110,7 @@ discard block |
||
113 | 110 | * |
114 | 111 | * @return array<int, int> |
115 | 112 | */ |
116 | - public function getWarningList() |
|
117 | - { |
|
113 | + public function getWarningList() { |
|
118 | 114 | return []; |
119 | 115 | |
120 | 116 | }//end getWarningList() |
@@ -34,19 +34,19 @@ discard block |
||
34 | 34 | $obj->{$var}( $foo,$bar ); |
35 | 35 | |
36 | 36 | $bar(function( $a, $b ) { |
37 | - return function( $c, $d ) use ( $a, $b ) { |
|
38 | - echo $a, $b, $c, $d; |
|
39 | - }; |
|
37 | + return function( $c, $d ) use ( $a, $b ) { |
|
38 | + echo $a, $b, $c, $d; |
|
39 | + }; |
|
40 | 40 | })( 'a','b' )( 'c','d' ); |
41 | 41 | |
42 | 42 | $closure( $foo,$bar ); |
43 | 43 | $var = $closure() + $closure( $foo,$bar ) + self::$closure( $foo,$bar ); |
44 | 44 | |
45 | 45 | class Test { |
46 | - public static function baz( $foo, $bar ) { |
|
47 | - $a = new self( $foo,$bar ); |
|
48 | - $b = new static( $foo,$bar ); |
|
49 | - } |
|
46 | + public static function baz( $foo, $bar ) { |
|
47 | + $a = new self( $foo,$bar ); |
|
48 | + $b = new static( $foo,$bar ); |
|
49 | + } |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /* |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | if (( null !== $extra ) && ( $row->extra !== $extra )) {} // Bad x 4. |
65 | 65 | |
66 | 66 | if (( null !== $extra // Bad x 1. |
67 | - && is_int($extra)) |
|
68 | - && ( $row->extra !== $extra // Bad x 1. |
|
69 | - || $something ) // Bad x 1. |
|
67 | + && is_int($extra)) |
|
68 | + && ( $row->extra !== $extra // Bad x 1. |
|
69 | + || $something ) // Bad x 1. |
|
70 | 70 | ) {} |
71 | 71 | |
72 | 72 | if (( null !== $extra ) // Bad x 2. |
73 | - && ( $row->extra !== $extra ) // Bad x 2. |
|
73 | + && ( $row->extra !== $extra ) // Bad x 2. |
|
74 | 74 | ) {} |
75 | 75 | |
76 | 76 | $a = (null !== $extra); |
@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | if (( null !== $extra ) && ( $row->extra !== $extra )) {} |
93 | 93 | |
94 | 94 | if (( null !== $extra // Bad x 1. |
95 | - && is_int($extra)) // Bad x 1. |
|
96 | - && ( $row->extra !== $extra |
|
97 | - || $something ) // Bad x 1. |
|
95 | + && is_int($extra)) // Bad x 1. |
|
96 | + && ( $row->extra !== $extra |
|
97 | + || $something ) // Bad x 1. |
|
98 | 98 | ) {} |
99 | 99 | |
100 | 100 | if ((null !== $extra) // Bad x 2. |
101 | - && ($row->extra !== $extra) // Bad x 2. |
|
101 | + && ($row->extra !== $extra) // Bad x 2. |
|
102 | 102 | ) {} |
103 | 103 | |
104 | 104 | $a = (null !== $extra); // Bad x 2. |
@@ -120,42 +120,42 @@ discard block |
||
120 | 120 | * Test handling of ignoreNewlines. |
121 | 121 | */ |
122 | 122 | if ( |
123 | - ( |
|
124 | - null !== $extra |
|
125 | - ) && ( |
|
126 | - $row->extra !== $extra |
|
127 | - ) |
|
123 | + ( |
|
124 | + null !== $extra |
|
125 | + ) && ( |
|
126 | + $row->extra !== $extra |
|
127 | + ) |
|
128 | 128 | ) {} // Bad x 4, 1 x line 123, 2 x line 125, 1 x line 127. |
129 | 129 | |
130 | 130 | |
131 | 131 | $a = ( |
132 | - null !== $extra |
|
132 | + null !== $extra |
|
133 | 133 | ); // Bad x 2, 1 x line 131, 1 x line 133. |
134 | 134 | |
135 | 135 | // phpcs:set Generic.WhiteSpace.ArbitraryParenthesesSpacing spacing 1 |
136 | 136 | if ( |
137 | - ( |
|
138 | - null !== $extra |
|
139 | - ) && ( |
|
140 | - $row->extra !== $extra |
|
141 | - ) |
|
137 | + ( |
|
138 | + null !== $extra |
|
139 | + ) && ( |
|
140 | + $row->extra !== $extra |
|
141 | + ) |
|
142 | 142 | ) {} // Bad x 4, 1 x line 137, 2 x line 139, 1 x line 141. |
143 | 143 | |
144 | 144 | $a = ( |
145 | - null !== $extra |
|
145 | + null !== $extra |
|
146 | 146 | ); // Bad x 2, 1 x line 144, 1 x line 146. |
147 | 147 | // phpcs:set Generic.WhiteSpace.ArbitraryParenthesesSpacing spacing 0 |
148 | 148 | |
149 | 149 | // phpcs:set Generic.WhiteSpace.ArbitraryParenthesesSpacing ignoreNewlines true |
150 | 150 | if ( |
151 | - ( |
|
152 | - null !== $extra |
|
153 | - ) && ( |
|
154 | - $row->extra !== $extra |
|
155 | - ) |
|
151 | + ( |
|
152 | + null !== $extra |
|
153 | + ) && ( |
|
154 | + $row->extra !== $extra |
|
155 | + ) |
|
156 | 156 | ) {} |
157 | 157 | |
158 | 158 | $a = ( |
159 | - null !== $extra |
|
159 | + null !== $extra |
|
160 | 160 | ); |
161 | 161 | // phpcs:set Generic.WhiteSpace.ArbitraryParenthesesSpacing ignoreNewlines false |
@@ -4,9 +4,9 @@ discard block |
||
4 | 4 | * Make sure the sniff does not act on structures it shouldn't act on. |
5 | 5 | * All parentheses have extra spacing around it to test this properly. |
6 | 6 | */ |
7 | -$b = functioncall( $something ) ; |
|
7 | +$b = functioncall( $something ); |
|
8 | 8 | $b = function( $something ) {}; |
9 | -$c = myFunction( $arg1 , $arg2 = array( ) ); |
|
9 | +$c = myFunction( $arg1, $arg2 = array( ) ); |
|
10 | 10 | |
11 | 11 | function something( $param ) {} |
12 | 12 | |
@@ -14,38 +14,38 @@ discard block |
||
14 | 14 | $e = new class( ) {}; |
15 | 15 | |
16 | 16 | try { |
17 | -} catch( Exception $e ) { |
|
17 | +} catch ( Exception $e ) { |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | include( PATH . 'file.php' ); |
21 | 21 | |
22 | -if ( in_array( $arg1, array( 'foo','bar' ) ) ) {} |
|
22 | +if ( in_array( $arg1, array( 'foo', 'bar' ) ) ) {} |
|
23 | 23 | isset( $abc ); |
24 | 24 | unset( $abc ); |
25 | 25 | empty( $abc ); |
26 | 26 | eval( $abc ); |
27 | 27 | exit( $abc ); |
28 | 28 | clone( $_date1 <= $_date2 ? $_date1 : $_date2 ); |
29 | -declare( ticks=1 ); |
|
29 | +declare(ticks=1); |
|
30 | 30 | list( $post_mime_types, $avail_post_mime_types ) = wp_edit_attachments_query( $q ); |
31 | 31 | throw( $e ); |
32 | -yield from ( function(){} ); |
|
32 | +yield from ( function() {} ); |
|
33 | 33 | |
34 | -$obj->{$var}( $foo,$bar ); |
|
34 | +$obj->{$var}( $foo, $bar ); |
|
35 | 35 | |
36 | -$bar(function( $a, $b ) { |
|
36 | +$bar( function( $a, $b ) { |
|
37 | 37 | return function( $c, $d ) use ( $a, $b ) { |
38 | 38 | echo $a, $b, $c, $d; |
39 | 39 | }; |
40 | -})( 'a','b' )( 'c','d' ); |
|
40 | +})( 'a', 'b' )( 'c', 'd' ); |
|
41 | 41 | |
42 | -$closure( $foo,$bar ); |
|
43 | -$var = $closure() + $closure( $foo,$bar ) + self::$closure( $foo,$bar ); |
|
42 | +$closure( $foo, $bar ); |
|
43 | +$var = $closure() + $closure( $foo, $bar ) + self::$closure( $foo, $bar ); |
|
44 | 44 | |
45 | 45 | class Test { |
46 | 46 | public static function baz( $foo, $bar ) { |
47 | - $a = new self( $foo,$bar ); |
|
48 | - $b = new static( $foo,$bar ); |
|
47 | + $a = new self( $foo, $bar ); |
|
48 | + $b = new static( $foo, $bar ); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
@@ -59,60 +59,60 @@ discard block |
||
59 | 59 | /* |
60 | 60 | * Test the actual sniff. |
61 | 61 | */ |
62 | -if ((null !== $extra) && ($row->extra !== $extra)) {} |
|
62 | +if ( ( null !== $extra ) && ( $row->extra !== $extra ) ) {} |
|
63 | 63 | |
64 | -if (( null !== $extra ) && ( $row->extra !== $extra )) {} // Bad x 4. |
|
64 | +if ( ( null !== $extra ) && ( $row->extra !== $extra ) ) {} // Bad x 4. |
|
65 | 65 | |
66 | -if (( null !== $extra // Bad x 1. |
|
67 | - && is_int($extra)) |
|
66 | +if ( ( null !== $extra // Bad x 1. |
|
67 | + && is_int( $extra ) ) |
|
68 | 68 | && ( $row->extra !== $extra // Bad x 1. |
69 | - || $something ) // Bad x 1. |
|
69 | + || $something ) // Bad x 1. |
|
70 | 70 | ) {} |
71 | 71 | |
72 | -if (( null !== $extra ) // Bad x 2. |
|
72 | +if ( ( null !== $extra ) // Bad x 2. |
|
73 | 73 | && ( $row->extra !== $extra ) // Bad x 2. |
74 | 74 | ) {} |
75 | 75 | |
76 | -$a = (null !== $extra); |
|
76 | +$a = ( null !== $extra ); |
|
77 | 77 | $a = ( null !== $extra ); // Bad x 2. |
78 | 78 | |
79 | -$sx = $vert ? ($w - 1) : 0; |
|
79 | +$sx = $vert ? ( $w - 1 ) : 0; |
|
80 | 80 | |
81 | -$this->is_overloaded = ( ( ini_get("mbstring.func_overload") & 2 ) != 0 ) && function_exists('mb_substr'); // Bad x 4. |
|
81 | +$this->is_overloaded = ( ( ini_get( "mbstring.func_overload" ) & 2 ) != 0 ) && function_exists( 'mb_substr' ); // Bad x 4. |
|
82 | 82 | |
83 | -$image->flip( ($operation->axis & 1) != 0, ($operation->axis & 2) != 0 ); |
|
83 | +$image->flip( ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 ); |
|
84 | 84 | |
85 | -if ( $success && ('nothumb' == $target || 'all' == $target) ) {} |
|
85 | +if ( $success && ( 'nothumb' == $target || 'all' == $target ) ) {} |
|
86 | 86 | |
87 | -$directory = ('/' == $file[ strlen($file)-1 ]); |
|
87 | +$directory = ( '/' == $file[ strlen( $file ) - 1 ] ); |
|
88 | 88 | |
89 | 89 | // phpcs:set Generic.WhiteSpace.ArbitraryParenthesesSpacing spacing 1 |
90 | -if ((null !== $extra) && ($row->extra !== $extra)) {} // Bad x 4. |
|
90 | +if ( ( null !== $extra ) && ( $row->extra !== $extra ) ) {} // Bad x 4. |
|
91 | 91 | |
92 | -if (( null !== $extra ) && ( $row->extra !== $extra )) {} |
|
92 | +if ( ( null !== $extra ) && ( $row->extra !== $extra ) ) {} |
|
93 | 93 | |
94 | -if (( null !== $extra // Bad x 1. |
|
95 | - && is_int($extra)) // Bad x 1. |
|
94 | +if ( ( null !== $extra // Bad x 1. |
|
95 | + && is_int( $extra ) ) // Bad x 1. |
|
96 | 96 | && ( $row->extra !== $extra |
97 | - || $something ) // Bad x 1. |
|
97 | + || $something ) // Bad x 1. |
|
98 | 98 | ) {} |
99 | 99 | |
100 | -if ((null !== $extra) // Bad x 2. |
|
101 | - && ($row->extra !== $extra) // Bad x 2. |
|
100 | +if ( ( null !== $extra ) // Bad x 2. |
|
101 | + && ( $row->extra !== $extra ) // Bad x 2. |
|
102 | 102 | ) {} |
103 | 103 | |
104 | -$a = (null !== $extra); // Bad x 2. |
|
104 | +$a = ( null !== $extra ); // Bad x 2. |
|
105 | 105 | $a = ( null !== $extra ); |
106 | 106 | |
107 | -$sx = $vert ? ($w - 1) : 0; // Bad x 2. |
|
107 | +$sx = $vert ? ( $w - 1 ) : 0; // Bad x 2. |
|
108 | 108 | |
109 | -$this->is_overloaded = ((ini_get("mbstring.func_overload") & 2) != 0) && function_exists('mb_substr'); // Bad x 4. |
|
109 | +$this->is_overloaded = ( ( ini_get( "mbstring.func_overload" ) & 2 ) != 0 ) && function_exists( 'mb_substr' ); // Bad x 4. |
|
110 | 110 | |
111 | -$image->flip( ($operation->axis & 1) != 0, ($operation->axis & 2) != 0 ); // Bad x 4. |
|
111 | +$image->flip( ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 ); // Bad x 4. |
|
112 | 112 | |
113 | -if ( $success && ('nothumb' == $target || 'all' == $target) ) {} // Bad x 2. |
|
113 | +if ( $success && ( 'nothumb' == $target || 'all' == $target ) ) {} // Bad x 2. |
|
114 | 114 | |
115 | -$directory = ('/' == $file[ strlen($file)-1 ]); // Bad x 2. |
|
115 | +$directory = ( '/' == $file[ strlen( $file ) - 1 ] ); // Bad x 2. |
|
116 | 116 | |
117 | 117 | // phpcs:set Generic.WhiteSpace.ArbitraryParenthesesSpacing spacing 0 |
118 | 118 |
@@ -1,58 +1,58 @@ |
||
1 | 1 | <?php |
2 | 2 | $var = [1,2,3]; |
3 | 3 | $var = [ |
4 | - 1, |
|
5 | - 2, |
|
6 | - 3 |
|
4 | + 1, |
|
5 | + 2, |
|
6 | + 3 |
|
7 | 7 | ]; |
8 | 8 | $var = [ |
9 | - 1, |
|
10 | - 2, |
|
11 | - /* three */ 3, |
|
9 | + 1, |
|
10 | + 2, |
|
11 | + /* three */ 3, |
|
12 | 12 | ]; |
13 | 13 | $var = [ |
14 | 14 | 1, |
15 | - 2, |
|
16 | - /* three */ 3, |
|
15 | + 2, |
|
16 | + /* three */ 3, |
|
17 | 17 | ]; |
18 | 18 | |
19 | 19 | $var = [ |
20 | - 1 => 'one', |
|
21 | - 2 => 'two', |
|
22 | - 3 => 'three' |
|
20 | + 1 => 'one', |
|
21 | + 2 => 'two', |
|
22 | + 3 => 'three' |
|
23 | 23 | ]; |
24 | 24 | $var = [ |
25 | - 1 => 'one', |
|
26 | - 2 => 'two', |
|
27 | - /* three */ 3 => 'three', |
|
25 | + 1 => 'one', |
|
26 | + 2 => 'two', |
|
27 | + /* three */ 3 => 'three', |
|
28 | 28 | ]; |
29 | 29 | $var = [ |
30 | 30 | 1 => 'one', |
31 | - 2 => 'two', |
|
32 | - /* three */ 3 => 'three', |
|
33 | - ]; |
|
31 | + 2 => 'two', |
|
32 | + /* three */ 3 => 'three', |
|
33 | + ]; |
|
34 | 34 | |
35 | 35 | $var = array( |
36 | - 'one' => function() { |
|
37 | - $foo = [1,2,3]; |
|
38 | - $bar = [ |
|
39 | - 1, |
|
40 | - 2, |
|
41 | - 3]; |
|
42 | - }, |
|
43 | - 'two' => 2, |
|
36 | + 'one' => function() { |
|
37 | + $foo = [1,2,3]; |
|
38 | + $bar = [ |
|
39 | + 1, |
|
40 | + 2, |
|
41 | + 3]; |
|
42 | + }, |
|
43 | + 'two' => 2, |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | return [ |
47 | - [ |
|
48 | - 'foo' => true, |
|
49 | - ] |
|
47 | + [ |
|
48 | + 'foo' => true, |
|
49 | + ] |
|
50 | 50 | ]; |
51 | 51 | |
52 | 52 | // phpcs:set Generic.Arrays.ArrayIndent indent 2 |
53 | 53 | |
54 | 54 | $var = [ |
55 | 55 | 1 => 'one', |
56 | - 2 => 'two', |
|
57 | - /* three */ 3 => 'three', |
|
58 | - ]; |
|
56 | + 2 => 'two', |
|
57 | + /* three */ 3 => 'three', |
|
58 | + ]; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -$var = [1,2,3]; |
|
2 | +$var = [ 1, 2, 3 ]; |
|
3 | 3 | $var = [ |
4 | 4 | 1, |
5 | 5 | 2, |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | |
35 | 35 | $var = array( |
36 | 36 | 'one' => function() { |
37 | - $foo = [1,2,3]; |
|
37 | + $foo = [ 1, 2, 3 ]; |
|
38 | 38 | $bar = [ |
39 | 39 | 1, |
40 | 40 | 2, |
41 | - 3]; |
|
41 | + 3 ]; |
|
42 | 42 | }, |
43 | 43 | 'two' => 2, |
44 | 44 | ); |
@@ -15,46 +15,46 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * Returns the lines where errors should occur. |
|
20 | - * |
|
21 | - * The key of the array should represent the line number and the value |
|
22 | - * should represent the number of errors that should occur on that line. |
|
23 | - * |
|
24 | - * @return array<int, int> |
|
25 | - */ |
|
26 | - public function getErrorList() |
|
27 | - { |
|
28 | - return [ |
|
29 | - 14 => 1, |
|
30 | - 15 => 1, |
|
31 | - 17 => 1, |
|
32 | - 30 => 1, |
|
33 | - 31 => 1, |
|
34 | - 33 => 1, |
|
35 | - 41 => 1, |
|
36 | - 55 => 1, |
|
37 | - 56 => 1, |
|
38 | - 57 => 1, |
|
39 | - 58 => 1, |
|
40 | - ]; |
|
41 | - |
|
42 | - }//end getErrorList() |
|
43 | - |
|
44 | - |
|
45 | - /** |
|
46 | - * Returns the lines where warnings should occur. |
|
47 | - * |
|
48 | - * The key of the array should represent the line number and the value |
|
49 | - * should represent the number of warnings that should occur on that line. |
|
50 | - * |
|
51 | - * @return array<int, int> |
|
52 | - */ |
|
53 | - public function getWarningList() |
|
54 | - { |
|
55 | - return []; |
|
56 | - |
|
57 | - }//end getWarningList() |
|
18 | + /** |
|
19 | + * Returns the lines where errors should occur. |
|
20 | + * |
|
21 | + * The key of the array should represent the line number and the value |
|
22 | + * should represent the number of errors that should occur on that line. |
|
23 | + * |
|
24 | + * @return array<int, int> |
|
25 | + */ |
|
26 | + public function getErrorList() |
|
27 | + { |
|
28 | + return [ |
|
29 | + 14 => 1, |
|
30 | + 15 => 1, |
|
31 | + 17 => 1, |
|
32 | + 30 => 1, |
|
33 | + 31 => 1, |
|
34 | + 33 => 1, |
|
35 | + 41 => 1, |
|
36 | + 55 => 1, |
|
37 | + 56 => 1, |
|
38 | + 57 => 1, |
|
39 | + 58 => 1, |
|
40 | + ]; |
|
41 | + |
|
42 | + }//end getErrorList() |
|
43 | + |
|
44 | + |
|
45 | + /** |
|
46 | + * Returns the lines where warnings should occur. |
|
47 | + * |
|
48 | + * The key of the array should represent the line number and the value |
|
49 | + * should represent the number of warnings that should occur on that line. |
|
50 | + * |
|
51 | + * @return array<int, int> |
|
52 | + */ |
|
53 | + public function getWarningList() |
|
54 | + { |
|
55 | + return []; |
|
56 | + |
|
57 | + }//end getWarningList() |
|
58 | 58 | |
59 | 59 | |
60 | 60 | }//end class |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class ArrayIndentUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class ArrayIndentUnitTest extends AbstractSniffUnitTest { |
|
16 | 15 | |
17 | 16 | |
18 | 17 | /** |
@@ -23,8 +22,7 @@ discard block |
||
23 | 22 | * |
24 | 23 | * @return array<int, int> |
25 | 24 | */ |
26 | - public function getErrorList() |
|
27 | - { |
|
25 | + public function getErrorList() { |
|
28 | 26 | return [ |
29 | 27 | 14 => 1, |
30 | 28 | 15 => 1, |
@@ -50,8 +48,7 @@ discard block |
||
50 | 48 | * |
51 | 49 | * @return array<int, int> |
52 | 50 | */ |
53 | - public function getWarningList() |
|
54 | - { |
|
51 | + public function getWarningList() { |
|
55 | 52 | return []; |
56 | 53 | |
57 | 54 | }//end getWarningList() |
@@ -64,7 +64,7 @@ |
||
64 | 64 | */ |
65 | 65 | public function getWarningList() |
66 | 66 | { |
67 | - return []; |
|
67 | + return [ ]; |
|
68 | 68 | |
69 | 69 | }//end getWarningList() |
70 | 70 |
@@ -5,10 +5,10 @@ |
||
5 | 5 | echo $var[1]; |
6 | 6 | $foo = array($var[1],$var[2]); |
7 | 7 | $foo = array( |
8 | - 1, |
|
9 | - 2, |
|
10 | - 3 |
|
11 | - ); |
|
8 | + 1, |
|
9 | + 2, |
|
10 | + 3 |
|
11 | + ); |
|
12 | 12 | $var = array/*comment*/(1,2,3); |
13 | 13 | $var = array; |
14 | 14 |
@@ -1,20 +1,20 @@ |
||
1 | 1 | <?php |
2 | 2 | $var = array(); |
3 | -$var = [1,2,3]; |
|
4 | -$var = array(1,2,3); |
|
5 | -echo $var[1]; |
|
6 | -$foo = array($var[1],$var[2]); |
|
3 | +$var = [ 1, 2, 3 ]; |
|
4 | +$var = array( 1, 2, 3 ); |
|
5 | +echo $var[ 1 ]; |
|
6 | +$foo = array( $var[ 1 ], $var[ 2 ] ); |
|
7 | 7 | $foo = array( |
8 | 8 | 1, |
9 | 9 | 2, |
10 | 10 | 3 |
11 | 11 | ); |
12 | -$var = array/*comment*/(1,2,3); |
|
12 | +$var = array/*comment*/( 1, 2, 3 ); |
|
13 | 13 | $var = array; |
14 | 14 | |
15 | -function foo(array $array) {} |
|
15 | +function foo( array $array ) {} |
|
16 | 16 | |
17 | -$a = function (array $array) use ($foo): array {}; |
|
17 | +$a = function( array $array ) use ( $foo ): array {}; |
|
18 | 18 | |
19 | 19 | abstract function foo(): array; |
20 | 20 |
@@ -6,7 +6,7 @@ |
||
6 | 6 | echo $var[1]; |
7 | 7 | $foo = [$var[1],$var[2]]; |
8 | 8 | $foo = [ |
9 | - 1, |
|
10 | - 2, |
|
11 | - 3 |
|
12 | - ]; |
|
9 | + 1, |
|
10 | + 2, |
|
11 | + 3 |
|
12 | + ]; |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | $var = array(); |
3 | -$var = []; |
|
4 | -$var = array(1,2,3); |
|
5 | -$var = [1,2,3]; |
|
6 | -echo $var[1]; |
|
7 | -$foo = [$var[1],$var[2]]; |
|
3 | +$var = [ ]; |
|
4 | +$var = array( 1, 2, 3 ); |
|
5 | +$var = [ 1, 2, 3 ]; |
|
6 | +echo $var[ 1 ]; |
|
7 | +$foo = [ $var[ 1 ], $var[ 2 ] ]; |
|
8 | 8 | $foo = [ |
9 | 9 | 1, |
10 | 10 | 2, |
@@ -15,53 +15,53 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * Returns the lines where errors should occur. |
|
20 | - * |
|
21 | - * The key of the array should represent the line number and the value |
|
22 | - * should represent the number of errors that should occur on that line. |
|
23 | - * |
|
24 | - * @param string $testFile The name of the file being tested. |
|
25 | - * |
|
26 | - * @return array<int, int> |
|
27 | - */ |
|
28 | - public function getErrorList($testFile='') |
|
29 | - { |
|
30 | - switch ($testFile) { |
|
31 | - case 'DisallowLongArraySyntaxUnitTest.1.inc': |
|
32 | - return [ |
|
33 | - 2 => 1, |
|
34 | - 4 => 1, |
|
35 | - 6 => 1, |
|
36 | - 7 => 1, |
|
37 | - 12 => 1, |
|
38 | - 13 => 1, |
|
39 | - ]; |
|
40 | - case 'DisallowLongArraySyntaxUnitTest.2.inc': |
|
41 | - return [ |
|
42 | - 2 => 1, |
|
43 | - 9 => 1, |
|
44 | - ]; |
|
45 | - default: |
|
46 | - return []; |
|
47 | - }//end switch |
|
18 | + /** |
|
19 | + * Returns the lines where errors should occur. |
|
20 | + * |
|
21 | + * The key of the array should represent the line number and the value |
|
22 | + * should represent the number of errors that should occur on that line. |
|
23 | + * |
|
24 | + * @param string $testFile The name of the file being tested. |
|
25 | + * |
|
26 | + * @return array<int, int> |
|
27 | + */ |
|
28 | + public function getErrorList($testFile='') |
|
29 | + { |
|
30 | + switch ($testFile) { |
|
31 | + case 'DisallowLongArraySyntaxUnitTest.1.inc': |
|
32 | + return [ |
|
33 | + 2 => 1, |
|
34 | + 4 => 1, |
|
35 | + 6 => 1, |
|
36 | + 7 => 1, |
|
37 | + 12 => 1, |
|
38 | + 13 => 1, |
|
39 | + ]; |
|
40 | + case 'DisallowLongArraySyntaxUnitTest.2.inc': |
|
41 | + return [ |
|
42 | + 2 => 1, |
|
43 | + 9 => 1, |
|
44 | + ]; |
|
45 | + default: |
|
46 | + return []; |
|
47 | + }//end switch |
|
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 | - * @return array<int, int> |
|
59 | - */ |
|
60 | - public function getWarningList() |
|
61 | - { |
|
62 | - return []; |
|
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 | + * @return array<int, int> |
|
59 | + */ |
|
60 | + public function getWarningList() |
|
61 | + { |
|
62 | + return []; |
|
63 | 63 | |
64 | - }//end getWarningList() |
|
64 | + }//end getWarningList() |
|
65 | 65 | |
66 | 66 | |
67 | 67 | }//end class |
@@ -28,22 +28,22 @@ |
||
28 | 28 | public function getErrorList($testFile='') |
29 | 29 | { |
30 | 30 | switch ($testFile) { |
31 | - case 'DisallowLongArraySyntaxUnitTest.1.inc': |
|
32 | - return [ |
|
33 | - 2 => 1, |
|
34 | - 4 => 1, |
|
35 | - 6 => 1, |
|
36 | - 7 => 1, |
|
37 | - 12 => 1, |
|
38 | - 13 => 1, |
|
39 | - ]; |
|
40 | - case 'DisallowLongArraySyntaxUnitTest.2.inc': |
|
41 | - return [ |
|
42 | - 2 => 1, |
|
43 | - 9 => 1, |
|
44 | - ]; |
|
45 | - default: |
|
46 | - return []; |
|
31 | + case 'DisallowLongArraySyntaxUnitTest.1.inc': |
|
32 | + return [ |
|
33 | + 2 => 1, |
|
34 | + 4 => 1, |
|
35 | + 6 => 1, |
|
36 | + 7 => 1, |
|
37 | + 12 => 1, |
|
38 | + 13 => 1, |
|
39 | + ]; |
|
40 | + case 'DisallowLongArraySyntaxUnitTest.2.inc': |
|
41 | + return [ |
|
42 | + 2 => 1, |
|
43 | + 9 => 1, |
|
44 | + ]; |
|
45 | + default: |
|
46 | + return []; |
|
47 | 47 | }//end switch |
48 | 48 | |
49 | 49 | }//end getErrorList() |
@@ -25,9 +25,9 @@ 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 | - switch ($testFile) { |
|
30 | + switch ( $testFile ) { |
|
31 | 31 | case 'DisallowLongArraySyntaxUnitTest.1.inc': |
32 | 32 | return [ |
33 | 33 | 2 => 1, |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | 9 => 1, |
44 | 44 | ]; |
45 | 45 | default: |
46 | - return []; |
|
46 | + return [ ]; |
|
47 | 47 | }//end switch |
48 | 48 | |
49 | 49 | }//end getErrorList() |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function getWarningList() |
61 | 61 | { |
62 | - return []; |
|
62 | + return [ ]; |
|
63 | 63 | |
64 | 64 | }//end getWarningList() |
65 | 65 |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class DisallowLongArraySyntaxUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class DisallowLongArraySyntaxUnitTest extends AbstractSniffUnitTest { |
|
16 | 15 | |
17 | 16 | |
18 | 17 | /** |
@@ -25,8 +24,7 @@ discard block |
||
25 | 24 | * |
26 | 25 | * @return array<int, int> |
27 | 26 | */ |
28 | - public function getErrorList($testFile='') |
|
29 | - { |
|
27 | + public function getErrorList($testFile='') { |
|
30 | 28 | switch ($testFile) { |
31 | 29 | case 'DisallowLongArraySyntaxUnitTest.1.inc': |
32 | 30 | return [ |
@@ -57,8 +55,7 @@ discard block |
||
57 | 55 | * |
58 | 56 | * @return array<int, int> |
59 | 57 | */ |
60 | - public function getWarningList() |
|
61 | - { |
|
58 | + public function getWarningList() { |
|
62 | 59 | return []; |
63 | 60 | |
64 | 61 | }//end getWarningList() |
@@ -15,39 +15,39 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * Returns the lines where errors should occur. |
|
20 | - * |
|
21 | - * The key of the array should represent the line number and the value |
|
22 | - * should represent the number of errors that should occur on that line. |
|
23 | - * |
|
24 | - * @return array<int, int> |
|
25 | - */ |
|
26 | - public function getErrorList() |
|
27 | - { |
|
28 | - return [ |
|
29 | - 3 => 1, |
|
30 | - 5 => 1, |
|
31 | - 7 => 1, |
|
32 | - 8 => 1, |
|
33 | - ]; |
|
34 | - |
|
35 | - }//end getErrorList() |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * Returns the lines where warnings should occur. |
|
40 | - * |
|
41 | - * The key of the array should represent the line number and the value |
|
42 | - * should represent the number of warnings that should occur on that line. |
|
43 | - * |
|
44 | - * @return array<int, int> |
|
45 | - */ |
|
46 | - public function getWarningList() |
|
47 | - { |
|
48 | - return []; |
|
49 | - |
|
50 | - }//end getWarningList() |
|
18 | + /** |
|
19 | + * Returns the lines where errors should occur. |
|
20 | + * |
|
21 | + * The key of the array should represent the line number and the value |
|
22 | + * should represent the number of errors that should occur on that line. |
|
23 | + * |
|
24 | + * @return array<int, int> |
|
25 | + */ |
|
26 | + public function getErrorList() |
|
27 | + { |
|
28 | + return [ |
|
29 | + 3 => 1, |
|
30 | + 5 => 1, |
|
31 | + 7 => 1, |
|
32 | + 8 => 1, |
|
33 | + ]; |
|
34 | + |
|
35 | + }//end getErrorList() |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * Returns the lines where warnings should occur. |
|
40 | + * |
|
41 | + * The key of the array should represent the line number and the value |
|
42 | + * should represent the number of warnings that should occur on that line. |
|
43 | + * |
|
44 | + * @return array<int, int> |
|
45 | + */ |
|
46 | + public function getWarningList() |
|
47 | + { |
|
48 | + return []; |
|
49 | + |
|
50 | + }//end getWarningList() |
|
51 | 51 | |
52 | 52 | |
53 | 53 | }//end class |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class DisallowShortArraySyntaxUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class DisallowShortArraySyntaxUnitTest extends AbstractSniffUnitTest { |
|
16 | 15 | |
17 | 16 | |
18 | 17 | /** |
@@ -23,8 +22,7 @@ discard block |
||
23 | 22 | * |
24 | 23 | * @return array<int, int> |
25 | 24 | */ |
26 | - public function getErrorList() |
|
27 | - { |
|
25 | + public function getErrorList() { |
|
28 | 26 | return [ |
29 | 27 | 3 => 1, |
30 | 28 | 5 => 1, |
@@ -43,8 +41,7 @@ discard block |
||
43 | 41 | * |
44 | 42 | * @return array<int, int> |
45 | 43 | */ |
46 | - public function getWarningList() |
|
47 | - { |
|
44 | + public function getWarningList() { |
|
48 | 45 | return []; |
49 | 46 | |
50 | 47 | }//end getWarningList() |
@@ -64,7 +64,7 @@ |
||
64 | 64 | */ |
65 | 65 | public function getWarningList() |
66 | 66 | { |
67 | - return []; |
|
67 | + return [ ]; |
|
68 | 68 | |
69 | 69 | }//end getWarningList() |
70 | 70 |