From 0a27365ad32f7f7c4089a9432d68c50f14417ad9 Mon Sep 17 00:00:00 2001 From: Victor Korkoshko Date: Tue, 29 Oct 2024 23:31:12 +0200 Subject: [PATCH] Refactor: check for contextual attribute before getting parameter class name --- src/Illuminate/Routing/ResolvesRouteDependencies.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Routing/ResolvesRouteDependencies.php b/src/Illuminate/Routing/ResolvesRouteDependencies.php index 9bd32a89a965..bd3139fc7691 100644 --- a/src/Illuminate/Routing/ResolvesRouteDependencies.php +++ b/src/Illuminate/Routing/ResolvesRouteDependencies.php @@ -75,12 +75,12 @@ public function resolveMethodDependencies(array $parameters, ReflectionFunctionA */ protected function transformDependency(ReflectionParameter $parameter, $parameters, $skippableValue) { - $className = Reflector::getParameterClassName($parameter); - if ($attribute = Util::getContextualAttributeFromDependency($parameter)) { return $this->container->resolveFromAttribute($attribute); } + $className = Reflector::getParameterClassName($parameter); + // If the parameter has a type-hinted class, we will check to see if it is already in // the list of parameters. If it is we will just skip it as it is probably a model // binding and we do not want to mess with those; otherwise, we resolve it here.