Fix yii\base\Controller::bindInjectedParams() to not throw error when argument of ReflectionUnionType type is passed (#18869)

This commit is contained in:
Bizley
2021-09-06 20:16:14 +02:00
committed by GitHub
parent 932806b97d
commit ea60fba0ae
4 changed files with 7 additions and 2 deletions

View File

@@ -563,6 +563,10 @@ class Controller extends Component implements ViewContextInterface
*/
final protected function bindInjectedParams(\ReflectionType $type, $name, &$args, &$requestedParams)
{
if (!$type instanceof \ReflectionNamedType || $type->isBuiltin()) {
return;
}
// Since it is not a builtin type it must be DI injection.
$typeName = $type->getName();
if (($component = $this->module->get($name, false)) instanceof $typeName) {