Skip to content

Commit 66bc204

Browse files
committed
Revert "Add better error codes"
This reverts commit e751fb4.
1 parent e751fb4 commit 66bc204

File tree

1 file changed

+1
-40
lines changed

1 file changed

+1
-40
lines changed

src/Standards/Squiz/Sniffs/WhiteSpace/ScopeKeywordSpacingSniff.php

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -138,52 +138,13 @@ public function process(File $phpcsFile, $stackPtr)
138138
}
139139

140140
if ($spacing !== 1) {
141-
// Set a context error code by checking if this is a class property,
142-
// method, closure or class declaration.
143-
$ignoreTokens = (Tokens::$emptyTokens + Tokens::$methodPrefixes + [
144-
T_READONLY => T_READONLY,
145-
// Ignore all the tokens in type hints.
146-
T_STRING => T_STRING,
147-
T_NULLABLE => T_NULLABLE,
148-
T_BITWISE_AND => T_BITWISE_AND,
149-
T_TYPE_INTERSECTION => T_TYPE_INTERSECTION,
150-
T_TYPE_UNION => T_TYPE_UNION,
151-
T_TYPE_OPEN_PARENTHESIS => T_TYPE_OPEN_PARENTHESIS,
152-
T_TYPE_CLOSE_PARENTHESIS => T_TYPE_CLOSE_PARENTHESIS,
153-
]);
154-
$targetContext = $phpcsFile->findNext($ignoreTokens, ($stackPtr + 1), null, true, null, true);
155-
$errorCode = 'Incorrect';
156-
if (isset($tokens[$targetContext]['code']) === true) {
157-
switch ($tokens[$targetContext]['code']) {
158-
case T_VARIABLE:
159-
$errorCode = 'Property';
160-
break;
161-
162-
case T_FUNCTION:
163-
$errorCode = 'Method';
164-
break;
165-
166-
case T_CLOSURE:
167-
$errorCode = 'Closure';
168-
break;
169-
170-
case T_CLASS:
171-
$errorCode = 'Class';
172-
break;
173-
174-
case T_ANON_CLASS:
175-
$errorCode = 'AnonymousClass';
176-
break;
177-
}//end switch
178-
}//end if
179-
180141
$error = 'Scope keyword "%s" must be followed by a single space; found %s';
181142
$data = [
182143
$tokens[$stackPtr]['content'],
183144
$spacing,
184145
];
185146

186-
$fix = $phpcsFile->addFixableError($error, $stackPtr, $errorCode, $data);
147+
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'Incorrect', $data);
187148
if ($fix === true) {
188149
if ($spacing === 0) {
189150
$phpcsFile->fixer->addContent($stackPtr, ' ');

0 commit comments

Comments
 (0)