Skip to content

Commit 7680178

Browse files
Update to WPCS v3 (#60)
* Update to wp-cli-tests v4 (which requires WPCS v3) * Fix all autofixable CS issues * Keep loose comparison --------- Co-authored-by: Pascal Birchler <[email protected]>
1 parent ba50c71 commit 7680178

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"wp-cli/wp-cli": "^2.5"
1616
},
1717
"require-dev": {
18-
"wp-cli/wp-cli-tests": "^3.1"
18+
"wp-cli/wp-cli-tests": "^4"
1919
},
2020
"config": {
2121
"process-timeout": 7200,

role-command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
return;
55
}
66

7-
$wpcli_role_autoloader = dirname( __FILE__ ) . '/vendor/autoload.php';
7+
$wpcli_role_autoloader = __DIR__ . '/vendor/autoload.php';
88
if ( file_exists( $wpcli_role_autoloader ) ) {
99
require_once $wpcli_role_autoloader;
1010
}

src/Capabilities_Command.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function add( $args, $assoc_args ) {
156156

157157
$role_obj->add_cap( $cap, $grant );
158158

159-
$count++;
159+
++$count;
160160
}
161161

162162
$capability = WP_CLI\Utils\pluralize( 'capability', $count );
@@ -198,7 +198,7 @@ public function remove( $args ) {
198198

199199
$role_obj->remove_cap( $cap );
200200

201-
$count++;
201+
++$count;
202202
}
203203

204204
$capability = WP_CLI\Utils\pluralize( 'capability', $count );

src/Role_Command.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ public function delete( $args ) {
239239
} else {
240240
WP_CLI::error( "Role with key '{$role_key}' could not be deleted." );
241241
}
242-
243242
}
244243

245244
/**
@@ -370,7 +369,7 @@ public function reset( $args, $assoc_args ) {
370369
foreach ( $args as $role_key ) {
371370
$after[ $role_key ] = get_role( $role_key );
372371

373-
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Object instances won't be same, strict check will fail here.
372+
// phpcs:ignore Universal.Operators.StrictComparisons -- Object instances won't be same, strict check will fail here.
374373
if ( $after[ $role_key ] != $before[ $role_key ] ) {
375374
++$num_reset;
376375
$before_capabilities = isset( $before[ $role_key ] ) ? $before[ $role_key ]->capabilities : [];
@@ -392,12 +391,10 @@ public function reset( $args, $assoc_args ) {
392391
} else {
393392
WP_CLI::success( "{$num_reset} of {$num_to_reset} roles reset." );
394393
}
395-
} else {
396-
if ( 1 === count( $args ) ) {
394+
} elseif ( 1 === count( $args ) ) {
397395
WP_CLI::success( 'Role didn\'t need resetting.' );
398-
} else {
399-
WP_CLI::success( 'No roles needed resetting.' );
400-
}
396+
} else {
397+
WP_CLI::success( 'No roles needed resetting.' );
401398
}
402399
}
403400

0 commit comments

Comments
 (0)