diff --git a/src/ConfigPostProcessor.php b/src/ConfigPostProcessor.php index f704e3c..c3b601a 100644 --- a/src/ConfigPostProcessor.php +++ b/src/ConfigPostProcessor.php @@ -5,8 +5,6 @@ use function array_intersect_key; use function array_key_exists; use function array_pop; -use function array_push; -use function count; use function in_array; use function is_array; use function is_callable; @@ -70,7 +68,7 @@ function ($value) { function ($value, array $keys) { $key = array_pop($keys); // Only worried about a top-level "router" key. - return $key === 'router' && count($keys) === 0 && is_array($value) + return $key === 'router' && $keys === [] && is_array($value) ? [$this, 'noopReplacement'] : null; }, @@ -84,7 +82,7 @@ function ($value) { // Array values function ($value, array $keys) { - return 0 !== count($keys) && is_array($value) + return $keys !== [] && is_array($value) ? [$this, '__invoke'] : null; }, @@ -153,7 +151,7 @@ private function replace($value, array $keys, $key = null) { // Add new key to the list of keys. // We do not need to remove it later, as we are working on a copy of the array. - array_push($keys, $key); + $keys[] = $key; // Identify rewrite strategy and perform replacements $rewriteRule = $this->replacementRuleMatch($value, $keys);