File tree Expand file tree Collapse file tree 4 files changed +81
-34
lines changed
src/Standards/Generic/Tests/WhiteSpace Expand file tree Collapse file tree 4 files changed +81
-34
lines changed Original file line number Diff line number Diff line change 2
2
echo $ blah ;
3
3
echo $ blah ;
4
4
echo ($ blah );
5
+ echo $ blah ;
5
6
6
7
print $ blah ;
7
8
print $ blah ;
8
9
print ($ blah );
10
+ print $ blah ;
9
11
10
12
include $ blah ;
11
13
include $ blah ;
12
14
include ($ blah );
15
+ include $ blah ;
13
16
14
17
include_once $ blah ;
15
18
include_once $ blah ;
16
19
include_once ($ blah );
20
+ include_once $ blah ;
17
21
18
22
require $ blah ;
19
23
require $ blah ;
20
24
require ($ blah );
25
+ require $ blah ;
21
26
22
27
require_once $ blah ;
23
28
require_once $ blah ;
24
29
require_once ($ blah );
30
+ require_once $ blah ;
25
31
26
32
$ obj = new MyClass ();
27
33
$ obj = new MyClass ();
28
34
35
+ $ obj = new $ className ();
36
+ $ obj = new $ className ();
37
+
29
38
yield $ blah ;
30
39
yield $ blah ;
40
+ yield $ blah ;
31
41
32
42
yield from $ test ();
33
43
yield FROM $ test ();
@@ -39,12 +49,16 @@ yield
39
49
40
50
41
51
From $ test ();
52
+ yield FROM $ test ();
42
53
43
54
throw new Exception ();
44
55
throw new Exception ();
45
56
throw new Exception ();
46
57
throw new Exception ();
47
58
59
+ throw $ exception ;
60
+ throw $ exception ;
61
+
48
62
namespace MyClass ;
49
63
namespace MyClass ;
50
64
namespace MyNamespace \MyClass ;
@@ -66,6 +80,7 @@ return;
66
80
return $ blah ;
67
81
return $ blah ;
68
82
return ($ blah );
83
+ return $ blah ;
69
84
70
85
return $ tab ;
71
86
return
@@ -74,6 +89,3 @@ $newLine;
74
89
// The following line must have a single space at the end (after return)
75
90
return
76
91
$ spaceAndNewLine ;
77
-
78
- // The following line must be the last line in the file
79
- return
Original file line number Diff line number Diff line change 2
2
echo $blah;
3
3
echo $blah;
4
4
echo($blah);
5
+ echo $blah;
5
6
6
7
print $blah;
7
8
print $blah;
8
9
print($blah);
10
+ print $blah;
9
11
10
12
include $blah;
11
13
include $blah;
12
14
include($blah);
15
+ include $blah;
13
16
14
17
include_once $blah;
15
18
include_once $blah;
16
19
include_once($blah);
20
+ include_once $blah;
17
21
18
22
require $blah;
19
23
require $blah;
20
24
require($blah);
25
+ require $blah;
21
26
22
27
require_once $blah;
23
28
require_once $blah;
24
29
require_once($blah);
30
+ require_once $blah;
25
31
26
32
$obj = new MyClass();
27
33
$obj = new MyClass();
28
34
35
+ $obj = new $className();
36
+ $obj = new $className();
37
+
38
+ yield $blah;
29
39
yield $blah;
30
40
yield $blah;
31
41
@@ -35,12 +45,16 @@ YIELD from $test();
35
45
yield from $test();
36
46
yield from $test();
37
47
yield From $test();
48
+ yield FROM $test();
38
49
39
50
throw new Exception();
40
51
throw new Exception();
41
52
throw new Exception();
42
53
throw new Exception();
43
54
55
+ throw $exception;
56
+ throw $exception;
57
+
44
58
namespace MyClass;
45
59
namespace MyClass;
46
60
namespace MyNamespace\MyClass;
@@ -62,12 +76,10 @@ return;
62
76
return $blah;
63
77
return $blah;
64
78
return($blah);
79
+ return $blah;
65
80
66
81
return $tab;
67
82
return $newLine;
68
83
69
84
// The following line must have a single space at the end (after return)
70
85
return $spaceAndNewLine;
71
-
72
- // The following line must be the last line in the file
73
- return
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ // Intentional parse error. Testing that the sniff is *not* triggered in this case.
4
+ return
Original file line number Diff line number Diff line change @@ -26,37 +26,56 @@ class LanguageConstructSpacingUnitTest extends AbstractSniffUnitTest
26
26
* The key of the array should represent the line number and the value
27
27
* should represent the number of errors that should occur on that line.
28
28
*
29
+ * @param string $testFile The name of the file being tested.
30
+ *
29
31
* @return array<int, int>
30
32
*/
31
- public function getErrorList ()
33
+ public function getErrorList ($ testFile = '' )
32
34
{
33
- return [
34
- 3 => 1 ,
35
- 7 => 1 ,
36
- 11 => 1 ,
37
- 15 => 1 ,
38
- 19 => 1 ,
39
- 23 => 1 ,
40
- 27 => 1 ,
41
- 30 => 1 ,
42
- 33 => 1 ,
43
- 34 => 1 ,
44
- 35 => 1 ,
45
- 36 => 1 ,
46
- 38 => 1 ,
47
- 44 => 1 ,
48
- 45 => 1 ,
49
- 46 => 2 ,
50
- 49 => 1 ,
51
- 51 => 1 ,
52
- 59 => 1 ,
53
- 61 => 1 ,
54
- 63 => 1 ,
55
- 67 => 1 ,
56
- 70 => 1 ,
57
- 71 => 1 ,
58
- 75 => 1 ,
59
- ];
35
+ switch ($ testFile ) {
36
+ case 'LanguageConstructSpacingUnitTest.1.inc ' :
37
+ 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
+ ];
75
+
76
+ default :
77
+ return [];
78
+ }//end switch
60
79
61
80
}//end getErrorList()
62
81
You can’t perform that action at this time.
0 commit comments