Skip to content

Commit 017ff10

Browse files
committed
Merge branch 'trunk' into phpcs/cleanup
2 parents 72932fe + a2e0549 commit 017ff10

23 files changed

+94
-98
lines changed

.github/workflows/pr-unit-tests.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
# We test against the earliest and latest PHP versions for each major supported version.
13-
php: [ '7.0', '7.4', '8.0', '8.3' ]
13+
php: [ '7.1', '7.4', '8.0', '8.3' ]
1414
wp: [ '6.4', '6.5', '6.6', 'latest', 'nightly' ]
1515
multisite: [ '0', '1' ]
1616
exclude:
1717
# WordPress 6.6+ requires PHP 7.2+
18-
- php: 7.0
18+
- php: 7.1
1919
wp: 6.6
20-
- php: 7.0
20+
- php: 7.1
2121
wp: latest
22-
- php: 7.0
22+
- php: 7.1
2323
wp: nightly
2424
services:
2525
database:
@@ -62,12 +62,8 @@ jobs:
6262

6363
- name: Setup PHPUnit
6464
run: |
65-
# PHPUnit 5.7 when using PHP 5.6 - 7.0.
66-
if [ "$(php -r "echo version_compare( PHP_VERSION, '7.1', '<' );")" ]; then
67-
curl -L https://phar.phpunit.de/phpunit-5.7.phar -o /tmp/phpunit
68-
OVERWRITE=1
6965
# PHPUnit 7.5 when using PHP 7.1 - 7.4.
70-
elif [ "$(php -r "echo version_compare( PHP_VERSION, '8.0', '<' );")" ]; then
66+
if [ "$(php -r "echo version_compare( PHP_VERSION, '8.0', '<' );")" ]; then
7167
curl -L https://phar.phpunit.de/phpunit-7.5.phar -o /tmp/phpunit
7268
OVERWRITE=1
7369
# PHPUnit 7.5 (Custom Fork) when using PHP 8.0+.

action-scheduler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* License: GPLv3
1010
* Requires at least: 6.4
1111
* Tested up to: 6.7
12-
* Requires PHP: 7.0
12+
* Requires PHP: 7.1
1313
*
1414
* Copyright 2019 Automattic, Inc. (https://automattic.com/contact/)
1515
*

classes/ActionScheduler_QueueCleaner.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ class ActionScheduler_QueueCleaner {
3939
/**
4040
* ActionScheduler_QueueCleaner constructor.
4141
*
42-
* @param ActionScheduler_Store $store The store instance.
43-
* @param int $batch_size The batch size.
42+
* @param ActionScheduler_Store|null $store The store instance.
43+
* @param int $batch_size The batch size.
4444
*/
45-
public function __construct( ActionScheduler_Store $store = null, $batch_size = 20 ) {
45+
public function __construct( ?ActionScheduler_Store $store = null, $batch_size = 20 ) {
4646
$this->store = $store ? $store : ActionScheduler_Store::instance();
4747
$this->batch_size = $batch_size;
4848
}

classes/ActionScheduler_QueueRunner.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ public static function instance() {
4747
/**
4848
* ActionScheduler_QueueRunner constructor.
4949
*
50-
* @param ActionScheduler_Store $store Store object.
51-
* @param ActionScheduler_FatalErrorMonitor $monitor Monitor object.
52-
* @param ActionScheduler_QueueCleaner $cleaner Cleaner object.
53-
* @param ActionScheduler_AsyncRequest_QueueRunner $async_request Async request runner object.
50+
* @param ActionScheduler_Store|null $store Store object.
51+
* @param ActionScheduler_FatalErrorMonitor|null $monitor Monitor object.
52+
* @param ActionScheduler_QueueCleaner|null $cleaner Cleaner object.
53+
* @param ActionScheduler_AsyncRequest_QueueRunner|null $async_request Async request runner object.
5454
*/
55-
public function __construct( ActionScheduler_Store $store = null, ActionScheduler_FatalErrorMonitor $monitor = null, ActionScheduler_QueueCleaner $cleaner = null, ActionScheduler_AsyncRequest_QueueRunner $async_request = null ) {
55+
public function __construct( ?ActionScheduler_Store $store = null, ?ActionScheduler_FatalErrorMonitor $monitor = null, ?ActionScheduler_QueueCleaner $cleaner = null, ?ActionScheduler_AsyncRequest_QueueRunner $async_request = null ) {
5656
parent::__construct( $store, $monitor, $cleaner );
5757

5858
if ( is_null( $async_request ) ) {

classes/WP_CLI/ActionScheduler_WPCLI_QueueRunner.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ class ActionScheduler_WPCLI_QueueRunner extends ActionScheduler_Abstract_QueueRu
3333
/**
3434
* ActionScheduler_WPCLI_QueueRunner constructor.
3535
*
36-
* @param ActionScheduler_Store $store Store object.
37-
* @param ActionScheduler_FatalErrorMonitor $monitor Monitor object.
38-
* @param ActionScheduler_QueueCleaner $cleaner Cleaner object.
36+
* @param ActionScheduler_Store|null $store Store object.
37+
* @param ActionScheduler_FatalErrorMonitor|null $monitor Monitor object.
38+
* @param ActionScheduler_QueueCleaner|null $cleaner Cleaner object.
3939
*
4040
* @throws Exception When this is not run within WP CLI.
4141
*/
42-
public function __construct( ActionScheduler_Store $store = null, ActionScheduler_FatalErrorMonitor $monitor = null, ActionScheduler_QueueCleaner $cleaner = null ) {
42+
public function __construct( ?ActionScheduler_Store $store = null, ?ActionScheduler_FatalErrorMonitor $monitor = null, ?ActionScheduler_QueueCleaner $cleaner = null ) {
4343
if ( ! ( defined( 'WP_CLI' ) && WP_CLI ) ) {
4444
/* translators: %s php class name */
4545
throw new Exception( sprintf( __( 'The %s class can only be run within WP CLI.', 'action-scheduler' ), __CLASS__ ) );

classes/abstracts/ActionScheduler_Abstract_QueueRunner.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ abstract class ActionScheduler_Abstract_QueueRunner extends ActionScheduler_Abst
3939
/**
4040
* ActionScheduler_Abstract_QueueRunner constructor.
4141
*
42-
* @param ActionScheduler_Store $store Store object.
43-
* @param ActionScheduler_FatalErrorMonitor $monitor Monitor object.
44-
* @param ActionScheduler_QueueCleaner $cleaner Cleaner object.
42+
* @param ActionScheduler_Store|null $store Store object.
43+
* @param ActionScheduler_FatalErrorMonitor|null $monitor Monitor object.
44+
* @param ActionScheduler_QueueCleaner|null $cleaner Cleaner object.
4545
*/
46-
public function __construct( ActionScheduler_Store $store = null, ActionScheduler_FatalErrorMonitor $monitor = null, ActionScheduler_QueueCleaner $cleaner = null ) {
46+
public function __construct( ?ActionScheduler_Store $store = null, ?ActionScheduler_FatalErrorMonitor $monitor = null, ?ActionScheduler_QueueCleaner $cleaner = null ) {
4747

4848
$this->created_time = microtime( true );
4949

classes/abstracts/ActionScheduler_Abstract_RecurringSchedule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ abstract class ActionScheduler_Abstract_RecurringSchedule extends ActionSchedule
4141
* @param mixed $recurrence The data used to determine the schedule's recurrence.
4242
* @param DateTime|null $first (Optional) The date & time the first instance of this interval schedule ran. Default null, meaning this is the first instance.
4343
*/
44-
public function __construct( DateTime $date, $recurrence, DateTime $first = null ) {
44+
public function __construct( DateTime $date, $recurrence, ?DateTime $first = null ) {
4545
parent::__construct( $date );
4646
$this->first_date = empty( $first ) ? $date : $first;
4747
$this->recurrence = $recurrence;

classes/abstracts/ActionScheduler_Logger.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ public static function instance() {
3030
/**
3131
* Create log entry.
3232
*
33-
* @param string $action_id Action ID.
34-
* @param string $message Log message.
35-
* @param DateTime $date Log date.
33+
* @param string $action_id Action ID.
34+
* @param string $message Log message.
35+
* @param DateTime|null $date Log date.
3636
*
3737
* @return string The log entry ID
3838
*/
39-
abstract public function log( $action_id, $message, DateTime $date = null );
39+
abstract public function log( $action_id, $message, ?DateTime $date = null );
4040

4141
/**
4242
* Get action's log entry.
@@ -215,7 +215,7 @@ public function log_ignored_action( $action_id, $context = '' ) {
215215
* @param string $action_id Action ID.
216216
* @param null|Exception $exception The exception which occurred when fetching the action. NULL by default for backward compatibility.
217217
*/
218-
public function log_failed_fetch_action( $action_id, Exception $exception = null ) {
218+
public function log_failed_fetch_action( $action_id, ?Exception $exception = null ) {
219219

220220
if ( ! is_null( $exception ) ) {
221221
/* translators: %s: exception message */

classes/abstracts/ActionScheduler_Store.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ abstract class ActionScheduler_Store extends ActionScheduler_Store_Deprecated {
3737
*
3838
* @return int The action ID
3939
*/
40-
abstract public function save_action( ActionScheduler_Action $action, DateTime $scheduled_date = null );
40+
abstract public function save_action( ActionScheduler_Action $action, ?DateTime $scheduled_date = null );
4141

4242
/**
4343
* Get action.
@@ -202,14 +202,14 @@ abstract public function get_date( $action_id );
202202
/**
203203
* Make a claim.
204204
*
205-
* @param int $max_actions Maximum number of actions to claim.
206-
* @param DateTime $before_date Claim only actions schedule before the given date. Defaults to now.
207-
* @param array $hooks Claim only actions with a hook or hooks.
208-
* @param string $group Claim only actions in the given group.
205+
* @param int $max_actions Maximum number of actions to claim.
206+
* @param DateTime|null $before_date Claim only actions schedule before the given date. Defaults to now.
207+
* @param array $hooks Claim only actions with a hook or hooks.
208+
* @param string $group Claim only actions in the given group.
209209
*
210210
* @return ActionScheduler_ActionClaim
211211
*/
212-
abstract public function stake_claim( $max_actions = 10, DateTime $before_date = null, $hooks = array(), $group = '' );
212+
abstract public function stake_claim( $max_actions = 10, ?DateTime $before_date = null, $hooks = array(), $group = '' );
213213

214214
/**
215215
* Get claim count.
@@ -298,7 +298,7 @@ protected function validate_sql_comparator( $comparison_operator ) {
298298
* @param null|DateTime $scheduled_date Action's schedule date (optional).
299299
* @return string
300300
*/
301-
protected function get_scheduled_date_string( ActionScheduler_Action $action, DateTime $scheduled_date = null ) {
301+
protected function get_scheduled_date_string( ActionScheduler_Action $action, ?DateTime $scheduled_date = null ) {
302302
$next = is_null( $scheduled_date ) ? $action->get_schedule()->get_date() : $scheduled_date;
303303

304304
if ( ! $next ) {
@@ -313,11 +313,11 @@ protected function get_scheduled_date_string( ActionScheduler_Action $action, Da
313313
/**
314314
* Get the time MySQL formatted date/time string for an action's (next) scheduled date.
315315
*
316-
* @param ActionScheduler_Action $action Action.
317-
* @param null|DateTime $scheduled_date Action's scheduled date (optional).
316+
* @param ActionScheduler_Action|null $action Action.
317+
* @param null|DateTime $scheduled_date Action's scheduled date (optional).
318318
* @return string
319319
*/
320-
protected function get_scheduled_date_string_local( ActionScheduler_Action $action, DateTime $scheduled_date = null ) {
320+
protected function get_scheduled_date_string_local( ActionScheduler_Action $action, ?DateTime $scheduled_date = null ) {
321321
$next = is_null( $scheduled_date ) ? $action->get_schedule()->get_date() : $scheduled_date;
322322

323323
if ( ! $next ) {

classes/actions/ActionScheduler_Action.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class ActionScheduler_Action {
5353
* @param null|ActionScheduler_Schedule $schedule Action's schedule.
5454
* @param string $group Action's group.
5555
*/
56-
public function __construct( $hook, array $args = array(), ActionScheduler_Schedule $schedule = null, $group = '' ) {
56+
public function __construct( $hook, array $args = array(), ?ActionScheduler_Schedule $schedule = null, $group = '' ) {
5757
$schedule = empty( $schedule ) ? new ActionScheduler_NullSchedule() : $schedule;
5858
$this->set_hook( $hook );
5959
$this->set_schedule( $schedule );

0 commit comments

Comments
 (0)