Skip to content

Commit

Permalink
linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzsequence committed Feb 7, 2024
1 parent 831918d commit 9cd4efb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
5 changes: 2 additions & 3 deletions cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function enable() {
if ( file_exists( $drop_in ) ) {
WP_CLI::error( 'Unknown wp-content/object-cache.php already exists.' );
}
$object_cache = dirname( __FILE__ ) . '/object-cache.php';
$object_cache = __DIR__ . '/object-cache.php';
$target = self::get_relative_path( $drop_in, $object_cache );
chdir( WP_CONTENT_DIR );
// @codingStandardsIgnoreStart
Expand Down Expand Up @@ -184,7 +184,7 @@ private function load_wordpress_with_template() {

add_filter(
'template_include',
function( $template ) {
function ( $template ) {
$display_template = str_replace( dirname( get_template_directory() ) . '/', '', $template );
WP_CLI::debug( "Theme template: {$display_template}", 'redis-debug' );
return $template;
Expand Down Expand Up @@ -240,7 +240,6 @@ private static function get_relative_path( $from, $to ) {
}
return implode( '/', $rel_path );
}

}

WP_CLI::add_command( 'redis', 'WP_Redis_CLI_Command' );
5 changes: 2 additions & 3 deletions object-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@ public function perform_client_connection( $redis, $client_parameters, $keys_met

// PhpRedis throws an Exception when it fails a server call.
// To prevent WordPress from fataling, we catch the Exception.
throw new Exception( $e->getMessage(), $e->getCode(), $e );
throw new Exception( $e->getMessage(), $e->getCode(), $e ); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
}
}
return true;
Expand Down Expand Up @@ -1424,7 +1424,6 @@ protected function _call_redis( $method ) {
case 'hmGet':
return false;
}

}

/**
Expand Down Expand Up @@ -1557,6 +1556,6 @@ public function __construct() {
* @return bool True value. Won't be used by PHP
*/
public function __destruct() {
return true;
return true; // phpcs:ignore Universal.CodeAnalysis.ConstructorDestructorReturn.ReturnValueFound
}
}
6 changes: 6 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
<exclude name="WordPress.DB.DirectDatabaseQuery.DirectQuery">
<file>/object-cache.php</file>
</exclude>
<exclude name="Universal.Files.SeparateFunctionsFromOO.Mixed">
<file>/object-cache.php</file>
</exclude>
<exclude name="Universal.Operators.DisallowStandalonePostIncrementDecrement.PostIncrementFound">
<file>/object-cache.php</file>
</exclude>

<!-- Rules we ignore for WP-CLI. -->
<!-- Function comments work differently for WP-CLI functions, so don't throw CS errors on them. -->
Expand Down
2 changes: 1 addition & 1 deletion wp-redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/

if ( defined( 'WP_CLI' ) && WP_CLI && ! class_exists( 'WP_Redis_CLI_Command' ) ) {
require_once dirname( __FILE__ ) . '/cli.php';
require_once __DIR__ . '/cli.php';
}

/**
Expand Down

0 comments on commit 9cd4efb

Please sign in to comment.