Squiz/SwitchDeclarationSniff: use placeholders in error messages - #1449
Open
ntdiary wants to merge 1 commit into
Open
Squiz/SwitchDeclarationSniff: use placeholders in error messages#1449ntdiary wants to merge 1 commit into
ntdiary wants to merge 1 commit into
Conversation
Replace string concatenation with placeholders to follow the best practice. - `CaseNotLower` and `DefaultNotLower` error messages now expose 3 data values (previously 2). - `CaseIndent` and `DefaultIndent` error messages now expose 2 data values (previously 0). - `SpaceBeforeColonCase` and `SpaceBeforeColonDefault` error messages now expose 1 data value (previously 0). - `BreakIndent` error message now exposes 1 data value (previously 0). - `SpacingAfterCase` and `SpacingAfterDefault` error messages now expose 1 data value (previously 0).
ntdiary
force-pushed
the
issue-1240-squiz-switch-declaration
branch
from
July 5, 2026 03:31
6465f72 to
2c96141
Compare
ntdiary
marked this pull request as ready for review
July 5, 2026 03:47
jrfnl
approved these changes
Aug 2, 2026
jrfnl
left a comment
Member
There was a problem hiding this comment.
@ntdiary Thank you for this PR. Verified & looking good.
Similar to what you proposed in #1447, I can see room for removing some code duplication (strtoupper($type) function calls), but that can also be done in a follow up PR.
For the record - I've checked and this sniff is not extended, so these changes do not affect any other sniffs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Replace string concatenation with placeholders to follow the best practice.
Suggested changelog entry
Changed:
CaseNotLowerandDefaultNotLowererror messages now expose 3 data values (previously 2).CaseIndentandDefaultIndenterror messages now expose 2 data values (previously 0).SpaceBeforeColonCaseandSpaceBeforeColonDefaulterror messages now expose 1 data value (previously 0).BreakIndenterror message now exposes 1 data value (previously 0).SpacingAfterCaseandSpacingAfterDefaulterror messages now expose 1 data value (previously 0).Related issues/external references
related to #1240
Types of changes
PR checklist
Changes are already covered by
Squiz/Tests/ControlStructures/SwitchDeclarationUnitTest.inc