🔧 PHPCS: enable checking for globals being prefixed

Everything which is defined in the global namespace should be prefixed to prevent conflicts with other themes and plugins.

This snippet enables the sniff which verifies this and tells it which prefix to look for.
This commit is contained in:
jrfnl 2018-02-27 10:44:25 +01:00
parent 60071168e5
commit cac65d8a54
1 changed files with 9 additions and 0 deletions

View File

@ -86,6 +86,14 @@
</properties> </properties>
</rule> </rule>
<!-- Verify that everything in the global namespace is prefixed with a theme specific prefix.
Multiple valid prefixes can be provided as a comma-delimited list. -->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array" value="_s" />
</properties>
</rule>
<!-- <!--
############################################################################# #############################################################################
@ -93,6 +101,7 @@
############################################################################# #############################################################################
--> -->
<config name="testVersion" value="5.2-99.0"/> <config name="testVersion" value="5.2-99.0"/>
<rule ref="PHPCompatibility"/> <rule ref="PHPCompatibility"/>
</ruleset> </ruleset>