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
{{ message }}
This repository has been archived by the owner on Feb 6, 2020. It is now read-only.
I trying to use ReflectionBasedAbstractFactory on Zend Expressive Skeleton 3.0 with default configuration. If a parameter has a default value as null it throws an exception.
Zend\Expressive\Middleware\ImplicitHeadMiddleware"; unable to resolve parameter "response" using type hint "Psr\Http\Message\ResponseInterface
As solution can be change ReflectionBasedAbstractFactory on ~221 line:
if (! $container->has($type)) {
throw new ServiceNotFoundException(sprintf(
'Unable to create service "%s"; unable to resolve parameter "%s" using type hint "%s"',
$requestedName,
$parameter->getName(),
$type
));
}
return $container->get($type);
to
if ($container->has($type)) {
return $container->get($type);
} elseif ($parameter->isOptional()) {
return $parameter->getDefaultValue();
}
throw new ServiceNotFoundException(sprintf(
'Unable to create service "%s"; unable to resolve parameter "%s" using type hint "%s"',
$requestedName,
$parameter->getName(),
$type
));
The text was updated successfully, but these errors were encountered:
weierophinney
added a commit
to weierophinney/zend-servicemanager
that referenced
this issue
Jan 29, 2018
…tainer
Per zendframework#239, currently when an argument is type-hinted but has a default
value (typically `null`), the factory raises an exception about not
being able to retrieve the value from the container. In such cases, we
can use the default value for the argument during injection.
I trying to use
ReflectionBasedAbstractFactory
on Zend Expressive Skeleton 3.0 with default configuration. If a parameter has a default value asnull
it throws an exception.Code to reproduce the issue
Install zend-expressive-skeleton
composer create-project "zendframework/zend-expressive-skeleton:3.0.x-dev" <project-path>
Add to
config/autoload/dependencies.global.php
And run application in browser
Expected results
Application should run without any errors
Actual results
Zend\Expressive\Middleware\ImplicitHeadMiddleware"; unable to resolve parameter "response" using type hint "Psr\Http\Message\ResponseInterface
As solution can be change ReflectionBasedAbstractFactory on ~221 line:
to
The text was updated successfully, but these errors were encountered: