From 2725cd56d48380999be61e5304117ad2e906f880 Mon Sep 17 00:00:00 2001 From: Khan M Rashedun-Naby Date: Thu, 24 May 2018 22:55:00 +0600 Subject: [PATCH] wc_remove_number_precision_deep logic simplified --- includes/wc-core-functions.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/includes/wc-core-functions.php b/includes/wc-core-functions.php index 3902113084d..41ef61d2b61 100644 --- a/includes/wc-core-functions.php +++ b/includes/wc-core-functions.php @@ -1603,16 +1603,17 @@ function wc_add_number_precision_deep( $value, $round = true ) { * * @since 3.2.0 * @param array $value Number to add precision to. - * @return int + * @return int|array */ function wc_remove_number_precision_deep( $value ) { - if ( is_array( $value ) ) { - foreach ( $value as $key => $subvalue ) { - $value[ $key ] = wc_remove_number_precision_deep( $subvalue ); - } - } else { + if ( ! is_array( $value ) ) { $value = wc_remove_number_precision( $value ); } + + foreach ( $value as $key => $sub_value ) { + $value[ $key ] = wc_remove_number_precision_deep( $sub_value ); + } + return $value; }