Skip to content

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Jun 16, 2025

Two new sniffs were introduced in PHPCS 3.11.0:

  • The Generic.Strings.UnnecessaryHeredoc sniff recommends using nowdoc syntax for heredocs which don't contain interpolation or expressions. This is similar to the Squiz.Strings.DoubleQuoteUsage sniff which is included in the WP-Core ruleset. Ref:
    <!-- Covers rule: Use single and double quotes when appropriate.
    If you're not evaluating anything in the string, use single quotes. -->
    <rule ref="Squiz.Strings.DoubleQuoteUsage.NotRequired"/>
  • The Generic.WhiteSpace.HereNowdocIdentifierSpacing sniff required that there is no space between the <<< and the heredoc/nowdoc identifier.

Both seem like useful additions to me,

I also think both sniffs should be regarded as candidates for moving them to the WPCS Core ruleset if/when a next update proposal is posted on Make.

Two new sniffs were introduced in PHPCS 3.11.0:

* The `Generic.Strings.UnnecessaryHeredoc` sniff recommends using nowdoc syntax for heredocs which don't contain interpolation or expressions.
    This is similar to the `Squiz.Strings.DoubleQuoteUsage` sniff which is included in the WP-Core ruleset.
    Ref: https://github.com/WordPress/WordPress-Coding-Standards/blob/48e59e97eb950dc011d25a6759feb949afd802a0/WordPress-Core/ruleset.xml#L58-L60
* The `Generic.WhiteSpace.HereNowdocIdentifierSpacing` sniff required that there is no space between the `<<<` and the heredoc/nowdoc identifier.

Both seem like useful additions to me,

I also think both sniffs should be regarded as candidates for moving them to the WPCS Core ruleset if/when a next update proposal is posted on Make.
@rodrigoprimo rodrigoprimo self-requested a review June 17, 2025 18:10
@GaryJones GaryJones merged commit 0a6f62f into develop Jun 18, 2025
50 checks passed
@GaryJones GaryJones deleted the feature/extra-add-two-new-sniffs branch June 18, 2025 11:57
@jrfnl jrfnl mentioned this pull request Jul 22, 2025
38 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants