Skip to content

Commit b7955ce

Browse files
committed
Extra: add two new sniffs related to heredoc/nowdocs
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.
1 parent 48e59e9 commit b7955ce

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

WordPress-Extra/ruleset.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
<property name="allowMultiline" value="true"/>
3030
</properties>
3131
</rule>
32+
<rule ref="Generic.Strings.UnnecessaryHeredoc"/>
33+
<rule ref="Generic.WhiteSpace.HereNowdocIdentifierSpacing"/>
3234

3335
<!-- More generic PHP best practices.
3436
https://github.com/WordPress/WordPress-Coding-Standards/issues/607 -->

0 commit comments

Comments
 (0)