From a1c2aaac0a8b7dd23280c034541dd605331b90af Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 16 Jun 2025 23:38:47 +0200 Subject: [PATCH] Squiz/FunctionDeclarationArgumentSpacing: fix typo in `SpacingAfterSetVis[i]bility` error code The `SpacingAfterVis[i]bility` error code was introduced in v 3.12.0 (March this year) for constructor property promotion. The `SpacingAfterSetVis[i]bility` error code was introduced in v 3.13.1 (few days ago) for constructor property promotion with asym visibility. Both contained the same typo. Now, changing an error code is a breaking change. However, with 3.13.1 only having been released a few days ago, it is my opinion that if released soon as 3.13.2, this is an acceptable bug fix. But then, it would be really weird to not fix the other error code in the same version. Then again, as PHPCS 4.0.0 is around the corner and does allow for breaking changes, let's leave the older typo for 4.0.0, just to be on the safe side. --- CHANGELOG.md | 2 +- .../Functions/FunctionDeclarationArgumentSpacingSniff.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7aadb84344..590ee8bdef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,7 +31,7 @@ _Nothing yet._ - Errors will be reported via a new `AvizKeywordOrder` error code. - Thanks to [Juliette Reinders Folmer][@jrfnl] for the patch. - The Squiz.Functions.FunctionDeclarationArgumentSpacing will now check spacing after a set-visibility modifier keyword. [#1121] - - Errors will be reported via a new `SpacingAfterSetVisbility` error code. + - Errors will be reported via a new `SpacingAfterSetVisibility` error code. - Thanks to [Juliette Reinders Folmer][@jrfnl] for the patch. - The Squiz.Scope.MemberVarScope will now flag missing "read" visibility, when "write" visibility is set, under a separate error code `AsymReadMissing`. [#1122] - Thanks to [Juliette Reinders Folmer][@jrfnl] for the patch. diff --git a/src/Standards/Squiz/Sniffs/Functions/FunctionDeclarationArgumentSpacingSniff.php b/src/Standards/Squiz/Sniffs/Functions/FunctionDeclarationArgumentSpacingSniff.php index 1fd34fccb5..f33d19bc14 100644 --- a/src/Standards/Squiz/Sniffs/Functions/FunctionDeclarationArgumentSpacingSniff.php +++ b/src/Standards/Squiz/Sniffs/Functions/FunctionDeclarationArgumentSpacingSniff.php @@ -360,7 +360,7 @@ public function processBracket($phpcsFile, $openBracket) $spacesAfter, ]; - $fix = $phpcsFile->addFixableError($error, $visibilityToken, 'SpacingAfterSetVisbility', $data); + $fix = $phpcsFile->addFixableError($error, $visibilityToken, 'SpacingAfterSetVisibility', $data); if ($fix === true) { $phpcsFile->fixer->beginChangeset(); $phpcsFile->fixer->addContent($visibilityToken, ' ');