Skip to content

Commit 4e97c93

Browse files
committed
Improve error message text
1 parent 1f3ed76 commit 4e97c93

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Standards/Squiz/Sniffs/Functions/FunctionDeclarationArgumentSpacingSniff.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,15 @@ public function processBracket($phpcsFile, $openBracket)
245245
$error = 'Expected 1 space between type hint and argument "%s"; %s found';
246246
$data = [
247247
$param['name'],
248-
$gap,
249248
];
250-
$fix = $phpcsFile->addFixableError($error, $typeHintToken, 'SpacingAfterHint', $data);
249+
$found = str_replace(["\r", "\n", "\t"], ['\r', '\n', '\t'], $gap);
250+
if ($found === $gap) {
251+
$data[] = strlen($gap);
252+
} else {
253+
$data[] = '"'.$found.'"';
254+
}
255+
256+
$fix = $phpcsFile->addFixableError($error, $typeHintToken, 'SpacingAfterHint', $data);
251257
if ($fix === true) {
252258
$phpcsFile->fixer->beginChangeset();
253259
$i = $typeHintToken;

0 commit comments

Comments
 (0)