Skip to content

Commit

Permalink
Merge pull request #1112 from crstauf/phpcs/deprecated/functions.php
Browse files Browse the repository at this point in the history
PHPCS: `deprecated/functions.php`
  • Loading branch information
barryhughes authored Oct 22, 2024
2 parents bf5ad55 + 9653af1 commit caeaf73
Showing 1 changed file with 30 additions and 27 deletions.
57 changes: 30 additions & 27 deletions deprecated/functions.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
<?php

/**
* Deprecated API functions for scheduling actions
*
* Functions with the wc prefix were deprecated to avoid confusion with
* Action Scheduler being included in WooCommerce core, and it providing
* a different set of APIs for working with the action queue.
*
* @package ActionScheduler
*/

/**
* Schedule an action to run one time
* Schedule an action to run one time.
*
* @param int $timestamp When the job will run
* @param string $hook The hook to trigger
* @param array $args Arguments to pass when the hook triggers
* @param string $group The group to assign this job to
* @param int $timestamp When the job will run.
* @param string $hook The hook to trigger.
* @param array $args Arguments to pass when the hook triggers.
* @param string $group The group to assign this job to.
*
* @return string The job ID
*/
Expand All @@ -24,13 +25,13 @@ function wc_schedule_single_action( $timestamp, $hook, $args = array(), $group =
}

/**
* Schedule a recurring action
* Schedule a recurring action.
*
* @param int $timestamp When the first instance of the job will run
* @param int $interval_in_seconds How long to wait between runs
* @param string $hook The hook to trigger
* @param array $args Arguments to pass when the hook triggers
* @param string $group The group to assign this job to
* @param int $timestamp When the first instance of the job will run.
* @param int $interval_in_seconds How long to wait between runs.
* @param string $hook The hook to trigger.
* @param array $args Arguments to pass when the hook triggers.
* @param string $group The group to assign this job to.
*
* @deprecated 2.1.0
*
Expand All @@ -44,8 +45,8 @@ function wc_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook,
/**
* Schedule an action that recurs on a cron-like schedule.
*
* @param int $timestamp The schedule will start on or after this time
* @param string $schedule A cron-link schedule string
* @param int $timestamp The schedule will start on or after this time.
* @param string $schedule A cron-link schedule string.
* @see http://en.wikipedia.org/wiki/Cron
* * * * * * *
* ┬ ┬ ┬ ┬ ┬ ┬
Expand All @@ -56,9 +57,9 @@ function wc_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook,
* | | +--------------- day of month (1 - 31)
* | +-------------------- hour (0 - 23)
* +------------------------- min (0 - 59)
* @param string $hook The hook to trigger
* @param array $args Arguments to pass when the hook triggers
* @param string $group The group to assign this job to
* @param string $hook The hook to trigger.
* @param array $args Arguments to pass when the hook triggers.
* @param string $group The group to assign this job to.
*
* @deprecated 2.1.0
*
Expand All @@ -72,9 +73,9 @@ function wc_schedule_cron_action( $timestamp, $schedule, $hook, $args = array(),
/**
* Cancel the next occurrence of a job.
*
* @param string $hook The hook that the job will trigger
* @param array $args Args that would have been passed to the job
* @param string $group
* @param string $hook The hook that the job will trigger.
* @param array $args Args that would have been passed to the job.
* @param string $group Action's group.
*
* @deprecated 2.1.0
*/
Expand All @@ -84,23 +85,25 @@ function wc_unschedule_action( $hook, $args = array(), $group = '' ) {
}

/**
* @param string $hook
* @param array $args
* @param string $group
* Get next scheduled action.
*
* @param string $hook Action's hook.
* @param array $args Action's args.
* @param string $group Action's group.
*
* @deprecated 2.1.0
*
* @return int|bool The timestamp for the next occurrence, or false if nothing was found
*/
function wc_next_scheduled_action( $hook, $args = NULL, $group = '' ) {
function wc_next_scheduled_action( $hook, $args = null, $group = '' ) {
_deprecated_function( __FUNCTION__, '2.1.0', 'as_next_scheduled_action()' );
return as_next_scheduled_action( $hook, $args, $group );
}

/**
* Find scheduled actions
*
* @param array $args Possible arguments, with their default values:
* @param array $args Possible arguments, with their default values:
* 'hook' => '' - the name of the action that will be triggered
* 'args' => NULL - the args array that will be passed with the action
* 'date' => NULL - the scheduled date of the action. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). Used in UTC timezone.
Expand All @@ -113,8 +116,8 @@ function wc_next_scheduled_action( $hook, $args = NULL, $group = '' ) {
* 'per_page' => 5 - Number of results to return
* 'offset' => 0
* 'orderby' => 'date' - accepted values are 'hook', 'group', 'modified', or 'date'
* 'order' => 'ASC'
* @param string $return_format OBJECT, ARRAY_A, or ids
* 'order' => 'ASC'.
* @param string $return_format OBJECT, ARRAY_A, or ids.
*
* @deprecated 2.1.0
*
Expand Down

0 comments on commit caeaf73

Please sign in to comment.