Skip to content

Commit 6e5ecdf

Browse files
committed
Small CS fixes for WPCS v3
1 parent 327d99a commit 6e5ecdf

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

src/Cache/RecursiveDataStructureTraverser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ class RecursiveDataStructureTraverser {
2626
*
2727
* @param mixed $data The data to read/manipulate by reference.
2828
* @param string|int $key The key/property the data belongs to.
29-
* @param static $parent
29+
* @param static $parent_instance
3030
*/
31-
public function __construct( &$data, $key = null, $parent = null ) {
31+
public function __construct( &$data, $key = null, $parent_instance = null ) {
3232
$this->data =& $data;
3333
$this->key = $key;
34-
$this->parent = $parent;
34+
$this->parent = $parent_instance;
3535
}
3636

3737
/**

src/Cache_Command.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ public function pluck( $args, $assoc_args ) {
448448
}
449449

450450
$key_path = array_map(
451-
function( $key ) {
451+
function ( $key ) {
452452
if ( is_numeric( $key ) && ( (string) intval( $key ) === $key ) ) {
453453
return (int) $key;
454454
}
@@ -557,12 +557,10 @@ function ( $key ) {
557557

558558
if ( $patched_value === $old_value ) {
559559
WP_CLI::success( "Value passed for cache key '$key' is unchanged." );
560-
} else {
561-
if ( wp_cache_set( $key, $patched_value, $group, $expiration ) ) {
560+
} elseif ( wp_cache_set( $key, $patched_value, $group, $expiration ) ) {
562561
WP_CLI::success( "Updated cache key '$key'." );
563-
} else {
564-
WP_CLI::error( "Could not update cache key '$key'." );
565-
}
562+
} else {
563+
WP_CLI::error( "Could not update cache key '$key'." );
566564
}
567565
}
568566
}

src/Transient_Command.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ public function pluck( $args, $assoc_args ) {
443443
}
444444

445445
$key_path = array_map(
446-
function( $key ) {
446+
function ( $key ) {
447447
if ( is_numeric( $key ) && ( (string) intval( $key ) === $key ) ) {
448448
return (int) $key;
449449
}
@@ -550,12 +550,10 @@ function ( $key ) {
550550

551551
if ( $patched_value === $old_value ) {
552552
WP_CLI::success( "Value passed for transient '$key' is unchanged." );
553-
} else {
554-
if ( $write_func( $key, $patched_value, $expiration ) ) {
553+
} elseif ( $write_func( $key, $patched_value, $expiration ) ) {
555554
WP_CLI::success( "Updated transient '$key'." );
556-
} else {
557-
WP_CLI::error( "Could not update transient '$key'." );
558-
}
555+
} else {
556+
WP_CLI::error( "Could not update transient '$key'." );
559557
}
560558
}
561559

0 commit comments

Comments
 (0)