Skip to content

Commit 8d5a91e

Browse files
committed
Add missing return types to Container::get() and Container::make()
Add `: mixed` return type to get() and make() methods. This fixes incorrect facade docblock generation (via hypervel/facade-documenter) which defaults to `void` when no return type is declared, causing IDE errors when using App::get() to resolve services.
1 parent 2dabd18 commit 8d5a91e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/container/src/Container.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class Container extends HyperfContainer implements ContainerContract, ArrayAcces
106106
* @throws \Hyperf\Di\Exception\NotFoundException no entry found for the given name
107107
* @throws InvalidArgumentException the name parameter must be of type string
108108
*/
109-
public function make(string $name, array $parameters = [])
109+
public function make(string $name, array $parameters = []): mixed
110110
{
111111
if ($this->isAlias($name)) {
112112
$name = $this->getAlias($name);
@@ -134,9 +134,9 @@ public function make(string $name, array $parameters = [])
134134
/**
135135
* Finds an entry of the container by its identifier and returns it.
136136
*
137-
* @param string $id identifier of the entry to look for
137+
* @param mixed $id identifier of the entry to look for
138138
*/
139-
public function get($id)
139+
public function get($id): mixed
140140
{
141141
if ($this->isAlias($id)) {
142142
$id = $this->getAlias($id);

0 commit comments

Comments
 (0)