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 22echo $ blah ;
33echo $ blah ;
44echo ($ blah );
5+ echo $ blah ;
56
67print $ blah ;
78print $ blah ;
89print ($ blah );
10+ print $ blah ;
911
1012include $ blah ;
1113include $ blah ;
1214include ($ blah );
15+ include $ blah ;
1316
1417include_once $ blah ;
1518include_once $ blah ;
1619include_once ($ blah );
20+ include_once $ blah ;
1721
1822require $ blah ;
1923require $ blah ;
2024require ($ blah );
25+ require $ blah ;
2126
2227require_once $ blah ;
2328require_once $ blah ;
2429require_once ($ blah );
30+ require_once $ blah ;
2531
2632$ obj = new MyClass ();
2733$ obj = new MyClass ();
2834
35+ $ obj = new $ className ();
36+ $ obj = new $ className ();
37+
2938yield $ blah ;
3039yield $ blah ;
40+ yield $ blah ;
3141
3242yield from $ test ();
3343yield FROM $ test ();
@@ -39,12 +49,16 @@ yield
3949
4050
4151From $ test ();
52+ yield FROM $ test ();
4253
4354throw new Exception ();
4455throw new Exception ();
4556throw new Exception ();
4657throw new Exception ();
4758
59+ throw $ exception ;
60+ throw $ exception ;
61+
4862namespace MyClass ;
4963namespace MyClass ;
5064namespace MyNamespace \MyClass ;
@@ -66,6 +80,7 @@ return;
6680return $ blah ;
6781return $ blah ;
6882return ($ blah );
83+ return $ blah ;
6984
7085return $ tab ;
7186return
@@ -74,6 +89,3 @@ $newLine;
7489// The following line must have a single space at the end (after return)
7590return
7691$ 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 22echo $blah;
33echo $blah;
44echo($blah);
5+ echo $blah;
56
67print $blah;
78print $blah;
89print($blah);
10+ print $blah;
911
1012include $blah;
1113include $blah;
1214include($blah);
15+ include $blah;
1316
1417include_once $blah;
1518include_once $blah;
1619include_once($blah);
20+ include_once $blah;
1721
1822require $blah;
1923require $blah;
2024require($blah);
25+ require $blah;
2126
2227require_once $blah;
2328require_once $blah;
2429require_once($blah);
30+ require_once $blah;
2531
2632$obj = new MyClass();
2733$obj = new MyClass();
2834
35+ $obj = new $className();
36+ $obj = new $className();
37+
38+ yield $blah;
2939yield $blah;
3040yield $blah;
3141
@@ -35,12 +45,16 @@ YIELD from $test();
3545yield from $test();
3646yield from $test();
3747yield From $test();
48+ yield FROM $test();
3849
3950throw new Exception();
4051throw new Exception();
4152throw new Exception();
4253throw new Exception();
4354
55+ throw $exception;
56+ throw $exception;
57+
4458namespace MyClass;
4559namespace MyClass;
4660namespace MyNamespace\MyClass;
@@ -62,12 +76,10 @@ return;
6276return $blah;
6377return $blah;
6478return($blah);
79+ return $blah;
6580
6681return $tab;
6782return $newLine;
6883
6984// The following line must have a single space at the end (after return)
7085return $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
2626 * The key of the array should represent the line number and the value
2727 * should represent the number of errors that should occur on that line.
2828 *
29+ * @param string $testFile The name of the file being tested.
30+ *
2931 * @return array<int, int>
3032 */
31- public function getErrorList ()
33+ public function getErrorList ($ testFile = '' )
3234 {
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
6079
6180 }//end getErrorList()
6281
You can’t perform that action at this time.
0 commit comments