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 ); $orderby = Utils\get_flag_value( $assoc_args, 'orderby', null );
self::profile_eval_ish( 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 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( self::profile_eval_ish(
$assoc_args, function() use ( $file ) { $assoc_args,
function() use ( $file ) {
self::include_file( $file ); self::include_file( $file );
}, $order, $orderby },
$order,
$orderby
); );
} }
@ -387,7 +393,8 @@ class Command {
$loggers = array( $logger ); $loggers = array( $logger );
} }
$fields = array_merge( $fields = array_merge(
$fields, array( $fields,
array(
'time', 'time',
'query_time', 'query_time',
'query_count', 'query_count',

View file

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

View file

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