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