Update TaskLists::add_task() to reflect changes in TaskList::add_task() (#36104)
* Update TaskLists::add_task() to reflect changes in TaskList::add_task()
In
8ff08ea0c9 (diff-061f664bd417ad78d47c53ad5e6cc7e2eb1243af4e55b6fbf68750225acb06a3R173)
`TaskList::add_task()` was refactored to receive an instance of `Task`
instead of an `array` as its first parameter.
This commit updates `TaskLists::add_task()` (easy to miss that it is a
different method as the only difference is the plural in the class
name) to reflect the changes from the commit mentioned above. It
updates the type of the second parameter from `array` to `Task` and
renames the parameter from `$args` to `$task`.
I found this while using `TaskLists::add_task()` to add a MailPoet task
as our PHPStan checks complained that I was passing the wrong parameter
to this WooCommerce method.
* Add missing changelog file
This commit is contained in:
parent
4927a2e412
commit
1d234b5ac0
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Update TaskLists::add_task() to reflect changes in TaskList::add_task()
|
|
@ -288,10 +288,11 @@ class TaskLists {
|
|||
* Add task to a given task list.
|
||||
*
|
||||
* @param string $list_id List ID to add the task to.
|
||||
* @param array $args Task properties.
|
||||
* @param Task $task Task object.
|
||||
*
|
||||
* @return \WP_Error|Task
|
||||
*/
|
||||
public static function add_task( $list_id, $args ) {
|
||||
public static function add_task( $list_id, $task ) {
|
||||
if ( ! isset( self::$lists[ $list_id ] ) ) {
|
||||
return new \WP_Error(
|
||||
'woocommerce_task_list_invalid_list',
|
||||
|
@ -299,7 +300,7 @@ class TaskLists {
|
|||
);
|
||||
}
|
||||
|
||||
self::$lists[ $list_id ]->add_task( $args );
|
||||
self::$lists[ $list_id ]->add_task( $task );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue