Skip to content

Commit ee5b7ff

Browse files
committed
Fix newly reported PHPStan errors
1 parent 7ece0f6 commit ee5b7ff

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Cron_Event_Command.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,20 +185,20 @@ public function schedule( $args, $assoc_args ) {
185185
WP_CLI::error( sprintf( "'%s' is not a valid datetime.", $next_run ) );
186186
}
187187

188-
if ( ! empty( $recurrence ) ) {
188+
$cron_args = $assoc_args;
189+
ksort( $cron_args );
190+
$cron_args = array_values( $cron_args );
189191

192+
if ( ! empty( $recurrence ) ) {
190193
$schedules = wp_get_schedules();
191194

192195
if ( ! isset( $schedules[ $recurrence ] ) ) {
193196
WP_CLI::error( sprintf( "'%s' is not a valid schedule name for recurrence.", $recurrence ) );
194197
}
195198

196-
$event = wp_schedule_event( $timestamp, $recurrence, $hook, $assoc_args );
197-
199+
$event = wp_schedule_event( $timestamp, $recurrence, $hook, $cron_args );
198200
} else {
199-
200-
$event = wp_schedule_single_event( $timestamp, $hook, $assoc_args );
201-
201+
$event = wp_schedule_single_event( $timestamp, $hook, $cron_args );
202202
}
203203

204204
if ( false !== $event ) {

0 commit comments

Comments
 (0)