diff --git a/src/Container/AutowireFactory.php b/src/Container/AutowireFactory.php index 7a3a8c98..51bc91d1 100644 --- a/src/Container/AutowireFactory.php +++ b/src/Container/AutowireFactory.php @@ -56,7 +56,7 @@ public function canCreate(ContainerInterface $container, string $requestedName) /** * Create an instance * - * @return bool + * @return object */ public function create(ContainerInterface $container, string $requestedName, ?array $options = null) { @@ -66,9 +66,9 @@ public function create(ContainerInterface $container, string $requestedName, ?ar /** * Make invokable and implement the laminas-service factory pattern * - * @return bool + * @return object */ - public function __invoke(ContainerInterface $container, string $requestedName, ?array $options = null) + public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null) { return $this->create($container, (string) $requestedName, $options); } diff --git a/src/Resolver/DependencyResolver.php b/src/Resolver/DependencyResolver.php index 4859a87d..55a15886 100644 --- a/src/Resolver/DependencyResolver.php +++ b/src/Resolver/DependencyResolver.php @@ -285,7 +285,7 @@ public function resolveParameters(string $requestedType, array $callTimeParamete foreach ($params as $paramInfo) { $name = $paramInfo->getName(); - $type = $paramInfo->getType() === 'self' ? $requestedType : $paramInfo->getType(); + $type = $paramInfo->getType(); if (isset($callTimeParameters[$name])) { $result[$name] = new ValueInjection($callTimeParameters[$name]); diff --git a/test/TestAsset/Constructor/OptionalArguments.php b/test/TestAsset/Constructor/OptionalArguments.php index 8ebb3d29..376c6755 100644 --- a/test/TestAsset/Constructor/OptionalArguments.php +++ b/test/TestAsset/Constructor/OptionalArguments.php @@ -12,7 +12,11 @@ class OptionalArguments { - public function __construct(?string $foo = null, string $bar = 'something') + /** + * @param null|string $foo + * @param string $bar + */ + public function __construct($foo = null, $bar = 'something') { } }