@@ -15,37 +15,37 @@ |
||
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 | - 6 => 1, |
|
30 | - 10 => 1, |
|
31 | - ]; |
|
32 | - |
|
33 | - }//end getErrorList() |
|
34 | - |
|
35 | - |
|
36 | - /** |
|
37 | - * Returns the lines where warnings should occur. |
|
38 | - * |
|
39 | - * The key of the array should represent the line number and the value |
|
40 | - * should represent the number of warnings that should occur on that line. |
|
41 | - * |
|
42 | - * @return array(int => int) |
|
43 | - */ |
|
44 | - public function getWarningList() |
|
45 | - { |
|
46 | - return []; |
|
47 | - |
|
48 | - }//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 | + 6 => 1, |
|
30 | + 10 => 1, |
|
31 | + ]; |
|
32 | + |
|
33 | + }//end getErrorList() |
|
34 | + |
|
35 | + |
|
36 | + /** |
|
37 | + * Returns the lines where warnings should occur. |
|
38 | + * |
|
39 | + * The key of the array should represent the line number and the value |
|
40 | + * should represent the number of warnings that should occur on that line. |
|
41 | + * |
|
42 | + * @return array(int => int) |
|
43 | + */ |
|
44 | + public function getWarningList() |
|
45 | + { |
|
46 | + return []; |
|
47 | + |
|
48 | + }//end getWarningList() |
|
49 | 49 | |
50 | 50 | |
51 | 51 | }//end class |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class OneTraitPerFileUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class OneTraitPerFileUnitTest 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 | 6 => 1, |
30 | 28 | 10 => 1, |
@@ -41,8 +39,7 @@ discard block |
||
41 | 39 | * |
42 | 40 | * @return array(int => int) |
43 | 41 | */ |
44 | - public function getWarningList() |
|
45 | - { |
|
42 | + public function getWarningList() { |
|
46 | 43 | return []; |
47 | 44 | |
48 | 45 | }//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 |
@@ -4,7 +4,7 @@ |
||
4 | 4 | <?php |
5 | 5 | |
6 | 6 | /* This line is fine. */ |
7 | -if($thisIsOk === true) {} |
|
7 | +if ( $thisIsOk === true ) {} |
|
8 | 8 | |
9 | 9 | /* This line is too long but will be ignored. This line is too long but will be ignored. */ |
10 | -if (($anotherReallyLongVarName === true) || (is_array($anotherReallyLongVarName) === false)) {} |
|
10 | +if ( ( $anotherReallyLongVarName === true ) || ( is_array( $anotherReallyLongVarName ) === false ) ) {} |
@@ -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 | - * @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 'EndFileNewlineUnitTest.3.inc': |
|
32 | - case 'EndFileNewlineUnitTest.3.js': |
|
33 | - case 'EndFileNewlineUnitTest.3.css': |
|
34 | - case 'EndFileNewlineUnitTest.4.inc': |
|
35 | - return [2 => 1]; |
|
36 | - default: |
|
37 | - return []; |
|
38 | - }//end switch |
|
39 | - |
|
40 | - }//end getErrorList() |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * Returns the lines where warnings should occur. |
|
45 | - * |
|
46 | - * The key of the array should represent the line number and the value |
|
47 | - * should represent the number of warnings that should occur on that line. |
|
48 | - * |
|
49 | - * @param string $testFile The name of the file being tested. |
|
50 | - * |
|
51 | - * @return array<int, int> |
|
52 | - */ |
|
53 | - public function getWarningList($testFile='') |
|
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 | + * @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 'EndFileNewlineUnitTest.3.inc': |
|
32 | + case 'EndFileNewlineUnitTest.3.js': |
|
33 | + case 'EndFileNewlineUnitTest.3.css': |
|
34 | + case 'EndFileNewlineUnitTest.4.inc': |
|
35 | + return [2 => 1]; |
|
36 | + default: |
|
37 | + return []; |
|
38 | + }//end switch |
|
39 | + |
|
40 | + }//end getErrorList() |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * Returns the lines where warnings should occur. |
|
45 | + * |
|
46 | + * The key of the array should represent the line number and the value |
|
47 | + * should represent the number of warnings that should occur on that line. |
|
48 | + * |
|
49 | + * @param string $testFile The name of the file being tested. |
|
50 | + * |
|
51 | + * @return array<int, int> |
|
52 | + */ |
|
53 | + public function getWarningList($testFile='') |
|
54 | + { |
|
55 | + return []; |
|
56 | + |
|
57 | + }//end getWarningList() |
|
58 | 58 | |
59 | 59 | |
60 | 60 | }//end class |
@@ -28,13 +28,13 @@ |
||
28 | 28 | public function getErrorList($testFile='') |
29 | 29 | { |
30 | 30 | switch ($testFile) { |
31 | - case 'EndFileNewlineUnitTest.3.inc': |
|
32 | - case 'EndFileNewlineUnitTest.3.js': |
|
33 | - case 'EndFileNewlineUnitTest.3.css': |
|
34 | - case 'EndFileNewlineUnitTest.4.inc': |
|
35 | - return [2 => 1]; |
|
36 | - default: |
|
37 | - return []; |
|
31 | + case 'EndFileNewlineUnitTest.3.inc': |
|
32 | + case 'EndFileNewlineUnitTest.3.js': |
|
33 | + case 'EndFileNewlineUnitTest.3.css': |
|
34 | + case 'EndFileNewlineUnitTest.4.inc': |
|
35 | + return [2 => 1]; |
|
36 | + default: |
|
37 | + return []; |
|
38 | 38 | }//end switch |
39 | 39 | |
40 | 40 | }//end getErrorList() |
@@ -25,16 +25,16 @@ 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 'EndFileNewlineUnitTest.3.inc': |
32 | 32 | case 'EndFileNewlineUnitTest.3.js': |
33 | 33 | case 'EndFileNewlineUnitTest.3.css': |
34 | 34 | case 'EndFileNewlineUnitTest.4.inc': |
35 | - return [2 => 1]; |
|
35 | + return [ 2 => 1 ]; |
|
36 | 36 | default: |
37 | - return []; |
|
37 | + return [ ]; |
|
38 | 38 | }//end switch |
39 | 39 | |
40 | 40 | }//end getErrorList() |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return array<int, int> |
52 | 52 | */ |
53 | - public function getWarningList($testFile='') |
|
53 | + public function getWarningList( $testFile = '' ) |
|
54 | 54 | { |
55 | - return []; |
|
55 | + return [ ]; |
|
56 | 56 | |
57 | 57 | }//end getWarningList() |
58 | 58 |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class EndFileNewlineUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class EndFileNewlineUnitTest 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 'EndFileNewlineUnitTest.3.inc': |
32 | 30 | case 'EndFileNewlineUnitTest.3.js': |
@@ -50,8 +48,7 @@ discard block |
||
50 | 48 | * |
51 | 49 | * @return array<int, int> |
52 | 50 | */ |
53 | - public function getWarningList($testFile='') |
|
54 | - { |
|
51 | + public function getWarningList($testFile='') { |
|
55 | 52 | return []; |
56 | 53 | |
57 | 54 | }//end getWarningList() |
@@ -2,18 +2,18 @@ discard block |
||
2 | 2 | |
3 | 3 | // This line is okay... just! |
4 | 4 | if (($reallyLongVarName === true) || (is_array($anotherLongVarName) == false)) { |
5 | - // Do something. |
|
5 | + // Do something. |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | // This line is not okay... just! |
9 | 9 | if (($reallyLongVarName === true) || (is_array($anotherLongVarName) === false)) { |
10 | - // Do something. |
|
10 | + // Do something. |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | |
14 | 14 | // This line is is too long. |
15 | 15 | if (($anotherReallyLongVarName === true) || (is_array($anotherReallyLongVarName) === false)) { |
16 | - // Do something. |
|
16 | + // Do something. |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | // This is a really really long comment that is going to go to exactly 80 chars. |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | # http://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval#Wilson_score_interval |
58 | 58 | |
59 | 59 | if ($foo) { |
60 | - if ($bar) { |
|
61 | - if ($baz) { |
|
62 | - // Next line can be broken: |
|
63 | - // foo bar baz http://en.wikipedia.org/wiki/Binomial_proportion#blahblahblahblah |
|
64 | - // But this one is just too long to break with this indent: |
|
65 | - // foo bar baz http://en.wikipedia.org/wiki/Binomial_proportion#blahblahblahblahblah |
|
66 | - } |
|
67 | - } |
|
60 | + if ($bar) { |
|
61 | + if ($baz) { |
|
62 | + // Next line can be broken: |
|
63 | + // foo bar baz http://en.wikipedia.org/wiki/Binomial_proportion#blahblahblahblah |
|
64 | + // But this one is just too long to break with this indent: |
|
65 | + // foo bar baz http://en.wikipedia.org/wiki/Binomial_proportion#blahblahblahblahblah |
|
66 | + } |
|
67 | + } |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /* -------------------------------- 80 chars -------------------------------- */ |
@@ -1,18 +1,18 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // This line is okay... just! |
4 | -if (($reallyLongVarName === true) || (is_array($anotherLongVarName) == false)) { |
|
4 | +if ( ( $reallyLongVarName === true ) || ( is_array( $anotherLongVarName ) == false ) ) { |
|
5 | 5 | // Do something. |
6 | 6 | } |
7 | 7 | |
8 | 8 | // This line is not okay... just! |
9 | -if (($reallyLongVarName === true) || (is_array($anotherLongVarName) === false)) { |
|
9 | +if ( ( $reallyLongVarName === true ) || ( is_array( $anotherLongVarName ) === false ) ) { |
|
10 | 10 | // Do something. |
11 | 11 | } |
12 | 12 | |
13 | 13 | |
14 | 14 | // This line is is too long. |
15 | -if (($anotherReallyLongVarName === true) || (is_array($anotherReallyLongVarName) === false)) { |
|
15 | +if ( ( $anotherReallyLongVarName === true ) || ( is_array( $anotherReallyLongVarName ) === false ) ) { |
|
16 | 16 | // Do something. |
17 | 17 | } |
18 | 18 | |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | |
57 | 57 | # http://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval#Wilson_score_interval |
58 | 58 | |
59 | -if ($foo) { |
|
60 | - if ($bar) { |
|
61 | - if ($baz) { |
|
59 | +if ( $foo ) { |
|
60 | + if ( $bar ) { |
|
61 | + if ( $baz ) { |
|
62 | 62 | // Next line can be broken: |
63 | 63 | // foo bar baz http://en.wikipedia.org/wiki/Binomial_proportion#blahblahblahblah |
64 | 64 | // But this one is just too long to break with this indent: |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | /* -------------------------------- 80 chars -------------------------------- */ |
71 | -$ab = function () { /* comment */ if ($foo === true) { return (int) $foo; } }; |
|
72 | -$ab = function () { /* comment */ if ($foo === true){ return (int)$foo; }}; |
|
73 | -$ab = function () { /* comment */ if ($foo === true) { return (int) $foo; } }; |
|
74 | - $ab = function () { /* comment */ if ($foo === true) { return(int) $foo; }}; |
|
75 | - $ab = function () { /* comment */ if ($foo === true) { return(int) $foo; }}; |
|
76 | -$ab = $ab = $ab = $ab = $ab = $ab = $ab = $ab = $ab = $ab; |
|
71 | +$ab = function() { /* comment */ if ( $foo === true ) { return (int)$foo; } }; |
|
72 | +$ab = function() { /* comment */ if ( $foo === true ) { return (int)$foo; }}; |
|
73 | +$ab = function() { /* comment */ if ( $foo === true ) { return (int)$foo; } }; |
|
74 | + $ab = function() { /* comment */ if ( $foo === true ) { return(int)$foo; }}; |
|
75 | + $ab = function() { /* comment */ if ( $foo === true ) { return(int)$foo; }}; |
|
76 | +$ab = $ab = $ab = $ab = $ab = $ab = $ab = $ab = $ab = $ab; |
|
77 | 77 | |
78 | 78 | // PHPCS annotations on a line by themselves should be ignored for the metrics. |
79 | 79 | // phpcs:enable Standard.Category.Sniff.ErrorCode1,Standard.Category.Sniff.ErrorCode2 -- for reasons ... |
@@ -68,11 +68,16 @@ |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | /* -------------------------------- 80 chars -------------------------------- */ |
71 | -$ab = function () { /* comment */ if ($foo === true) { return (int) $foo; } }; |
|
72 | -$ab = function () { /* comment */ if ($foo === true){ return (int)$foo; }}; |
|
73 | -$ab = function () { /* comment */ if ($foo === true) { return (int) $foo; } }; |
|
74 | - $ab = function () { /* comment */ if ($foo === true) { return(int) $foo; }}; |
|
75 | - $ab = function () { /* comment */ if ($foo === true) { return(int) $foo; }}; |
|
71 | +$ab = function () { |
|
72 | +/* comment */ if ($foo === true) { return (int) $foo; } }; |
|
73 | +$ab = function () { |
|
74 | +/* comment */ if ($foo === true){ return (int)$foo; }}; |
|
75 | +$ab = function () { |
|
76 | +/* comment */ if ($foo === true) { return (int) $foo; } }; |
|
77 | + $ab = function () { |
|
78 | +/* comment */ if ($foo === true) { return(int) $foo; }}; |
|
79 | + $ab = function () { |
|
80 | +/* comment */ if ($foo === true) { return(int) $foo; }}; |
|
76 | 81 | $ab = $ab = $ab = $ab = $ab = $ab = $ab = $ab = $ab = $ab; |
77 | 82 | |
78 | 83 | // PHPCS annotations on a line by themselves should be ignored for the metrics. |
@@ -16,6 +16,6 @@ |
||
16 | 16 | $code = '<'.'?php '; |
17 | 17 | |
18 | 18 | $string = 'This is a really long string. ' |
19 | - . 'It is being used for errors. ' |
|
20 | - . 'The message is not translated.'; |
|
19 | + . 'It is being used for errors. ' |
|
20 | + . 'The message is not translated.'; |
|
21 | 21 | ?> |
@@ -1,19 +1,19 @@ |
||
1 | 1 | <?php |
2 | -$x = 'My '.'string'; |
|
3 | -$x = 'My '. 1234; |
|
4 | -$x = 'My '.$y.' test'; |
|
2 | +$x = 'My ' . 'string'; |
|
3 | +$x = 'My ' . 1234; |
|
4 | +$x = 'My ' . $y . ' test'; |
|
5 | 5 | |
6 | -echo $data['my'.'index']; |
|
7 | -echo $data['my'. 4]; |
|
8 | -echo $data['my'.$x]; |
|
9 | -echo $data[$x.$y.'My'.'String']; |
|
6 | +echo $data[ 'my' . 'index' ]; |
|
7 | +echo $data[ 'my' . 4 ]; |
|
8 | +echo $data[ 'my' . $x ]; |
|
9 | +echo $data[ $x . $y . 'My' . 'String' ]; |
|
10 | 10 | |
11 | -$code = '$actions = array();'."\n"; |
|
12 | -$code = "$actions = array();"."\n"; |
|
11 | +$code = '$actions = array();' . "\n"; |
|
12 | +$code = "$actions = array();" . "\n"; |
|
13 | 13 | |
14 | 14 | // No errors for these because they are needed in some cases. |
15 | -$code = ' ?'.'>'; |
|
16 | -$code = '<'.'?php '; |
|
15 | +$code = ' ?' . '>'; |
|
16 | +$code = '<' . '?php '; |
|
17 | 17 | |
18 | 18 | $string = 'This is a really long string. ' |
19 | 19 | . 'It is being used for errors. ' |
@@ -15,59 +15,59 @@ |
||
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='UnnecessaryStringConcatUnitTest.inc') |
|
29 | - { |
|
30 | - switch ($testFile) { |
|
31 | - case 'UnnecessaryStringConcatUnitTest.inc': |
|
32 | - return [ |
|
33 | - 2 => 1, |
|
34 | - 6 => 1, |
|
35 | - 9 => 1, |
|
36 | - 12 => 1, |
|
37 | - 19 => 1, |
|
38 | - 20 => 1, |
|
39 | - ]; |
|
40 | - break; |
|
41 | - case 'UnnecessaryStringConcatUnitTest.js': |
|
42 | - return [ |
|
43 | - 1 => 1, |
|
44 | - 8 => 1, |
|
45 | - 11 => 1, |
|
46 | - 14 => 1, |
|
47 | - 15 => 1, |
|
48 | - ]; |
|
49 | - break; |
|
50 | - default: |
|
51 | - return []; |
|
52 | - break; |
|
53 | - }//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='UnnecessaryStringConcatUnitTest.inc') |
|
29 | + { |
|
30 | + switch ($testFile) { |
|
31 | + case 'UnnecessaryStringConcatUnitTest.inc': |
|
32 | + return [ |
|
33 | + 2 => 1, |
|
34 | + 6 => 1, |
|
35 | + 9 => 1, |
|
36 | + 12 => 1, |
|
37 | + 19 => 1, |
|
38 | + 20 => 1, |
|
39 | + ]; |
|
40 | + break; |
|
41 | + case 'UnnecessaryStringConcatUnitTest.js': |
|
42 | + return [ |
|
43 | + 1 => 1, |
|
44 | + 8 => 1, |
|
45 | + 11 => 1, |
|
46 | + 14 => 1, |
|
47 | + 15 => 1, |
|
48 | + ]; |
|
49 | + break; |
|
50 | + default: |
|
51 | + return []; |
|
52 | + break; |
|
53 | + }//end switch |
|
54 | 54 | |
55 | - }//end getErrorList() |
|
55 | + }//end getErrorList() |
|
56 | 56 | |
57 | 57 | |
58 | - /** |
|
59 | - * Returns the lines where warnings should occur. |
|
60 | - * |
|
61 | - * The key of the array should represent the line number and the value |
|
62 | - * should represent the number of warnings that should occur on that line. |
|
63 | - * |
|
64 | - * @return array<int, int> |
|
65 | - */ |
|
66 | - public function getWarningList() |
|
67 | - { |
|
68 | - return []; |
|
58 | + /** |
|
59 | + * Returns the lines where warnings should occur. |
|
60 | + * |
|
61 | + * The key of the array should represent the line number and the value |
|
62 | + * should represent the number of warnings that should occur on that line. |
|
63 | + * |
|
64 | + * @return array<int, int> |
|
65 | + */ |
|
66 | + public function getWarningList() |
|
67 | + { |
|
68 | + return []; |
|
69 | 69 | |
70 | - }//end getWarningList() |
|
70 | + }//end getWarningList() |
|
71 | 71 | |
72 | 72 | |
73 | 73 | }//end class |
@@ -28,28 +28,28 @@ |
||
28 | 28 | public function getErrorList($testFile='UnnecessaryStringConcatUnitTest.inc') |
29 | 29 | { |
30 | 30 | switch ($testFile) { |
31 | - case 'UnnecessaryStringConcatUnitTest.inc': |
|
32 | - return [ |
|
33 | - 2 => 1, |
|
34 | - 6 => 1, |
|
35 | - 9 => 1, |
|
36 | - 12 => 1, |
|
37 | - 19 => 1, |
|
38 | - 20 => 1, |
|
39 | - ]; |
|
40 | - break; |
|
41 | - case 'UnnecessaryStringConcatUnitTest.js': |
|
42 | - return [ |
|
43 | - 1 => 1, |
|
44 | - 8 => 1, |
|
45 | - 11 => 1, |
|
46 | - 14 => 1, |
|
47 | - 15 => 1, |
|
48 | - ]; |
|
49 | - break; |
|
50 | - default: |
|
51 | - return []; |
|
52 | - break; |
|
31 | + case 'UnnecessaryStringConcatUnitTest.inc': |
|
32 | + return [ |
|
33 | + 2 => 1, |
|
34 | + 6 => 1, |
|
35 | + 9 => 1, |
|
36 | + 12 => 1, |
|
37 | + 19 => 1, |
|
38 | + 20 => 1, |
|
39 | + ]; |
|
40 | + break; |
|
41 | + case 'UnnecessaryStringConcatUnitTest.js': |
|
42 | + return [ |
|
43 | + 1 => 1, |
|
44 | + 8 => 1, |
|
45 | + 11 => 1, |
|
46 | + 14 => 1, |
|
47 | + 15 => 1, |
|
48 | + ]; |
|
49 | + break; |
|
50 | + default: |
|
51 | + return []; |
|
52 | + break; |
|
53 | 53 | }//end switch |
54 | 54 | |
55 | 55 | }//end getErrorList() |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return array<int, int> |
27 | 27 | */ |
28 | - public function getErrorList($testFile='UnnecessaryStringConcatUnitTest.inc') |
|
28 | + public function getErrorList( $testFile = 'UnnecessaryStringConcatUnitTest.inc' ) |
|
29 | 29 | { |
30 | - switch ($testFile) { |
|
30 | + switch ( $testFile ) { |
|
31 | 31 | case 'UnnecessaryStringConcatUnitTest.inc': |
32 | 32 | return [ |
33 | 33 | 2 => 1, |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | ]; |
49 | 49 | break; |
50 | 50 | default: |
51 | - return []; |
|
51 | + return [ ]; |
|
52 | 52 | break; |
53 | 53 | }//end switch |
54 | 54 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function getWarningList() |
67 | 67 | { |
68 | - return []; |
|
68 | + return [ ]; |
|
69 | 69 | |
70 | 70 | }//end getWarningList() |
71 | 71 |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class UnnecessaryStringConcatUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class UnnecessaryStringConcatUnitTest 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='UnnecessaryStringConcatUnitTest.inc') |
|
29 | - { |
|
27 | + public function getErrorList($testFile='UnnecessaryStringConcatUnitTest.inc') { |
|
30 | 28 | switch ($testFile) { |
31 | 29 | case 'UnnecessaryStringConcatUnitTest.inc': |
32 | 30 | return [ |
@@ -63,8 +61,7 @@ discard block |
||
63 | 61 | * |
64 | 62 | * @return array<int, int> |
65 | 63 | */ |
66 | - public function getWarningList() |
|
67 | - { |
|
64 | + public function getWarningList() { |
|
68 | 65 | return []; |
69 | 66 | |
70 | 67 | }//end getWarningList() |
@@ -15,37 +15,37 @@ |
||
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 [116 => 1]; |
|
29 | - |
|
30 | - }//end getErrorList() |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * Returns the lines where warnings should occur. |
|
35 | - * |
|
36 | - * The key of the array should represent the line number and the value |
|
37 | - * should represent the number of warnings that should occur on that line. |
|
38 | - * |
|
39 | - * @return array<int, int> |
|
40 | - */ |
|
41 | - public function getWarningList() |
|
42 | - { |
|
43 | - return [ |
|
44 | - 45 => 1, |
|
45 | - 72 => 1, |
|
46 | - ]; |
|
47 | - |
|
48 | - }//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 [116 => 1]; |
|
29 | + |
|
30 | + }//end getErrorList() |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * Returns the lines where warnings should occur. |
|
35 | + * |
|
36 | + * The key of the array should represent the line number and the value |
|
37 | + * should represent the number of warnings that should occur on that line. |
|
38 | + * |
|
39 | + * @return array<int, int> |
|
40 | + */ |
|
41 | + public function getWarningList() |
|
42 | + { |
|
43 | + return [ |
|
44 | + 45 => 1, |
|
45 | + 72 => 1, |
|
46 | + ]; |
|
47 | + |
|
48 | + }//end getWarningList() |
|
49 | 49 | |
50 | 50 | |
51 | 51 | }//end class |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function getErrorList() |
27 | 27 | { |
28 | - return [116 => 1]; |
|
28 | + return [ 116 => 1 ]; |
|
29 | 29 | |
30 | 30 | }//end getErrorList() |
31 | 31 |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class CyclomaticComplexityUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class CyclomaticComplexityUnitTest 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 [116 => 1]; |
29 | 27 | |
30 | 28 | }//end getErrorList() |
@@ -38,8 +36,7 @@ discard block |
||
38 | 36 | * |
39 | 37 | * @return array<int, int> |
40 | 38 | */ |
41 | - public function getWarningList() |
|
42 | - { |
|
39 | + public function getWarningList() { |
|
43 | 40 | return [ |
44 | 41 | 45 => 1, |
45 | 42 | 72 => 1, |
@@ -2,101 +2,101 @@ |
||
2 | 2 | |
3 | 3 | function nestingOne() |
4 | 4 | { |
5 | - if ($condition) { |
|
6 | - echo 'hi'; |
|
7 | - } |
|
5 | + if ($condition) { |
|
6 | + echo 'hi'; |
|
7 | + } |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | function nestingFive() |
11 | 11 | { |
12 | - if ($condition) { |
|
13 | - echo 'hi'; |
|
14 | - switch ($condition) |
|
15 | - { |
|
16 | - case '1': |
|
17 | - if ($condition === '1') { |
|
18 | - if ($cond) { |
|
19 | - echo 'hi'; |
|
20 | - } |
|
21 | - } |
|
22 | - break; |
|
23 | - } |
|
24 | - } |
|
12 | + if ($condition) { |
|
13 | + echo 'hi'; |
|
14 | + switch ($condition) |
|
15 | + { |
|
16 | + case '1': |
|
17 | + if ($condition === '1') { |
|
18 | + if ($cond) { |
|
19 | + echo 'hi'; |
|
20 | + } |
|
21 | + } |
|
22 | + break; |
|
23 | + } |
|
24 | + } |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | function nestingSix() |
28 | 28 | { |
29 | - if ($condition) { |
|
30 | - echo 'hi'; |
|
31 | - switch ($condition) |
|
32 | - { |
|
33 | - case '1': |
|
34 | - if ($condition === '1') { |
|
35 | - if ($cond) { |
|
36 | - foreach ($conds as $cond) { |
|
37 | - echo 'hi'; |
|
38 | - } |
|
39 | - } |
|
40 | - } |
|
41 | - break; |
|
42 | - } |
|
43 | - } |
|
29 | + if ($condition) { |
|
30 | + echo 'hi'; |
|
31 | + switch ($condition) |
|
32 | + { |
|
33 | + case '1': |
|
34 | + if ($condition === '1') { |
|
35 | + if ($cond) { |
|
36 | + foreach ($conds as $cond) { |
|
37 | + echo 'hi'; |
|
38 | + } |
|
39 | + } |
|
40 | + } |
|
41 | + break; |
|
42 | + } |
|
43 | + } |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | function nestingTen() |
47 | 47 | { |
48 | - if ($condition) { |
|
49 | - echo 'hi'; |
|
50 | - switch ($condition) |
|
51 | - { |
|
52 | - case '1': |
|
53 | - if ($condition === '1') { |
|
54 | - if ($cond) { |
|
55 | - switch ($cond) { |
|
56 | - case '1': |
|
57 | - if ($cond === '1') { |
|
58 | - foreach ($conds as $cond) { |
|
59 | - if ($cond === 'hi') { |
|
60 | - echo 'hi'; |
|
61 | - } |
|
62 | - } |
|
63 | - } |
|
64 | - break; |
|
65 | - } |
|
66 | - } |
|
67 | - } |
|
68 | - break; |
|
69 | - } |
|
70 | - } |
|
48 | + if ($condition) { |
|
49 | + echo 'hi'; |
|
50 | + switch ($condition) |
|
51 | + { |
|
52 | + case '1': |
|
53 | + if ($condition === '1') { |
|
54 | + if ($cond) { |
|
55 | + switch ($cond) { |
|
56 | + case '1': |
|
57 | + if ($cond === '1') { |
|
58 | + foreach ($conds as $cond) { |
|
59 | + if ($cond === 'hi') { |
|
60 | + echo 'hi'; |
|
61 | + } |
|
62 | + } |
|
63 | + } |
|
64 | + break; |
|
65 | + } |
|
66 | + } |
|
67 | + } |
|
68 | + break; |
|
69 | + } |
|
70 | + } |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | function nestingEleven() |
74 | 74 | { |
75 | - if ($condition) { |
|
76 | - echo 'hi'; |
|
77 | - switch ($condition) |
|
78 | - { |
|
79 | - case '1': |
|
80 | - if ($condition === '1') { |
|
81 | - if ($cond) { |
|
82 | - switch ($cond) { |
|
83 | - case '1': |
|
84 | - if ($cond === '1') { |
|
85 | - foreach ($conds as $cond) { |
|
86 | - if ($cond === 'hi') { |
|
87 | - if ($cond !== 'bye') { |
|
88 | - echo 'hi'; |
|
89 | - } |
|
90 | - } |
|
91 | - } |
|
92 | - } |
|
93 | - break; |
|
94 | - } |
|
95 | - } |
|
96 | - } |
|
97 | - break; |
|
98 | - } |
|
99 | - } |
|
75 | + if ($condition) { |
|
76 | + echo 'hi'; |
|
77 | + switch ($condition) |
|
78 | + { |
|
79 | + case '1': |
|
80 | + if ($condition === '1') { |
|
81 | + if ($cond) { |
|
82 | + switch ($cond) { |
|
83 | + case '1': |
|
84 | + if ($cond === '1') { |
|
85 | + foreach ($conds as $cond) { |
|
86 | + if ($cond === 'hi') { |
|
87 | + if ($cond !== 'bye') { |
|
88 | + echo 'hi'; |
|
89 | + } |
|
90 | + } |
|
91 | + } |
|
92 | + } |
|
93 | + break; |
|
94 | + } |
|
95 | + } |
|
96 | + } |
|
97 | + break; |
|
98 | + } |
|
99 | + } |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | ?> |
@@ -2,20 +2,20 @@ discard block |
||
2 | 2 | |
3 | 3 | function nestingOne() |
4 | 4 | { |
5 | - if ($condition) { |
|
5 | + if ( $condition ) { |
|
6 | 6 | echo 'hi'; |
7 | 7 | } |
8 | 8 | } |
9 | 9 | |
10 | 10 | function nestingFive() |
11 | 11 | { |
12 | - if ($condition) { |
|
12 | + if ( $condition ) { |
|
13 | 13 | echo 'hi'; |
14 | - switch ($condition) |
|
14 | + switch ( $condition ) |
|
15 | 15 | { |
16 | 16 | case '1': |
17 | - if ($condition === '1') { |
|
18 | - if ($cond) { |
|
17 | + if ( $condition === '1' ) { |
|
18 | + if ( $cond ) { |
|
19 | 19 | echo 'hi'; |
20 | 20 | } |
21 | 21 | } |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | |
27 | 27 | function nestingSix() |
28 | 28 | { |
29 | - if ($condition) { |
|
29 | + if ( $condition ) { |
|
30 | 30 | echo 'hi'; |
31 | - switch ($condition) |
|
31 | + switch ( $condition ) |
|
32 | 32 | { |
33 | 33 | case '1': |
34 | - if ($condition === '1') { |
|
35 | - if ($cond) { |
|
36 | - foreach ($conds as $cond) { |
|
34 | + if ( $condition === '1' ) { |
|
35 | + if ( $cond ) { |
|
36 | + foreach ( $conds as $cond ) { |
|
37 | 37 | echo 'hi'; |
38 | 38 | } |
39 | 39 | } |
@@ -45,18 +45,18 @@ discard block |
||
45 | 45 | |
46 | 46 | function nestingTen() |
47 | 47 | { |
48 | - if ($condition) { |
|
48 | + if ( $condition ) { |
|
49 | 49 | echo 'hi'; |
50 | - switch ($condition) |
|
50 | + switch ( $condition ) |
|
51 | 51 | { |
52 | 52 | case '1': |
53 | - if ($condition === '1') { |
|
54 | - if ($cond) { |
|
55 | - switch ($cond) { |
|
53 | + if ( $condition === '1' ) { |
|
54 | + if ( $cond ) { |
|
55 | + switch ( $cond ) { |
|
56 | 56 | case '1': |
57 | - if ($cond === '1') { |
|
58 | - foreach ($conds as $cond) { |
|
59 | - if ($cond === 'hi') { |
|
57 | + if ( $cond === '1' ) { |
|
58 | + foreach ( $conds as $cond ) { |
|
59 | + if ( $cond === 'hi' ) { |
|
60 | 60 | echo 'hi'; |
61 | 61 | } |
62 | 62 | } |
@@ -72,19 +72,19 @@ discard block |
||
72 | 72 | |
73 | 73 | function nestingEleven() |
74 | 74 | { |
75 | - if ($condition) { |
|
75 | + if ( $condition ) { |
|
76 | 76 | echo 'hi'; |
77 | - switch ($condition) |
|
77 | + switch ( $condition ) |
|
78 | 78 | { |
79 | 79 | case '1': |
80 | - if ($condition === '1') { |
|
81 | - if ($cond) { |
|
82 | - switch ($cond) { |
|
80 | + if ( $condition === '1' ) { |
|
81 | + if ( $cond ) { |
|
82 | + switch ( $cond ) { |
|
83 | 83 | case '1': |
84 | - if ($cond === '1') { |
|
85 | - foreach ($conds as $cond) { |
|
86 | - if ($cond === 'hi') { |
|
87 | - if ($cond !== 'bye') { |
|
84 | + if ( $cond === '1' ) { |
|
85 | + foreach ( $conds as $cond ) { |
|
86 | + if ( $cond === 'hi' ) { |
|
87 | + if ( $cond !== 'bye' ) { |
|
88 | 88 | echo 'hi'; |
89 | 89 | } |
90 | 90 | } |
@@ -1,18 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -function nestingOne() |
|
4 | -{ |
|
3 | +function nestingOne() { |
|
5 | 4 | if ($condition) { |
6 | 5 | echo 'hi'; |
7 | 6 | } |
8 | 7 | } |
9 | 8 | |
10 | -function nestingFive() |
|
11 | -{ |
|
9 | +function nestingFive() { |
|
12 | 10 | if ($condition) { |
13 | 11 | echo 'hi'; |
14 | - switch ($condition) |
|
15 | - { |
|
12 | + switch ($condition) { |
|
16 | 13 | case '1': |
17 | 14 | if ($condition === '1') { |
18 | 15 | if ($cond) { |
@@ -24,12 +21,10 @@ discard block |
||
24 | 21 | } |
25 | 22 | } |
26 | 23 | |
27 | -function nestingSix() |
|
28 | -{ |
|
24 | +function nestingSix() { |
|
29 | 25 | if ($condition) { |
30 | 26 | echo 'hi'; |
31 | - switch ($condition) |
|
32 | - { |
|
27 | + switch ($condition) { |
|
33 | 28 | case '1': |
34 | 29 | if ($condition === '1') { |
35 | 30 | if ($cond) { |
@@ -43,12 +38,10 @@ discard block |
||
43 | 38 | } |
44 | 39 | } |
45 | 40 | |
46 | -function nestingTen() |
|
47 | -{ |
|
41 | +function nestingTen() { |
|
48 | 42 | if ($condition) { |
49 | 43 | echo 'hi'; |
50 | - switch ($condition) |
|
51 | - { |
|
44 | + switch ($condition) { |
|
52 | 45 | case '1': |
53 | 46 | if ($condition === '1') { |
54 | 47 | if ($cond) { |
@@ -70,12 +63,10 @@ discard block |
||
70 | 63 | } |
71 | 64 | } |
72 | 65 | |
73 | -function nestingEleven() |
|
74 | -{ |
|
66 | +function nestingEleven() { |
|
75 | 67 | if ($condition) { |
76 | 68 | echo 'hi'; |
77 | - switch ($condition) |
|
78 | - { |
|
69 | + switch ($condition) { |
|
79 | 70 | case '1': |
80 | 71 | if ($condition === '1') { |
81 | 72 | if ($cond) { |
@@ -15,37 +15,37 @@ |
||
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 [73 => 1]; |
|
29 | - |
|
30 | - }//end getErrorList() |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * Returns the lines where warnings should occur. |
|
35 | - * |
|
36 | - * The key of the array should represent the line number and the value |
|
37 | - * should represent the number of warnings that should occur on that line. |
|
38 | - * |
|
39 | - * @return array<int, int> |
|
40 | - */ |
|
41 | - public function getWarningList() |
|
42 | - { |
|
43 | - return [ |
|
44 | - 27 => 1, |
|
45 | - 46 => 1, |
|
46 | - ]; |
|
47 | - |
|
48 | - }//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 [73 => 1]; |
|
29 | + |
|
30 | + }//end getErrorList() |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * Returns the lines where warnings should occur. |
|
35 | + * |
|
36 | + * The key of the array should represent the line number and the value |
|
37 | + * should represent the number of warnings that should occur on that line. |
|
38 | + * |
|
39 | + * @return array<int, int> |
|
40 | + */ |
|
41 | + public function getWarningList() |
|
42 | + { |
|
43 | + return [ |
|
44 | + 27 => 1, |
|
45 | + 46 => 1, |
|
46 | + ]; |
|
47 | + |
|
48 | + }//end getWarningList() |
|
49 | 49 | |
50 | 50 | |
51 | 51 | }//end class |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function getErrorList() |
27 | 27 | { |
28 | - return [73 => 1]; |
|
28 | + return [ 73 => 1 ]; |
|
29 | 29 | |
30 | 30 | }//end getErrorList() |
31 | 31 |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | |
14 | -class NestingLevelUnitTest extends AbstractSniffUnitTest |
|
15 | -{ |
|
14 | +class NestingLevelUnitTest 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 [73 => 1]; |
29 | 27 | |
30 | 28 | }//end getErrorList() |
@@ -38,8 +36,7 @@ discard block |
||
38 | 36 | * |
39 | 37 | * @return array<int, int> |
40 | 38 | */ |
41 | - public function getWarningList() |
|
42 | - { |
|
39 | + public function getWarningList() { |
|
43 | 40 | return [ |
44 | 41 | 27 => 1, |
45 | 42 | 46 => 1, |