33namespace  Illuminate \Routing ;
44
55use  Illuminate \Container \Util ;
6- use  Illuminate \Contracts \Container \BindingResolutionException ;
76use  Illuminate \Support \Arr ;
87use  Illuminate \Support \Reflector ;
98use  ReflectionClass ;
10- use  ReflectionException ;
119use  ReflectionFunctionAbstract ;
1210use  ReflectionMethod ;
1311use  ReflectionParameter ;
@@ -49,24 +47,15 @@ public function resolveMethodDependencies(array $parameters, ReflectionFunctionA
4947
5048        $ skippableValuenew  stdClass ;
5149
52-         $ resolvedInterfaces
53- 
5450        foreach  ($ reflectorgetParameters () as  $ key$ parameter
55-             $ classNamegetParameterClassName ($ parameter
56- 
57-             $ instance$ this transformDependency ($ parameter$ parameters$ className$ skippableValue$ resolvedInterfaces
58- 
59-             if  ($ instance$ skippableValue
60-                 ! $ this alreadyInResolvedInterfaces ($ className$ resolvedInterfaces
61-                 $ resolvedInterfaces$ className
62-             }
51+             $ instance$ this transformDependency ($ parameter$ parameters$ skippableValue
6352
6453            if  ($ instance$ skippableValue
6554                $ instanceCount
6655
6756                $ this spliceIntoParameters ($ parameters$ key$ instance
6857            } elseif  (! isset ($ values$ key$ instanceCount
69-                 $ parameterisDefaultValueAvailable ()) {
58+                        $ parameterisDefaultValueAvailable ()) {
7059                $ this spliceIntoParameters ($ parameters$ key$ parametergetDefaultValue ());
7160            }
7261
@@ -79,27 +68,18 @@ public function resolveMethodDependencies(array $parameters, ReflectionFunctionA
7968    /** 
8069     * Attempt to transform the given parameter into a class instance. 
8170     * 
82-      * @param  ReflectionParameter  $parameter 
71+      * @param  \ ReflectionParameter  $parameter 
8372     * @param  array  $parameters 
84-      * @param  string  $className 
8573     * @param  object  $skippableValue 
86-      * @param  $resolvedInterfaces 
8774     * @return mixed 
88-      * 
89-      * @throws BindingResolutionException 
90-      * @throws ReflectionException 
9175     */ 
92-     protected  function  transformDependency (ReflectionParameter $ parameter$ parameters$ className ,  object   $ skippableValue,  $ resolvedInterfaces 
76+     protected  function  transformDependency (ReflectionParameter $ parameter$ parameters$ skippableValue
9377    {
9478        if  ($ attributegetContextualAttributeFromDependency ($ parameter
9579            return  $ this container ->resolveFromAttribute ($ attribute
9680        }
9781
98-         if  ($ this isSimilarConcreteToExistingParameterButDifferentInterface (
99-             $ className$ parameters$ resolvedInterfaces
100-         )) {
101-             return  $ this container ->make ($ className
102-         }
82+         $ classNamegetParameterClassName ($ parameter
10383
10484        // If the parameter has a type-hinted class, we will check to see if it is already in 
10585        // the list of parameters. If it is we will just skip it as it is probably a model 
@@ -115,24 +95,6 @@ protected function transformDependency(ReflectionParameter $parameter, $paramete
11595        return  $ skippableValue
11696    }
11797
118-     /** 
119-      * Determines if an instance of the given class is already in the parameters, but the route is type-hinting another interface that hasn't yet been resolved. 
120-      * 
121-      * @param  string  $className 
122-      * @param  array  $parameters 
123-      * @param  array  $resolvedInterfaces 
124-      * @return bool 
125-      */ 
126-     protected  function  isSimilarConcreteToExistingParameterButDifferentInterface ($ classNamearray  $ parametersarray  $ resolvedInterfaces
127-     {
128-         // See: https://github.com/laravel/framework/pull/53275 
129-         return  $ className
130-             $ this alreadyInParameters ($ className$ parameters
131-             interface_exists ($ className
132-             ! $ this alreadyInResolvedInterfaces ($ className$ resolvedInterfaces
133-             (new  ReflectionClass ($ classNameisInterface ();
134-     }
135- 
13698    /** 
13799     * Determine if an object of the given class is in a list of parameters. 
138100     * 
@@ -145,22 +107,6 @@ protected function alreadyInParameters($class, array $parameters)
145107        return  ! is_null (Arr::first ($ parametersfn  ($ value$ valueinstanceof  $ class
146108    }
147109
148-     /** 
149-      * Determine if the given class name is already in the list of resolved interfaces. 
150-      * 
151-      * @param  string|null  $class 
152-      * @param  array  $resolvedInterfaces 
153-      * @return bool 
154-      */ 
155-     protected  function  alreadyInResolvedInterfaces ($ classarray  $ resolvedInterfaces
156-     {
157-         if  (! is_null ($ class
158-             return  in_array ($ class$ resolvedInterfaces
159-         }
160- 
161-         return  false ;
162-     }
163- 
164110    /** 
165111     * Splice the given value into the parameter list. 
166112     * 
0 commit comments