diff --git a/src/ParamResolver.php b/src/ParamResolver.php index cb181e4..54b3fdd 100644 --- a/src/ParamResolver.php +++ b/src/ParamResolver.php @@ -142,13 +142,11 @@ private function resolveString(string $value, array $resolving = []): mixed return $this->resolveString($resolved, $resolving); }, $value); - if (!isset($onlyKey)) { - return $replaced; + if ($setKey = isset($onlyKey)) { + $resolving[$onlyKey] = true; } - $resolving[$onlyKey] = true; - - return $this->resolveValue($this->get($onlyKey), $resolving); + return $setKey ? $this->resolveValue($this->get($onlyKey), $resolving) : $replaced; } /**