From 0cdebde740888fbec95764d1d2e7d4435dd3f83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20=C5=BDoljom?= Date: Mon, 18 Sep 2023 15:15:05 +0200 Subject: [PATCH] Move lowecasing functionality at the beginning of the helper There are some early returns that would make lowecasing not happen even if we passed the last parameter as true. --- WordPress/Helpers/RulesetPropertyHelper.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/WordPress/Helpers/RulesetPropertyHelper.php b/WordPress/Helpers/RulesetPropertyHelper.php index 303c026e8..2722df6ea 100644 --- a/WordPress/Helpers/RulesetPropertyHelper.php +++ b/WordPress/Helpers/RulesetPropertyHelper.php @@ -54,6 +54,13 @@ final class RulesetPropertyHelper { * @return array */ public static function merge_custom_array( $custom, array $base = array(), $flip = true, $lowercaseKeyValues = false ) { + if ( $lowercaseKeyValues ) { + $base = array_map( 'strtolower', $base ); + $custom = array_map( 'strtolower', $custom ); + $base = array_change_key_case( $base ); + $custom = array_change_key_case( $custom ); + } + if ( true === $flip ) { $base = array_filter( $base ); } @@ -70,13 +77,6 @@ public static function merge_custom_array( $custom, array $base = array(), $flip return $custom; } - if ( $lowercaseKeyValues ) { - $base = array_map( 'strtolower', $base ); - $custom = array_map( 'strtolower', $custom ); - $base = array_change_key_case( $base ); - $custom = array_change_key_case( $custom ); - } - return array_merge( $base, $custom ); } }