变更
This commit is contained in:
+3
-1
@@ -252,6 +252,8 @@ class Container implements ContainerInterface
|
||||
return $params;
|
||||
}
|
||||
$parametersArray = $parameters->getParameters();
|
||||
|
||||
$className = $parameters->getDeclaringClass()->getName();
|
||||
foreach ($parametersArray as $parameter) {
|
||||
$parameterAttributes = $parameter->getAttributes();
|
||||
if (count($parameterAttributes) < 1) {
|
||||
@@ -271,7 +273,7 @@ class Container implements ContainerInterface
|
||||
} else {
|
||||
$attribute = $parameterAttributes[0]->newInstance();
|
||||
|
||||
$params[$parameter->getName()] = $attribute->dispatch();
|
||||
$params[$parameter->getName()] = $attribute->dispatch($className, $parameters->getName());
|
||||
}
|
||||
}
|
||||
return $params;
|
||||
|
||||
@@ -25,7 +25,7 @@ class ContainerParams implements InjectParameterInterface
|
||||
* @return mixed|null
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function dispatch(object $class, string $method): mixed
|
||||
public function dispatch(string $class, string $method): mixed
|
||||
{
|
||||
return Container::instance()->get($this->value);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class ServiceParams implements InjectParameterInterface
|
||||
* @return mixed|null
|
||||
* @throws Exception
|
||||
*/
|
||||
public function dispatch(object $class, string $method): mixed
|
||||
public function dispatch(string $class, string $method): mixed
|
||||
{
|
||||
$service = Container::instance()->get(LocalService::class);
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ interface InjectParameterInterface
|
||||
|
||||
|
||||
/**
|
||||
* @param object $class
|
||||
* @param string $class
|
||||
* @param string $method
|
||||
* @return mixed
|
||||
*/
|
||||
public function dispatch(object $class, string $method): mixed;
|
||||
public function dispatch(string $class, string $method): mixed;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user