Skip to content

Commit 2cbd036

Browse files
committed
Revert changes to PSR12.Files.DeclareStatement
These have been moved to <PHPCSStandards#335>
1 parent 1af068d commit 2cbd036

File tree

5 files changed

+27
-43
lines changed

5 files changed

+27
-43
lines changed

src/Standards/PSR12/Sniffs/Files/DeclareStatementSniff.php

+1-7
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,6 @@ public function process(File $phpcsFile, $stackPtr)
110110

111111
// There should be no space between equal sign and directive value.
112112
$value = $phpcsFile->findNext(T_WHITESPACE, ($equals + 1), null, true);
113-
114-
if ($value === false) {
115-
// Live coding / parse error.
116-
return;
117-
}
118-
119113
if ($equals !== false) {
120114
if ($tokens[($equals + 1)]['type'] !== 'T_LNUMBER') {
121115
$error = 'Expected no space between equal sign and the directive value in a declare statement';
@@ -131,7 +125,7 @@ public function process(File $phpcsFile, $stackPtr)
131125
$value = $phpcsFile->findNext(T_LNUMBER, ($value + 1));
132126
}
133127
}
134-
}//end if
128+
}
135129

136130
$parenthesis = $phpcsFile->findNext(T_WHITESPACE, ($value + 1), null, true);
137131
if ($value !== false) {

src/Standards/PSR12/Tests/Files/DeclareStatementUnitTest.2.inc

-3
This file was deleted.

src/Standards/PSR12/Tests/Files/DeclareStatementUnitTest.php

+26-33
Original file line numberDiff line numberDiff line change
@@ -26,42 +26,35 @@ final class DeclareStatementUnitTest 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-
*
3129
* @return array<int, int>
3230
*/
33-
public function getErrorList($testFile='')
31+
public function getErrorList()
3432
{
35-
switch ($testFile) {
36-
case 'DeclareStatementUnitTest.1.inc':
37-
return [
38-
2 => 1,
39-
3 => 1,
40-
4 => 1,
41-
5 => 2,
42-
6 => 1,
43-
7 => 1,
44-
9 => 2,
45-
10 => 1,
46-
11 => 3,
47-
12 => 2,
48-
13 => 1,
49-
14 => 2,
50-
16 => 3,
51-
19 => 3,
52-
22 => 1,
53-
24 => 1,
54-
26 => 3,
55-
28 => 3,
56-
34 => 2,
57-
43 => 1,
58-
46 => 1,
59-
47 => 1,
60-
49 => 1,
61-
];
62-
default:
63-
return [];
64-
}//end switch
33+
return [
34+
2 => 1,
35+
3 => 1,
36+
4 => 1,
37+
5 => 2,
38+
6 => 1,
39+
7 => 1,
40+
9 => 2,
41+
10 => 1,
42+
11 => 3,
43+
12 => 2,
44+
13 => 1,
45+
14 => 2,
46+
16 => 3,
47+
19 => 3,
48+
22 => 1,
49+
24 => 1,
50+
26 => 3,
51+
28 => 3,
52+
34 => 2,
53+
43 => 1,
54+
46 => 1,
55+
47 => 1,
56+
49 => 1,
57+
];
6558

6659
}//end getErrorList()
6760

0 commit comments

Comments
 (0)