You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[11.x] fix: allows injection using multiple interfaces with the same concrete implementation (#53275)
* fix: allows injection of multiple interfaces with the same implementation
* fix: ensure interfaces are only resolved once
* fix: allows injection using multiple interfaces with the same concrete implementation
* wip: working but ugly
* test: ensure all tests pass
* chore: fix code style issues
* chore: fix code style issues
* remove forgotten dd
* wip
* test: add test to ensure multiple interfaces with the same implementation can be injected in controllers
* chore: remove unused imports
* chore: adhere to style guidelines
* formatting
* formatting
* formatting
* formatting
* formatting
---------
Co-authored-by: Taylor Otwell <taylor@laravel.com>
if ($this->isSimilarConcreteToExistingParameterButDifferentInterface(
99
+
$className, $parameters, $resolvedInterfaces
100
+
)) {
101
+
return$this->container->make($className);
102
+
}
83
103
84
104
// If the parameter has a type-hinted class, we will check to see if it is already in
85
105
// the list of parameters. If it is we will just skip it as it is probably a model
@@ -95,6 +115,24 @@ protected function transformDependency(ReflectionParameter $parameter, $paramete
95
115
return$skippableValue;
96
116
}
97
117
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.
0 commit comments