Skip to content

Commit 8ce95cd

Browse files
committed
Generic/LanguageConstructSpacing: handle spacing after goto keyword
Includes tests.
1 parent b5c80d3 commit 8ce95cd

File tree

4 files changed

+47
-39
lines changed

4 files changed

+47
-39
lines changed

src/Standards/Generic/Sniffs/WhiteSpace/LanguageConstructSpacingSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public function register()
3939
T_THROW,
4040
T_NAMESPACE,
4141
T_USE,
42+
T_GOTO,
4243
];
4344

4445
}//end register()

src/Standards/Generic/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.1.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,6 @@ yield
102102
// Closure use should be ignored. These are subject to their own rules.
103103
$cl = function() use ($b) {};
104104
$cl = function() use($b) {};
105+
106+
goto MyName;
107+
goto MyName;

src/Standards/Generic/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.1.inc.fixed

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,6 @@ yield
9696
// Closure use should be ignored. These are subject to their own rules.
9797
$cl = function() use ($b) {};
9898
$cl = function() use($b) {};
99+
100+
goto MyName;
101+
goto MyName;

src/Standards/Generic/Tests/WhiteSpace/LanguageConstructSpacingUnitTest.php

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -35,45 +35,46 @@ public function getErrorList($testFile='')
3535
switch ($testFile) {
3636
case 'LanguageConstructSpacingUnitTest.1.inc':
3737
return [
38-
3 => 1,
39-
5 => 1,
40-
8 => 1,
41-
10 => 1,
42-
13 => 1,
43-
15 => 1,
44-
18 => 1,
45-
20 => 1,
46-
23 => 1,
47-
25 => 1,
48-
28 => 1,
49-
30 => 1,
50-
33 => 1,
51-
36 => 1,
52-
39 => 1,
53-
40 => 1,
54-
43 => 1,
55-
44 => 1,
56-
45 => 1,
57-
46 => 1,
58-
48 => 1,
59-
52 => 1,
60-
55 => 1,
61-
56 => 1,
62-
57 => 2,
63-
60 => 1,
64-
63 => 1,
65-
65 => 1,
66-
73 => 1,
67-
75 => 1,
68-
77 => 1,
69-
81 => 1,
70-
83 => 1,
71-
85 => 1,
72-
86 => 1,
73-
90 => 1,
74-
94 => 1,
75-
95 => 1,
76-
98 => 1,
38+
3 => 1,
39+
5 => 1,
40+
8 => 1,
41+
10 => 1,
42+
13 => 1,
43+
15 => 1,
44+
18 => 1,
45+
20 => 1,
46+
23 => 1,
47+
25 => 1,
48+
28 => 1,
49+
30 => 1,
50+
33 => 1,
51+
36 => 1,
52+
39 => 1,
53+
40 => 1,
54+
43 => 1,
55+
44 => 1,
56+
45 => 1,
57+
46 => 1,
58+
48 => 1,
59+
52 => 1,
60+
55 => 1,
61+
56 => 1,
62+
57 => 2,
63+
60 => 1,
64+
63 => 1,
65+
65 => 1,
66+
73 => 1,
67+
75 => 1,
68+
77 => 1,
69+
81 => 1,
70+
83 => 1,
71+
85 => 1,
72+
86 => 1,
73+
90 => 1,
74+
94 => 1,
75+
95 => 1,
76+
98 => 1,
77+
107 => 1,
7778
];
7879

7980
default:

0 commit comments

Comments
 (0)