@@ -9,9 +9,3 @@ |
||
9 | 9 | $arr = array( |
10 | 10 | 'a' => 'a', |
11 | 11 | <<<<<<< HEAD |
12 | - 'b' => 'b' |
|
13 | -======= |
|
14 | - 'c' => 'c' |
|
15 | ->>>>>>> master |
|
16 | - ); |
|
17 | - } |
@@ -5,13 +5,7 @@ |
||
5 | 5 | // This is not a merge conflict - it is a valid test case to test handling of arrays without associated closer. |
6 | 6 | // Please do not remove. |
7 | 7 | function test() |
8 | - { |
|
9 | - $arr = array( |
|
10 | - 'a' => 'a', |
|
8 | + { |
|
9 | + $arr = array( |
|
10 | + 'a' => 'a', |
|
11 | 11 | <<<<<<< HEAD |
12 | - 'b' => 'b' |
|
13 | -======= |
|
14 | - 'c' => 'c' |
|
15 | ->>>>>>> master |
|
16 | - ); |
|
17 | - } |
@@ -9,9 +9,3 @@ |
||
9 | 9 | $arr = array( |
10 | 10 | 'a' => 'a', |
11 | 11 | <<<<<<< HEAD |
12 | - 'b' => 'b' |
|
13 | -======= |
|
14 | - 'c' => 'c' |
|
15 | ->>>>>>> master |
|
16 | - ); |
|
17 | - } |
@@ -8,10 +8,4 @@ |
||
8 | 8 | { |
9 | 9 | $arr = array( |
10 | 10 | 'a' => 'a', |
11 | -<<<<<<< HEAD |
|
12 | - 'b' => 'b' |
|
13 | -======= |
|
14 | - 'c' => 'c' |
|
15 | ->>>>>>> master |
|
16 | - ); |
|
17 | - } |
|
11 | +<< << <<< HEAD |
@@ -4,14 +4,7 @@ |
||
4 | 4 | // The following function has a simulated git conflict for testing. |
5 | 5 | // This is not a merge conflict - it is a valid test case to test handling of arrays without associated closer. |
6 | 6 | // Please do not remove. |
7 | -function test() |
|
8 | - { |
|
7 | +function test() { |
|
9 | 8 | $arr = array( |
10 | 9 | 'a' => 'a', |
11 | 10 | <<<<<<< HEAD |
12 | - 'b' => 'b' |
|
13 | -======= |
|
14 | - 'c' => 'c' |
|
15 | ->>>>>>> master |
|
16 | - ); |
|
17 | - } |
@@ -9,9 +9,3 @@ |
||
9 | 9 | $arr = array( |
10 | 10 | 'a' => 'a', |
11 | 11 | <<<<<<< HEAD |
12 | - 'b' => 'b' |
|
13 | -======= |
|
14 | - 'c' => 'c' |
|
15 | ->>>>>>> master |
|
16 | - ); |
|
17 | - } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | /** |
20 | 20 | * Should this test be skipped for some reason. |
21 | 21 | * |
22 | - * @return void |
|
22 | + * @return boolean |
|
23 | 23 | */ |
24 | 24 | protected function shouldSkipTest() |
25 | 25 | { |
@@ -16,54 +16,54 @@ |
||
16 | 16 | { |
17 | 17 | |
18 | 18 | |
19 | - /** |
|
20 | - * Should this test be skipped for some reason. |
|
21 | - * |
|
22 | - * @return void |
|
23 | - */ |
|
24 | - protected function shouldSkipTest() |
|
25 | - { |
|
26 | - $lintPath = Config::getExecutablePath('gjslint'); |
|
27 | - if ($lintPath === null) { |
|
28 | - return true; |
|
29 | - } |
|
19 | + /** |
|
20 | + * Should this test be skipped for some reason. |
|
21 | + * |
|
22 | + * @return void |
|
23 | + */ |
|
24 | + protected function shouldSkipTest() |
|
25 | + { |
|
26 | + $lintPath = Config::getExecutablePath('gjslint'); |
|
27 | + if ($lintPath === null) { |
|
28 | + return true; |
|
29 | + } |
|
30 | 30 | |
31 | - return false; |
|
31 | + return false; |
|
32 | 32 | |
33 | - }//end shouldSkipTest() |
|
33 | + }//end shouldSkipTest() |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * Returns the lines where errors should occur. |
|
38 | - * |
|
39 | - * The key of the array should represent the line number and the value |
|
40 | - * should represent the number of errors that should occur on that line. |
|
41 | - * |
|
42 | - * @return array<int, int> |
|
43 | - */ |
|
44 | - public function getErrorList() |
|
45 | - { |
|
46 | - return []; |
|
36 | + /** |
|
37 | + * Returns the lines where errors should occur. |
|
38 | + * |
|
39 | + * The key of the array should represent the line number and the value |
|
40 | + * should represent the number of errors that should occur on that line. |
|
41 | + * |
|
42 | + * @return array<int, int> |
|
43 | + */ |
|
44 | + public function getErrorList() |
|
45 | + { |
|
46 | + return []; |
|
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 [ |
|
62 | - 3 => 1, |
|
63 | - 5 => 1, |
|
64 | - ]; |
|
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 | + 3 => 1, |
|
63 | + 5 => 1, |
|
64 | + ]; |
|
65 | 65 | |
66 | - }//end getWarningList() |
|
66 | + }//end getWarningList() |
|
67 | 67 | |
68 | 68 | |
69 | 69 | }//end class |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | */ |
24 | 24 | protected function shouldSkipTest() |
25 | 25 | { |
26 | - $lintPath = Config::getExecutablePath('gjslint'); |
|
27 | - if ($lintPath === null) { |
|
26 | + $lintPath = Config::getExecutablePath( 'gjslint' ); |
|
27 | + if ( $lintPath === null ) { |
|
28 | 28 | return true; |
29 | 29 | } |
30 | 30 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function getErrorList() |
45 | 45 | { |
46 | - return []; |
|
46 | + return [ ]; |
|
47 | 47 | |
48 | 48 | }//end getErrorList() |
49 | 49 |
@@ -12,8 +12,7 @@ discard block |
||
12 | 12 | use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; |
13 | 13 | use PHP_CodeSniffer\Config; |
14 | 14 | |
15 | -class ClosureLinterUnitTest extends AbstractSniffUnitTest |
|
16 | -{ |
|
15 | +class ClosureLinterUnitTest extends AbstractSniffUnitTest { |
|
17 | 16 | |
18 | 17 | |
19 | 18 | /** |
@@ -21,8 +20,7 @@ discard block |
||
21 | 20 | * |
22 | 21 | * @return void |
23 | 22 | */ |
24 | - protected function shouldSkipTest() |
|
25 | - { |
|
23 | + protected function shouldSkipTest() { |
|
26 | 24 | $lintPath = Config::getExecutablePath('gjslint'); |
27 | 25 | if ($lintPath === null) { |
28 | 26 | return true; |
@@ -41,8 +39,7 @@ discard block |
||
41 | 39 | * |
42 | 40 | * @return array<int, int> |
43 | 41 | */ |
44 | - public function getErrorList() |
|
45 | - { |
|
42 | + public function getErrorList() { |
|
46 | 43 | return []; |
47 | 44 | |
48 | 45 | }//end getErrorList() |
@@ -56,8 +53,7 @@ discard block |
||
56 | 53 | * |
57 | 54 | * @return array<int, int> |
58 | 55 | */ |
59 | - public function getWarningList() |
|
60 | - { |
|
56 | + public function getWarningList() { |
|
61 | 57 | return [ |
62 | 58 | 3 => 1, |
63 | 59 | 5 => 1, |
@@ -57,5 +57,4 @@ |
||
57 | 57 | |
58 | 58 | // Test that stray boundaries, i.e. an opener without closer and such, are detected. |
59 | 59 | <<<<<<< HEAD |
60 | -$a = 1; |
|
61 | -======= |
|
60 | +$a |
|
62 | 61 | \ No newline at end of file |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | */ |
21 | 21 | |
22 | 22 | function test() |
23 | - { |
|
24 | - $arr = array( |
|
25 | - 'a' => 'a' |
|
23 | + { |
|
24 | + $arr = array( |
|
25 | + 'a' => 'a' |
|
26 | 26 | <<<<<<< HEAD |
27 | 27 | 'b' => 'b' |
28 | 28 | ======= |
@@ -57,5 +57,4 @@ discard block |
||
57 | 57 | |
58 | 58 | // Test that stray boundaries, i.e. an opener without closer and such, are detected. |
59 | 59 | <<<<<<< HEAD |
60 | -$a = 1; |
|
61 | -======= |
|
60 | +$a |
|
62 | 61 | \ No newline at end of file |
@@ -57,5 +57,4 @@ |
||
57 | 57 | |
58 | 58 | // Test that stray boundaries, i.e. an opener without closer and such, are detected. |
59 | 59 | <<<<<<< HEAD |
60 | -$a = 1; |
|
61 | -======= |
|
60 | +$a |
|
62 | 61 | \ No newline at end of file |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -var_dump(1 << -1); |
|
4 | -var_dump(1 >> -1); |
|
3 | +var_dump( 1 << -1 ); |
|
4 | +var_dump( 1 >> -1 ); |
|
5 | 5 | var_dump( |
6 | 6 | 1 |
7 | 7 | << |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | { |
24 | 24 | $arr = array( |
25 | 25 | 'a' => 'a' |
26 | -<<<<<<< HEAD |
|
26 | +<< << <<< HEAD |
|
27 | 27 | 'b' => 'b' |
28 | 28 | ======= |
29 | 29 | 'c' => 'c' |
@@ -57,5 +57,4 @@ discard block |
||
57 | 57 | |
58 | 58 | // Test that stray boundaries, i.e. an opener without closer and such, are detected. |
59 | 59 | <<<<<<< HEAD |
60 | -$a = 1; |
|
61 | -======= |
|
60 | +$a |
|
62 | 61 | \ No newline at end of file |
@@ -19,8 +19,7 @@ discard block |
||
19 | 19 | * <<<<<<< HEAD |
20 | 20 | */ |
21 | 21 | |
22 | -function test() |
|
23 | - { |
|
22 | +function test() { |
|
24 | 23 | $arr = array( |
25 | 24 | 'a' => 'a' |
26 | 25 | <<<<<<< HEAD |
@@ -57,5 +56,4 @@ discard block |
||
57 | 56 | |
58 | 57 | // Test that stray boundaries, i.e. an opener without closer and such, are detected. |
59 | 58 | <<<<<<< HEAD |
60 | -$a = 1; |
|
61 | -======= |
|
59 | +$a |
|
62 | 60 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | $string = |
12 | 12 | <<<EOD |
13 | 13 | This is a heredoc. |
14 | -EOD; |
|
14 | +eod; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * This is not a merge conflict, but a comment showing what |
@@ -57,5 +57,4 @@ discard block |
||
57 | 57 | |
58 | 58 | // Test that stray boundaries, i.e. an opener without closer and such, are detected. |
59 | 59 | <<<<<<< HEAD |
60 | -$a = 1; |
|
61 | -======= |
|
60 | +$a |
|
62 | 61 | \ No newline at end of file |
@@ -24,8 +24,3 @@ |
||
24 | 24 | |
25 | 25 | // Comment |
26 | 26 | <<<<<<< HEAD |
27 | -// Second comment line. NOTE: The above opener breaks the tokenizer. |
|
28 | -======= |
|
29 | -// New second comment line |
|
30 | ->>>>>>> master |
|
31 | -// Third comment line |
@@ -24,8 +24,3 @@ |
||
24 | 24 | |
25 | 25 | // Comment |
26 | 26 | <<<<<<< HEAD |
27 | -// Second comment line. NOTE: The above opener breaks the tokenizer. |
|
28 | -======= |
|
29 | -// New second comment line |
|
30 | ->>>>>>> master |
|
31 | -// Third comment line |
@@ -24,8 +24,3 @@ |
||
24 | 24 | |
25 | 25 | // Comment |
26 | 26 | <<<<<<< HEAD |
27 | -// Second comment line. NOTE: The above opener breaks the tokenizer. |
|
28 | -======= |
|
29 | -// New second comment line |
|
30 | ->>>>>>> master |
|
31 | -// Third comment line |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | <<<<<<< HEAD |
15 | 15 | * @var string $bar |
16 | 16 | */ |
17 | -public function foo($bar){ } |
|
17 | +public function foo( $bar ) { } |
|
18 | 18 | |
19 | 19 | /* |
20 | 20 | ======= |
@@ -23,9 +23,4 @@ discard block |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | // Comment |
26 | -<<<<<<< HEAD |
|
27 | -// Second comment line. NOTE: The above opener breaks the tokenizer. |
|
28 | -======= |
|
29 | -// New second comment line |
|
30 | ->>>>>>> master |
|
31 | -// Third comment line |
|
26 | +<< << <<< HEAD |
@@ -24,8 +24,3 @@ |
||
24 | 24 | |
25 | 25 | // Comment |
26 | 26 | <<<<<<< HEAD |
27 | -// Second comment line. NOTE: The above opener breaks the tokenizer. |
|
28 | -======= |
|
29 | -// New second comment line |
|
30 | ->>>>>>> master |
|
31 | -// Third comment line |
@@ -24,8 +24,3 @@ |
||
24 | 24 | |
25 | 25 | // Comment |
26 | 26 | <<<<<<< HEAD |
27 | -// Second comment line. NOTE: The above opener breaks the tokenizer. |
|
28 | -======= |
|
29 | -// New second comment line |
|
30 | ->>>>>>> master |
|
31 | -// Third comment line |
@@ -22,22 +22,4 @@ |
||
22 | 22 | <<<<<<< HEAD |
23 | 23 | $a = 1; |
24 | 24 | ======= |
25 | -$a = 2; |
|
26 | ->>>>>>> master |
|
27 | - |
|
28 | -/* |
|
29 | - * The above tests are based on "normal" tokens. |
|
30 | - * The below test checks that once the tokenizer breaks down because of |
|
31 | - * unexpected merge conflict boundaries - i.e. after the first merge conflict |
|
32 | - * opener in non-comment, non-heredoc/nowdoc, non-inline HTML code -, subsequent |
|
33 | - * merge conflict boundaries will still be detected correctly. |
|
34 | - */ |
|
35 | -?> |
|
36 | - |
|
37 | -<div class="abc"> |
|
38 | -<<<<<<< HEAD |
|
39 | - <p id="test-this">Testing a merge conflict.</p> |
|
40 | -======= |
|
41 | - <p id="test-that">Another text string.</p> |
|
42 | ->>>>>>> ref/heads/feature-branch |
|
43 | -</div> |
|
25 | +$a |
|
44 | 26 | \ No newline at end of file |
@@ -22,22 +22,4 @@ |
||
22 | 22 | <<<<<<< HEAD |
23 | 23 | $a = 1; |
24 | 24 | ======= |
25 | -$a = 2; |
|
26 | ->>>>>>> master |
|
27 | - |
|
28 | -/* |
|
29 | - * The above tests are based on "normal" tokens. |
|
30 | - * The below test checks that once the tokenizer breaks down because of |
|
31 | - * unexpected merge conflict boundaries - i.e. after the first merge conflict |
|
32 | - * opener in non-comment, non-heredoc/nowdoc, non-inline HTML code -, subsequent |
|
33 | - * merge conflict boundaries will still be detected correctly. |
|
34 | - */ |
|
35 | -?> |
|
36 | - |
|
37 | -<div class="abc"> |
|
38 | -<<<<<<< HEAD |
|
39 | - <p id="test-this">Testing a merge conflict.</p> |
|
40 | -======= |
|
41 | - <p id="test-that">Another text string.</p> |
|
42 | ->>>>>>> ref/heads/feature-branch |
|
43 | -</div> |
|
25 | +$a |
|
44 | 26 | \ No newline at end of file |
@@ -22,22 +22,4 @@ |
||
22 | 22 | <<<<<<< HEAD |
23 | 23 | $a = 1; |
24 | 24 | ======= |
25 | -$a = 2; |
|
26 | ->>>>>>> master |
|
27 | - |
|
28 | -/* |
|
29 | - * The above tests are based on "normal" tokens. |
|
30 | - * The below test checks that once the tokenizer breaks down because of |
|
31 | - * unexpected merge conflict boundaries - i.e. after the first merge conflict |
|
32 | - * opener in non-comment, non-heredoc/nowdoc, non-inline HTML code -, subsequent |
|
33 | - * merge conflict boundaries will still be detected correctly. |
|
34 | - */ |
|
35 | -?> |
|
36 | - |
|
37 | -<div class="abc"> |
|
38 | -<<<<<<< HEAD |
|
39 | - <p id="test-this">Testing a merge conflict.</p> |
|
40 | -======= |
|
41 | - <p id="test-that">Another text string.</p> |
|
42 | ->>>>>>> ref/heads/feature-branch |
|
43 | -</div> |
|
25 | +$a |
|
44 | 26 | \ No newline at end of file |
@@ -19,25 +19,7 @@ |
||
19 | 19 | <?php |
20 | 20 | |
21 | 21 | // Break the tokenizer. |
22 | -<<<<<<< HEAD |
|
22 | +<< << <<< HEAD |
|
23 | 23 | $a = 1; |
24 | 24 | ======= |
25 | -$a = 2; |
|
26 | ->>>>>>> master |
|
27 | - |
|
28 | -/* |
|
29 | - * The above tests are based on "normal" tokens. |
|
30 | - * The below test checks that once the tokenizer breaks down because of |
|
31 | - * unexpected merge conflict boundaries - i.e. after the first merge conflict |
|
32 | - * opener in non-comment, non-heredoc/nowdoc, non-inline HTML code -, subsequent |
|
33 | - * merge conflict boundaries will still be detected correctly. |
|
34 | - */ |
|
35 | -?> |
|
36 | - |
|
37 | -<div class="abc"> |
|
38 | -<<<<<<< HEAD |
|
39 | - <p id="test-this">Testing a merge conflict.</p> |
|
40 | -======= |
|
41 | - <p id="test-that">Another text string.</p> |
|
42 | ->>>>>>> ref/heads/feature-branch |
|
43 | -</div> |
|
25 | +$a |
|
44 | 26 | \ No newline at end of file |
@@ -22,22 +22,4 @@ |
||
22 | 22 | <<<<<<< HEAD |
23 | 23 | $a = 1; |
24 | 24 | ======= |
25 | -$a = 2; |
|
26 | ->>>>>>> master |
|
27 | - |
|
28 | -/* |
|
29 | - * The above tests are based on "normal" tokens. |
|
30 | - * The below test checks that once the tokenizer breaks down because of |
|
31 | - * unexpected merge conflict boundaries - i.e. after the first merge conflict |
|
32 | - * opener in non-comment, non-heredoc/nowdoc, non-inline HTML code -, subsequent |
|
33 | - * merge conflict boundaries will still be detected correctly. |
|
34 | - */ |
|
35 | -?> |
|
36 | - |
|
37 | -<div class="abc"> |
|
38 | -<<<<<<< HEAD |
|
39 | - <p id="test-this">Testing a merge conflict.</p> |
|
40 | -======= |
|
41 | - <p id="test-that">Another text string.</p> |
|
42 | ->>>>>>> ref/heads/feature-branch |
|
43 | -</div> |
|
25 | +$a |
|
44 | 26 | \ No newline at end of file |
@@ -22,22 +22,4 @@ |
||
22 | 22 | <<<<<<< HEAD |
23 | 23 | $a = 1; |
24 | 24 | ======= |
25 | -$a = 2; |
|
26 | ->>>>>>> master |
|
27 | - |
|
28 | -/* |
|
29 | - * The above tests are based on "normal" tokens. |
|
30 | - * The below test checks that once the tokenizer breaks down because of |
|
31 | - * unexpected merge conflict boundaries - i.e. after the first merge conflict |
|
32 | - * opener in non-comment, non-heredoc/nowdoc, non-inline HTML code -, subsequent |
|
33 | - * merge conflict boundaries will still be detected correctly. |
|
34 | - */ |
|
35 | -?> |
|
36 | - |
|
37 | -<div class="abc"> |
|
38 | -<<<<<<< HEAD |
|
39 | - <p id="test-this">Testing a merge conflict.</p> |
|
40 | -======= |
|
41 | - <p id="test-that">Another text string.</p> |
|
42 | ->>>>>>> ref/heads/feature-branch |
|
43 | -</div> |
|
25 | +$a |
|
44 | 26 | \ No newline at end of file |
@@ -64,8 +64,4 @@ |
||
64 | 64 | <<<<<<< HEAD |
65 | 65 | can be problematic. |
66 | 66 | EOD; |
67 | -$a = 1; |
|
68 | -======= |
|
69 | -should also be detected. |
|
70 | -EOT; |
|
71 | ->>>>>>> ref/heads/other-branchname |
|
67 | +$a |
|
72 | 68 | \ No newline at end of file |
@@ -64,8 +64,4 @@ |
||
64 | 64 | <<<<<<< HEAD |
65 | 65 | can be problematic. |
66 | 66 | EOD; |
67 | -$a = 1; |
|
68 | -======= |
|
69 | -should also be detected. |
|
70 | -EOT; |
|
71 | ->>>>>>> ref/heads/other-branchname |
|
67 | +$a |
|
72 | 68 | \ No newline at end of file |
@@ -64,8 +64,4 @@ |
||
64 | 64 | <<<<<<< HEAD |
65 | 65 | can be problematic. |
66 | 66 | EOD; |
67 | -$a = 1; |
|
68 | -======= |
|
69 | -should also be detected. |
|
70 | -EOT; |
|
71 | ->>>>>>> ref/heads/other-branchname |
|
67 | +$a |
|
72 | 68 | \ No newline at end of file |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | ======= |
23 | 23 | should also be detected. |
24 | 24 | EOT; |
25 | ->>>>>>> ref/heads/other-branchname |
|
25 | +>> >> >> > ref / heads / other - branchname |
|
26 | 26 | |
27 | 27 | // Merge conflict starter outside with a closer inside of the heredoc. |
28 | 28 | // This breaks the tokenizer. |
29 | -<<<<<<< HEAD |
|
29 | +<< << <<< HEAD |
|
30 | 30 | $string = |
31 | 31 | <<<EOT |
32 | 32 | Merge conflicts in heredocs |
@@ -64,8 +64,4 @@ discard block |
||
64 | 64 | <<<<<<< HEAD |
65 | 65 | can be problematic. |
66 | 66 | EOD; |
67 | -$a = 1; |
|
68 | -======= |
|
69 | -should also be detected. |
|
70 | -EOT; |
|
71 | ->>>>>>> ref/heads/other-branchname |
|
67 | +$a |
|
72 | 68 | \ No newline at end of file |
@@ -64,8 +64,4 @@ |
||
64 | 64 | <<<<<<< HEAD |
65 | 65 | can be problematic. |
66 | 66 | EOD; |
67 | -$a = 1; |
|
68 | -======= |
|
69 | -should also be detected. |
|
70 | -EOT; |
|
71 | ->>>>>>> ref/heads/other-branchname |
|
67 | +$a |
|
72 | 68 | \ No newline at end of file |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | should also be detected. |
10 | 10 | >>>>>>> ref/heads/other-branchname |
11 | 11 | And now they are. |
12 | -EOD; |
|
12 | +eod; |
|
13 | 13 | |
14 | 14 | // Heredoc with a merge conflict starter, the closer is outside the heredoc. |
15 | 15 | $string = |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $a = 1; |
22 | 22 | ======= |
23 | 23 | should also be detected. |
24 | -EOT; |
|
24 | +eot; |
|
25 | 25 | >>>>>>> ref/heads/other-branchname |
26 | 26 | |
27 | 27 | // Merge conflict starter outside with a closer inside of the heredoc. |
@@ -64,8 +64,4 @@ discard block |
||
64 | 64 | <<<<<<< HEAD |
65 | 65 | can be problematic. |
66 | 66 | EOD; |
67 | -$a = 1; |
|
68 | -======= |
|
69 | -should also be detected. |
|
70 | -EOT; |
|
71 | ->>>>>>> ref/heads/other-branchname |
|
67 | +$a |
|
72 | 68 | \ No newline at end of file |
@@ -22,13 +22,4 @@ |
||
22 | 22 | * merge conflict boundaries will still be detected correctly. |
23 | 23 | */ |
24 | 24 | |
25 | -$string = |
|
26 | -<<<'EOD' |
|
27 | -can be problematic. |
|
28 | -<<<<<<< HEAD |
|
29 | -were previously not detected. |
|
30 | -======= |
|
31 | -should also be detected. |
|
32 | ->>>>>>> ref/heads/other-branchname |
|
33 | -And now they are. |
|
34 | -EOD; |
|
25 | +$string |
|
35 | 26 | \ No newline at end of file |
@@ -22,13 +22,4 @@ |
||
22 | 22 | * merge conflict boundaries will still be detected correctly. |
23 | 23 | */ |
24 | 24 | |
25 | -$string = |
|
26 | -<<<'EOD' |
|
27 | -can be problematic. |
|
28 | -<<<<<<< HEAD |
|
29 | -were previously not detected. |
|
30 | -======= |
|
31 | -should also be detected. |
|
32 | ->>>>>>> ref/heads/other-branchname |
|
33 | -And now they are. |
|
34 | -EOD; |
|
25 | +$string |
|
35 | 26 | \ No newline at end of file |
@@ -22,13 +22,4 @@ |
||
22 | 22 | * merge conflict boundaries will still be detected correctly. |
23 | 23 | */ |
24 | 24 | |
25 | -$string = |
|
26 | -<<<'EOD' |
|
27 | -can be problematic. |
|
28 | -<<<<<<< HEAD |
|
29 | -were previously not detected. |
|
30 | -======= |
|
31 | -should also be detected. |
|
32 | ->>>>>>> ref/heads/other-branchname |
|
33 | -And now they are. |
|
34 | -EOD; |
|
25 | +$string |
|
35 | 26 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | EOD; |
13 | 13 | |
14 | 14 | // Break the tokenizer. |
15 | -<<<<<<< HEAD |
|
15 | +<< << <<< HEAD |
|
16 | 16 | |
17 | 17 | /* |
18 | 18 | * The above tests are based on "normal" tokens. |
@@ -22,13 +22,4 @@ discard block |
||
22 | 22 | * merge conflict boundaries will still be detected correctly. |
23 | 23 | */ |
24 | 24 | |
25 | -$string = |
|
26 | -<<<'EOD' |
|
27 | -can be problematic. |
|
28 | -<<<<<<< HEAD |
|
29 | -were previously not detected. |
|
30 | -======= |
|
31 | -should also be detected. |
|
32 | ->>>>>>> ref/heads/other-branchname |
|
33 | -And now they are. |
|
34 | -EOD; |
|
25 | +$string |
|
35 | 26 | \ No newline at end of file |
@@ -22,13 +22,4 @@ |
||
22 | 22 | * merge conflict boundaries will still be detected correctly. |
23 | 23 | */ |
24 | 24 | |
25 | -$string = |
|
26 | -<<<'EOD' |
|
27 | -can be problematic. |
|
28 | -<<<<<<< HEAD |
|
29 | -were previously not detected. |
|
30 | -======= |
|
31 | -should also be detected. |
|
32 | ->>>>>>> ref/heads/other-branchname |
|
33 | -And now they are. |
|
34 | -EOD; |
|
25 | +$string |
|
35 | 26 | \ No newline at end of file |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | should also be detected. |
10 | 10 | >>>>>>> ref/heads/other-branchname |
11 | 11 | And now they are. |
12 | -EOD; |
|
12 | +eod; |
|
13 | 13 | |
14 | 14 | // Break the tokenizer. |
15 | 15 | <<<<<<< HEAD |
@@ -22,13 +22,4 @@ discard block |
||
22 | 22 | * merge conflict boundaries will still be detected correctly. |
23 | 23 | */ |
24 | 24 | |
25 | -$string = |
|
26 | -<<<'EOD' |
|
27 | -can be problematic. |
|
28 | -<<<<<<< HEAD |
|
29 | -were previously not detected. |
|
30 | -======= |
|
31 | -should also be detected. |
|
32 | ->>>>>>> ref/heads/other-branchname |
|
33 | -And now they are. |
|
34 | -EOD; |
|
25 | +$string |
|
35 | 26 | \ No newline at end of file |
@@ -22,13 +22,4 @@ |
||
22 | 22 | * merge conflict boundaries will still be detected correctly. |
23 | 23 | */ |
24 | 24 | |
25 | -$string = |
|
26 | - <<<"EOD" |
|
27 | - Merge conflicts in PHP 7.3 indented heredocs |
|
28 | -<<<<<<< HEAD |
|
29 | - can be problematic. |
|
30 | -======= |
|
31 | - should also be detected. |
|
32 | ->>>>>>> ref/heads/other-branchname |
|
33 | - And now they are. |
|
34 | - EOD; |
|
25 | +$string |
|
35 | 26 | \ No newline at end of file |
@@ -22,13 +22,4 @@ |
||
22 | 22 | * merge conflict boundaries will still be detected correctly. |
23 | 23 | */ |
24 | 24 | |
25 | -$string = |
|
26 | - <<<"EOD" |
|
27 | - Merge conflicts in PHP 7.3 indented heredocs |
|
28 | -<<<<<<< HEAD |
|
29 | - can be problematic. |
|
30 | -======= |
|
31 | - should also be detected. |
|
32 | ->>>>>>> ref/heads/other-branchname |
|
33 | - And now they are. |
|
34 | - EOD; |
|
25 | +$string |
|
35 | 26 | \ No newline at end of file |
@@ -22,13 +22,4 @@ |
||
22 | 22 | * merge conflict boundaries will still be detected correctly. |
23 | 23 | */ |
24 | 24 | |
25 | -$string = |
|
26 | - <<<"EOD" |
|
27 | - Merge conflicts in PHP 7.3 indented heredocs |
|
28 | -<<<<<<< HEAD |
|
29 | - can be problematic. |
|
30 | -======= |
|
31 | - should also be detected. |
|
32 | ->>>>>>> ref/heads/other-branchname |
|
33 | - And now they are. |
|
34 | - EOD; |
|
25 | +$string |
|
35 | 26 | \ No newline at end of file |
@@ -22,13 +22,4 @@ |
||
22 | 22 | * merge conflict boundaries will still be detected correctly. |
23 | 23 | */ |
24 | 24 | |
25 | -$string = |
|
26 | - <<<"EOD" |
|
27 | - Merge conflicts in PHP 7.3 indented heredocs |
|
28 | -<<<<<<< HEAD |
|
29 | - can be problematic. |
|
30 | -======= |
|
31 | - should also be detected. |
|
32 | ->>>>>>> ref/heads/other-branchname |
|
33 | - And now they are. |
|
34 | - EOD; |
|
25 | +$string |
|
35 | 26 | \ No newline at end of file |
@@ -22,13 +22,4 @@ |
||
22 | 22 | * merge conflict boundaries will still be detected correctly. |
23 | 23 | */ |
24 | 24 | |
25 | -$string = |
|
26 | - <<<"EOD" |
|
27 | - Merge conflicts in PHP 7.3 indented heredocs |
|
28 | -<<<<<<< HEAD |
|
29 | - can be problematic. |
|
30 | -======= |
|
31 | - should also be detected. |
|
32 | ->>>>>>> ref/heads/other-branchname |
|
33 | - And now they are. |
|
34 | - EOD; |
|
25 | +$string |
|
35 | 26 | \ No newline at end of file |
@@ -22,13 +22,4 @@ |
||
22 | 22 | * merge conflict boundaries will still be detected correctly. |
23 | 23 | */ |
24 | 24 | |
25 | -$string = |
|
26 | - <<<"EOD" |
|
27 | - Merge conflicts in PHP 7.3 indented heredocs |
|
28 | -<<<<<<< HEAD |
|
29 | - can be problematic. |
|
30 | -======= |
|
31 | - should also be detected. |
|
32 | ->>>>>>> ref/heads/other-branchname |
|
33 | - And now they are. |
|
34 | - EOD; |
|
25 | +$string |
|
35 | 26 | \ No newline at end of file |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * Returns an array of tokens this test wants to listen for. |
21 | 21 | * |
22 | - * @return array |
|
22 | + * @return integer[] |
|
23 | 23 | */ |
24 | 24 | public function register() |
25 | 25 | { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param int $stackPtr The position in the tokens array of the |
83 | 83 | * potentially included class. |
84 | 84 | * |
85 | - * @return string |
|
85 | + * @return boolean |
|
86 | 86 | */ |
87 | 87 | protected function getIncludedClassFromToken( |
88 | 88 | $phpcsFile, |
@@ -16,83 +16,83 @@ |
||
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 [T_DOUBLE_COLON]; |
|
27 | - |
|
28 | - }//end register() |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * Processes this sniff, when one of its tokens is encountered. |
|
33 | - * |
|
34 | - * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. |
|
35 | - * @param int $stackPtr The position of the current token in |
|
36 | - * the stack passed in $tokens. |
|
37 | - * |
|
38 | - * @return void |
|
39 | - */ |
|
40 | - public function process(File $phpcsFile, $stackPtr) |
|
41 | - { |
|
42 | - $fileName = $phpcsFile->getFilename(); |
|
43 | - $matches = []; |
|
44 | - if (preg_match('|/systems/(.*)/([^/]+)?actions.inc$|i', $fileName, $matches) === 0) { |
|
45 | - // Not an actions file. |
|
46 | - return; |
|
47 | - } |
|
48 | - |
|
49 | - $ownClass = $matches[2]; |
|
50 | - $tokens = $phpcsFile->getTokens(); |
|
51 | - |
|
52 | - $typeName = $phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, ($stackPtr + 2), null, false, true); |
|
53 | - $typeName = trim($tokens[$typeName]['content'], " '"); |
|
54 | - switch (strtolower($tokens[($stackPtr + 1)]['content'])) { |
|
55 | - case 'includesystem' : |
|
56 | - $included = strtolower($typeName); |
|
57 | - break; |
|
58 | - case 'includeasset' : |
|
59 | - $included = strtolower($typeName).'assettype'; |
|
60 | - break; |
|
61 | - case 'includewidget' : |
|
62 | - $included = strtolower($typeName).'widgettype'; |
|
63 | - break; |
|
64 | - default: |
|
65 | - return; |
|
66 | - } |
|
67 | - |
|
68 | - if ($included === strtolower($ownClass)) { |
|
69 | - $error = "You do not need to include \"%s\" from within the system's own actions file"; |
|
70 | - $data = [$ownClass]; |
|
71 | - $phpcsFile->addError($error, $stackPtr, 'NotRequired', $data); |
|
72 | - } |
|
73 | - |
|
74 | - }//end process() |
|
75 | - |
|
76 | - |
|
77 | - /** |
|
78 | - * Determines the included class name from given token. |
|
79 | - * |
|
80 | - * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found. |
|
81 | - * @param array $tokens The array of file tokens. |
|
82 | - * @param int $stackPtr The position in the tokens array of the |
|
83 | - * potentially included class. |
|
84 | - * |
|
85 | - * @return string |
|
86 | - */ |
|
87 | - protected function getIncludedClassFromToken( |
|
88 | - $phpcsFile, |
|
89 | - array $tokens, |
|
90 | - $stackPtr |
|
91 | - ) { |
|
92 | - |
|
93 | - return false; |
|
94 | - |
|
95 | - }//end getIncludedClassFromToken() |
|
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 [T_DOUBLE_COLON]; |
|
27 | + |
|
28 | + }//end register() |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * Processes this sniff, when one of its tokens is encountered. |
|
33 | + * |
|
34 | + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. |
|
35 | + * @param int $stackPtr The position of the current token in |
|
36 | + * the stack passed in $tokens. |
|
37 | + * |
|
38 | + * @return void |
|
39 | + */ |
|
40 | + public function process(File $phpcsFile, $stackPtr) |
|
41 | + { |
|
42 | + $fileName = $phpcsFile->getFilename(); |
|
43 | + $matches = []; |
|
44 | + if (preg_match('|/systems/(.*)/([^/]+)?actions.inc$|i', $fileName, $matches) === 0) { |
|
45 | + // Not an actions file. |
|
46 | + return; |
|
47 | + } |
|
48 | + |
|
49 | + $ownClass = $matches[2]; |
|
50 | + $tokens = $phpcsFile->getTokens(); |
|
51 | + |
|
52 | + $typeName = $phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, ($stackPtr + 2), null, false, true); |
|
53 | + $typeName = trim($tokens[$typeName]['content'], " '"); |
|
54 | + switch (strtolower($tokens[($stackPtr + 1)]['content'])) { |
|
55 | + case 'includesystem' : |
|
56 | + $included = strtolower($typeName); |
|
57 | + break; |
|
58 | + case 'includeasset' : |
|
59 | + $included = strtolower($typeName).'assettype'; |
|
60 | + break; |
|
61 | + case 'includewidget' : |
|
62 | + $included = strtolower($typeName).'widgettype'; |
|
63 | + break; |
|
64 | + default: |
|
65 | + return; |
|
66 | + } |
|
67 | + |
|
68 | + if ($included === strtolower($ownClass)) { |
|
69 | + $error = "You do not need to include \"%s\" from within the system's own actions file"; |
|
70 | + $data = [$ownClass]; |
|
71 | + $phpcsFile->addError($error, $stackPtr, 'NotRequired', $data); |
|
72 | + } |
|
73 | + |
|
74 | + }//end process() |
|
75 | + |
|
76 | + |
|
77 | + /** |
|
78 | + * Determines the included class name from given token. |
|
79 | + * |
|
80 | + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found. |
|
81 | + * @param array $tokens The array of file tokens. |
|
82 | + * @param int $stackPtr The position in the tokens array of the |
|
83 | + * potentially included class. |
|
84 | + * |
|
85 | + * @return string |
|
86 | + */ |
|
87 | + protected function getIncludedClassFromToken( |
|
88 | + $phpcsFile, |
|
89 | + array $tokens, |
|
90 | + $stackPtr |
|
91 | + ) { |
|
92 | + |
|
93 | + return false; |
|
94 | + |
|
95 | + }//end getIncludedClassFromToken() |
|
96 | 96 | |
97 | 97 | |
98 | 98 | }//end class |
@@ -52,17 +52,17 @@ |
||
52 | 52 | $typeName = $phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, ($stackPtr + 2), null, false, true); |
53 | 53 | $typeName = trim($tokens[$typeName]['content'], " '"); |
54 | 54 | switch (strtolower($tokens[($stackPtr + 1)]['content'])) { |
55 | - case 'includesystem' : |
|
56 | - $included = strtolower($typeName); |
|
57 | - break; |
|
58 | - case 'includeasset' : |
|
59 | - $included = strtolower($typeName).'assettype'; |
|
60 | - break; |
|
61 | - case 'includewidget' : |
|
62 | - $included = strtolower($typeName).'widgettype'; |
|
63 | - break; |
|
64 | - default: |
|
65 | - return; |
|
55 | + case 'includesystem' : |
|
56 | + $included = strtolower($typeName); |
|
57 | + break; |
|
58 | + case 'includeasset' : |
|
59 | + $included = strtolower($typeName).'assettype'; |
|
60 | + break; |
|
61 | + case 'includewidget' : |
|
62 | + $included = strtolower($typeName).'widgettype'; |
|
63 | + break; |
|
64 | + default: |
|
65 | + return; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | if ($included === strtolower($ownClass)) { |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function register() |
25 | 25 | { |
26 | - return [T_DOUBLE_COLON]; |
|
26 | + return [ T_DOUBLE_COLON ]; |
|
27 | 27 | |
28 | 28 | }//end register() |
29 | 29 | |
@@ -37,38 +37,38 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @return void |
39 | 39 | */ |
40 | - public function process(File $phpcsFile, $stackPtr) |
|
40 | + public function process( File $phpcsFile, $stackPtr ) |
|
41 | 41 | { |
42 | 42 | $fileName = $phpcsFile->getFilename(); |
43 | - $matches = []; |
|
44 | - if (preg_match('|/systems/(.*)/([^/]+)?actions.inc$|i', $fileName, $matches) === 0) { |
|
43 | + $matches = [ ]; |
|
44 | + if ( preg_match( '|/systems/(.*)/([^/]+)?actions.inc$|i', $fileName, $matches ) === 0 ) { |
|
45 | 45 | // Not an actions file. |
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
49 | - $ownClass = $matches[2]; |
|
49 | + $ownClass = $matches[ 2 ]; |
|
50 | 50 | $tokens = $phpcsFile->getTokens(); |
51 | 51 | |
52 | - $typeName = $phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, ($stackPtr + 2), null, false, true); |
|
53 | - $typeName = trim($tokens[$typeName]['content'], " '"); |
|
54 | - switch (strtolower($tokens[($stackPtr + 1)]['content'])) { |
|
52 | + $typeName = $phpcsFile->findNext( T_CONSTANT_ENCAPSED_STRING, ( $stackPtr + 2 ), null, false, true ); |
|
53 | + $typeName = trim( $tokens[ $typeName ][ 'content' ], " '" ); |
|
54 | + switch ( strtolower( $tokens[ ( $stackPtr + 1 ) ][ 'content' ] ) ) { |
|
55 | 55 | case 'includesystem' : |
56 | - $included = strtolower($typeName); |
|
56 | + $included = strtolower( $typeName ); |
|
57 | 57 | break; |
58 | 58 | case 'includeasset' : |
59 | - $included = strtolower($typeName).'assettype'; |
|
59 | + $included = strtolower( $typeName ) . 'assettype'; |
|
60 | 60 | break; |
61 | 61 | case 'includewidget' : |
62 | - $included = strtolower($typeName).'widgettype'; |
|
62 | + $included = strtolower( $typeName ) . 'widgettype'; |
|
63 | 63 | break; |
64 | 64 | default: |
65 | 65 | return; |
66 | 66 | } |
67 | 67 | |
68 | - if ($included === strtolower($ownClass)) { |
|
68 | + if ( $included === strtolower( $ownClass ) ) { |
|
69 | 69 | $error = "You do not need to include \"%s\" from within the system's own actions file"; |
70 | - $data = [$ownClass]; |
|
71 | - $phpcsFile->addError($error, $stackPtr, 'NotRequired', $data); |
|
70 | + $data = [ $ownClass ]; |
|
71 | + $phpcsFile->addError( $error, $stackPtr, 'NotRequired', $data ); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | }//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 IncludeOwnSystemSniff implements Sniff |
|
16 | -{ |
|
15 | +class IncludeOwnSystemSniff 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 [T_DOUBLE_COLON]; |
27 | 25 | |
28 | 26 | }//end register() |
@@ -37,8 +35,7 @@ discard block |
||
37 | 35 | * |
38 | 36 | * @return void |
39 | 37 | */ |
40 | - public function process(File $phpcsFile, $stackPtr) |
|
41 | - { |
|
38 | + public function process(File $phpcsFile, $stackPtr) { |
|
42 | 39 | $fileName = $phpcsFile->getFilename(); |
43 | 40 | $matches = []; |
44 | 41 | if (preg_match('|/systems/(.*)/([^/]+)?actions.inc$|i', $fileName, $matches) === 0) { |