Skip to content

Commit

Permalink
Merge pull request #1220 from woocommerce/fix/php84-more-nullables
Browse files Browse the repository at this point in the history
Make some other nullable parameters explicitly nullable
  • Loading branch information
coreymckrill authored Dec 6, 2024
2 parents ac7991d + 4436733 commit b2f889a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions classes/ActionScheduler_ActionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion deprecated/ActionScheduler_Schedule_Deprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()';
Expand Down
2 changes: 1 addition & 1 deletion lib/cron-expression/CronExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 *',
Expand Down
2 changes: 1 addition & 1 deletion tests/ActionScheduler_UnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/ActionScheduler_Mocker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/deprecated/ActionScheduler_UnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit b2f889a

Please sign in to comment.