Skip to content

Commit 73dac47

Browse files
committed
change arg name in autoloader function and enable PHPCS warning (#35)
Use $class_name to avoid the reserved keyword "class" and add strict comparison for strings. With these warnings fixed we can enable warnings in PHPCS and keep our code clean.
1 parent f61ff99 commit 73dac47

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

blacklist-updater.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@
9494
/**
9595
* Plugin autoloader.
9696
*
97-
* @param string $class The classname.
97+
* @param string $class_name The classname.
9898
*/
99-
function blacklist_updater_autoload( $class ) {
100-
if ( in_array( $class, array( 'Blacklist_Updater' ) ) ) {
99+
function blacklist_updater_autoload( $class_name ) {
100+
if ( in_array( $class_name, array( 'Blacklist_Updater' ), true ) ) {
101101
require_once sprintf(
102102
'%s/inc/class-%s.php',
103103
dirname( __FILE__ ),
104-
strtolower( str_replace( '_', '-', $class ) )
104+
strtolower( str_replace( '_', '-', $class_name ) )
105105
);
106106
}
107107
}

phpcs.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<ruleset>
33
<description>Sniffs for the coding standards of the plugin</description>
44

5-
<arg value="psvn"/>
5+
<arg value="psv"/>
66
<arg name="colors"/>
77

88
<!-- Files to sniff -->

0 commit comments

Comments
 (0)