From f2898c8ec7419e029bac8dca7fd591702013149c Mon Sep 17 00:00:00 2001 From: Huzaifa Al Mesbah Date: Sun, 3 Mar 2024 17:56:16 +0600 Subject: [PATCH 1/2] Improve Inline comments --- php/class-wp-cli.php | 14 +++++++------- php/compat.php | 2 +- php/utils.php | 12 ++++++------ php/wp-settings-cli.php | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/php/class-wp-cli.php b/php/class-wp-cli.php index ae9140c8b7..03082d0759 100644 --- a/php/class-wp-cli.php +++ b/php/class-wp-cli.php @@ -393,14 +393,14 @@ private static function wp_hook_build_unique_id( $tag, $function, $priority ) { } if ( is_object( $function ) ) { - // Closures are currently implemented as objects + // Closures are currently implemented as objects. $function = [ $function, '' ]; } else { $function = (array) $function; } if ( is_object( $function[0] ) ) { - // Object Class Calling + // Object Class Calling. if ( function_exists( 'spl_object_hash' ) ) { return spl_object_hash( $function[0] ) . $function[1]; } @@ -421,7 +421,7 @@ private static function wp_hook_build_unique_id( $tag, $function, $priority ) { } if ( is_string( $function[0] ) ) { - // Static Calling + // Static Calling. return $function[0] . '::' . $function[1]; } } @@ -1069,7 +1069,7 @@ public static function error_to_string( $errors ) { return $errors; } - // Only json_encode() the data when it needs it + // Only json_encode() the data when it needs it. $render_data = function ( $data ) { if ( is_array( $data ) || is_object( $data ) ) { return json_encode( $data ); @@ -1457,18 +1457,18 @@ public static function run_command( $args, $assoc_args = [] ) { - // DEPRECATED STUFF + // DEPRECATED STUFF. public static function add_man_dir() { trigger_error( 'WP_CLI::add_man_dir() is deprecated. Add docs inline.', E_USER_WARNING ); } - // back-compat + // back-compat. public static function out( $str ) { fwrite( STDOUT, $str ); } - // back-compat + // back-compat. // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid -- Deprecated method. public static function addCommand( $name, $class ) { trigger_error( diff --git a/php/compat.php b/php/compat.php index 306e5a9a7d..c908e316c4 100644 --- a/php/compat.php +++ b/php/compat.php @@ -115,4 +115,4 @@ function array_column($input = null, $columnKey = null, $indexKey = null) } } -// phpcs:enable +// phpcs:enable. diff --git a/php/utils.php b/php/utils.php index 678e535b83..2f1ca58523 100644 --- a/php/utils.php +++ b/php/utils.php @@ -220,7 +220,7 @@ function find_file_upward( $files, $dir = null, $stop_check = null ) { } function is_path_absolute( $path ) { - // Windows + // Windows. if ( isset( $path[1] ) && ':' === $path[1] ) { return true; } @@ -868,7 +868,7 @@ function get_default_cacert( $halt_on_error = false ) { $error_msg = 'Cannot find SSL certificate.'; if ( inside_phar( $cert_path ) ) { - // cURL can't read Phar archives + // cURL can't read Phar archives. return extract_from_phar( $cert_path ); } @@ -895,13 +895,13 @@ function get_default_cacert( $halt_on_error = false ) { * @return string */ function increment_version( $current_version, $new_version ) { - // split version assuming the format is x.y.z-pre + // split version assuming the format is x.y.z-pre. $current_version = explode( '-', $current_version, 2 ); $current_version[0] = explode( '.', $current_version[0] ); switch ( $new_version ) { case 'same': - // do nothing + // do nothing. break; case 'patch': @@ -925,7 +925,7 @@ function increment_version( $current_version, $new_version ) { $current_version = [ $current_version[0] ]; // Drop possible pre-release info. break; - default: // not a keyword + default: // not a keyword. $current_version = [ [ $new_version ] ]; break; } @@ -1007,7 +1007,7 @@ function get_flag_value( $assoc_args, $flag, $default = null ) { function get_home_dir() { $home = getenv( 'HOME' ); if ( ! $home ) { - // In Windows $HOME may not be defined + // In Windows $HOME may not be defined. $home = getenv( 'HOMEDRIVE' ) . getenv( 'HOMEPATH' ); } diff --git a/php/wp-settings-cli.php b/php/wp-settings-cli.php index 564f9160f7..8c3066140a 100644 --- a/php/wp-settings-cli.php +++ b/php/wp-settings-cli.php @@ -441,7 +441,7 @@ function get_magic_quotes_gpc() { */ do_action( 'init' ); -// Check site status +// Check site status. # if ( is_multisite() ) { // WP-CLI if ( is_multisite() && ! defined( 'WP_INSTALLING' ) ) { $file = ms_site_check(); From f510f657aa8eaf418254c4e19a99ed61db1c45c2 Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Sun, 3 Mar 2024 04:21:19 -0800 Subject: [PATCH 2/2] Remove period from PHPCS comment --- php/compat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/compat.php b/php/compat.php index c908e316c4..306e5a9a7d 100644 --- a/php/compat.php +++ b/php/compat.php @@ -115,4 +115,4 @@ function array_column($input = null, $columnKey = null, $indexKey = null) } } -// phpcs:enable. +// phpcs:enable