At first, we need to update phpcs.xml
.
Let’s replace "my_prefix"
with your plugin name (then, assuming "eustatos"
):
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array">
<element value="eustatos"/>
</property>
</properties>
</rule>
Then, you can use namespace start with eustatos
in project PHP file.
ex:
namespace eustatos\test_plugin;
cf.
Customizable sniff properties ยท WordPress/WordPress-Coding-Standards Wiki
To execute this check one or more prefixes which should be considered valid must be provided via the $prefixes property in your custom ruleset or via the command-line.
If this property is not set, this sniff will not run.
<rule ref="WordPress.NamingConventions.PrefixAllGlobals"> <properties> <property name="prefixes" type="array"> <element value="my_prefix"/> <element value="tgmpa"/> </property> </properties> </rule>