Fix CS issues

This commit is contained in:
Alain Schlesser 2018-09-25 18:49:32 +02:00
parent 88aeac84bb
commit d51a18884a
3 changed files with 19 additions and 10 deletions

View file

@ -290,9 +290,12 @@ class Command {
$orderby = Utils\get_flag_value( $assoc_args, 'orderby', null );
self::profile_eval_ish(
$assoc_args, function() use ( $statement ) {
$assoc_args,
function() use ( $statement ) {
eval( $statement ); // phpcs:ignore Squiz.PHP.Eval.Discouraged -- no other way oround here
}, $order, $orderby
},
$order,
$orderby
);
}
@ -351,9 +354,12 @@ class Command {
}
self::profile_eval_ish(
$assoc_args, function() use ( $file ) {
$assoc_args,
function() use ( $file ) {
self::include_file( $file );
}, $order, $orderby
},
$order,
$orderby
);
}
@ -387,7 +393,8 @@ class Command {
$loggers = array( $logger );
}
$fields = array_merge(
$fields, array(
$fields,
array(
'time',
'query_time',
'query_count',

View file

@ -91,7 +91,8 @@ class Formatter {
if ( $orderby ) {
usort(
$items, function( $a, $b ) use ( $order, $orderby ) {
$items,
function( $a, $b ) use ( $order, $orderby ) {
list( $first, $second ) = 'ASC' === $order ? array( $a, $b ) : array( $b, $a );
if ( is_numeric( $first->$orderby ) && is_numeric( $second->$orderby ) ) {

View file

@ -76,7 +76,8 @@ class Profiler {
*/
public function run() {
WP_CLI::add_wp_hook(
'muplugins_loaded', function() {
'muplugins_loaded',
function() {
if ( $url = WP_CLI::get_runner()->config['url'] ) {
WP_CLI::set_url( trailingslashit( $url ) );
} else {
@ -85,7 +86,8 @@ class Profiler {
}
);
WP_CLI::add_hook(
'after_wp_config_load', function() {
'after_wp_config_load',
function() {
if ( defined( 'SAVEQUERIES' ) && ! SAVEQUERIES ) {
WP_CLI::error( "'SAVEQUERIES' is defined as false, and must be true. Please check your wp-config.php" );
}
@ -264,7 +266,6 @@ class Profiler {
$pseudo_hook = "{$this->current_stage_hooks[$key+1]}:before";
} else {
$pseudo_hook = "{$this->current_stage_hooks[$key]}:after";
;
$this->running_hook = $pseudo_hook;
}
$this->loggers[ $pseudo_hook ] = new Logger( array( 'hook' => $pseudo_hook ) );