diff --git a/classes/ActionScheduler_ActionFactory.php b/classes/ActionScheduler_ActionFactory.php index 722b60204..ea60d60ba 100644 --- a/classes/ActionScheduler_ActionFactory.php +++ b/classes/ActionScheduler_ActionFactory.php @@ -8,17 +8,17 @@ class ActionScheduler_ActionFactory { /** * Return stored actions for given params. * - * @param string $status The action's status in the data store. - * @param string $hook The hook to trigger when this action runs. - * @param array $args Args to pass to callbacks when the hook is triggered. - * @param ActionScheduler_Schedule $schedule The action's schedule. - * @param string $group A group to put the action in. + * @param string $status The action's status in the data store. + * @param string $hook The hook to trigger when this action runs. + * @param array $args Args to pass to callbacks when the hook is triggered. + * @param ActionScheduler_Schedule|null $schedule The action's schedule. + * @param string $group A group to put the action in. * phpcs:ignore Squiz.Commenting.FunctionComment.ExtraParamComment - * @param int $priority The action priority. + * @param int $priority The action priority. * * @return ActionScheduler_Action An instance of the stored action. */ - public function get_stored_action( $status, $hook, array $args = array(), ActionScheduler_Schedule $schedule = null, $group = '' ) { + public function get_stored_action( $status, $hook, array $args = array(), ?ActionScheduler_Schedule $schedule = null, $group = '' ) { // The 6th parameter ($priority) is not formally declared in the method signature to maintain compatibility with // third-party subclasses created before this param was added. $priority = func_num_args() >= 6 ? (int) func_get_arg( 5 ) : 10; diff --git a/deprecated/ActionScheduler_Schedule_Deprecated.php b/deprecated/ActionScheduler_Schedule_Deprecated.php index 496d67b84..af200bca7 100644 --- a/deprecated/ActionScheduler_Schedule_Deprecated.php +++ b/deprecated/ActionScheduler_Schedule_Deprecated.php @@ -13,7 +13,7 @@ abstract class ActionScheduler_Schedule_Deprecated implements ActionScheduler_Sc * * @return DateTime|null */ - public function next( DateTime $after = null ) { + public function next( ?DateTime $after = null ) { if ( empty( $after ) ) { $return_value = $this->get_date(); $replacement_method = 'get_date()'; diff --git a/lib/cron-expression/CronExpression.php b/lib/cron-expression/CronExpression.php index 7f33c378f..33040eddf 100644 --- a/lib/cron-expression/CronExpression.php +++ b/lib/cron-expression/CronExpression.php @@ -54,7 +54,7 @@ class CronExpression * * @return CronExpression */ - public static function factory($expression, CronExpression_FieldFactory $fieldFactory = null) + public static function factory($expression, ?CronExpression_FieldFactory $fieldFactory = null) { $mappings = array( '@yearly' => '0 0 1 1 *', diff --git a/tests/ActionScheduler_UnitTestCase.php b/tests/ActionScheduler_UnitTestCase.php index fcbc21699..8b7217a3c 100644 --- a/tests/ActionScheduler_UnitTestCase.php +++ b/tests/ActionScheduler_UnitTestCase.php @@ -44,7 +44,7 @@ public function count(): int { * * @param null|\PHPUnit\Framework\TestResult $result Test result. */ - public function run( PHPUnit\Framework\TestResult $result = null ): \PHPUnit\Framework\TestResult { + public function run( ?PHPUnit\Framework\TestResult $result = null ): \PHPUnit\Framework\TestResult { if ( is_null( $result ) ) { $result = $this->createResult(); diff --git a/tests/phpunit/ActionScheduler_Mocker.php b/tests/phpunit/ActionScheduler_Mocker.php index acb8eb37f..290368705 100644 --- a/tests/phpunit/ActionScheduler_Mocker.php +++ b/tests/phpunit/ActionScheduler_Mocker.php @@ -12,7 +12,7 @@ class ActionScheduler_Mocker { * * @param null|ActionScheduler_Store $store Store instance. */ - public static function get_queue_runner( ActionScheduler_Store $store = null ) { + public static function get_queue_runner( ?ActionScheduler_Store $store = null ) { if ( ! $store ) { $store = ActionScheduler_Store::instance(); diff --git a/tests/phpunit/deprecated/ActionScheduler_UnitTestCase.php b/tests/phpunit/deprecated/ActionScheduler_UnitTestCase.php index de6cdf5ba..b8ce7530e 100644 --- a/tests/phpunit/deprecated/ActionScheduler_UnitTestCase.php +++ b/tests/phpunit/deprecated/ActionScheduler_UnitTestCase.php @@ -45,7 +45,7 @@ public function count() { * * @param null|PHPUnit_Framework_TestResult $result Test result. */ - public function run( PHPUnit_Framework_TestResult $result = null ) { + public function run( ?PHPUnit_Framework_TestResult $result = null ) { if ( is_null( $result ) ) { $result = $this->createResult();