Convert optional-before-required arguments to required (take 2)

In PHP 8 required parameters after optional parameters in
function/method signatures trigger a deprecation notice. These type
of parameters are pointless since a value needs to always be
provided for them anyway, so they are actually de-facto required.

This commit converts all these not-so-optional parameters into
truly required parameters by removing their default values.
This commit is contained in:
Nestor Soriano 2020-10-16 13:08:31 +02:00
parent 51912c659d
commit 63ced34e2d
3 changed files with 3 additions and 3 deletions

View File

@ -387,7 +387,7 @@ class WC_Admin_Taxonomies {
* @param object $term Term object.
* @return array
*/
public function product_cat_row_actions( $actions = array(), $term ) {
public function product_cat_row_actions( $actions, $term ) {
$default_category_id = absint( get_option( 'default_product_cat', 0 ) );
if ( $default_category_id !== $term->term_id && current_user_can( 'edit_term', $term->term_id ) ) {

View File

@ -93,7 +93,7 @@ class WC_Product_Cat_Dropdown_Walker extends Walker {
* @param string $output Passed by reference. Used to append additional content.
* @return null Null on failure with no changes to parameters.
*/
public function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) {
public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
if ( ! $element || ( 0 === $element->count && ! empty( $args[0]['hide_empty'] ) ) ) {
return;
}

View File

@ -144,7 +144,7 @@ class WC_Product_Cat_List_Walker extends Walker {
* @param string $output Passed by reference. Used to append additional content.
* @return null Null on failure with no changes to parameters.
*/
public function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) {
public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
if ( ! $element || ( 0 === $element->count && ! empty( $args[0]['hide_empty'] ) ) ) {
return;
}