Skip to content

Commit 6528422

Browse files
committed
Some PHPCS Updates
1 parent d9c0b28 commit 6528422

File tree

2 files changed

+16
-24
lines changed

2 files changed

+16
-24
lines changed

.phpcs.xml

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Example Project" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd">
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Viget Form Blocks" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd">
33

44
<description>A custom set of rules to check for a WPized WordPress project</description>
55

@@ -42,24 +42,15 @@
4242
#############################################################################
4343
-->
4444

45+
<rule ref="WordPress">
46+
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
47+
<exclude name="Universal.Arrays.DisallowShortArraySyntax"/>
48+
</rule>
49+
4550
<!-- Include the WordPress-Extra standard. -->
4651
<rule ref="WordPress-Extra">
47-
<!--
48-
We may want a middle ground though. The best way to do this is add the
49-
entire ruleset, then rule by rule, remove ones that don't suit a project.
50-
We can do this by running `phpcs` with the '-s' flag, which allows us to
51-
see the names of the sniffs reporting errors.
52-
Once we know the sniff names, we can opt to exclude sniffs which don't
53-
suit our project like so.
54-
55-
The below two examples just show how you can exclude rules/error codes.
56-
They are not intended as advice about which sniffs to exclude.
57-
-->
58-
59-
<!--
60-
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing"/>
61-
<exclude name="Modernize.FunctionCalls.Dirname.Nested"/>
62-
-->
52+
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
53+
<exclude name="Universal.Arrays.DisallowShortArraySyntax"/>
6354
</rule>
6455

6556
<!-- Let's also check that everything is properly documented. -->
@@ -105,16 +96,17 @@
10596
<rule ref="WordPress.WP.I18n">
10697
<properties>
10798
<property name="text_domain" type="array">
108-
<element value="wp-starter"/>
109-
<element value="library-wp-starter"/>
99+
<element value="viget-form-blocks"/>
110100
</property>
111101
</properties>
112102
</rule>
113103

114104
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
115105
<properties>
116106
<property name="prefixes" type="array">
117-
<element value="wpstarter_"/>
107+
<element value="VGTFB_"/>
108+
<element value="vgtfb_"/>
109+
<element value="VigetFormBlocks"/>
118110
</property>
119111
</properties>
120112
</rule>

viget-form-blocks.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232
}
3333

3434
// Load include files.
35-
$plugin_files = glob( VGTFB_PLUGIN_PATH . 'includes/*.php' );
35+
$vgtfb_plugin_files = glob( VGTFB_PLUGIN_PATH . 'includes/*.php' );
3636

37-
foreach ( $plugin_files as $path ) {
38-
if ( file_exists( $path ) ) {
39-
require_once $path;
37+
foreach ( $vgtfb_plugin_files as $vgtfb_path ) {
38+
if ( file_exists( $vgtfb_path ) ) {
39+
require_once $vgtfb_path;
4040
}
4141
}

0 commit comments

Comments
 (0)