qqq
This commit is contained in:
+15
-5
@@ -108,7 +108,17 @@ class Container implements ContainerInterface
|
|||||||
if (isset($this->_singletons[$id])) {
|
if (isset($this->_singletons[$id])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->make($id);
|
$object = $this->make($id);
|
||||||
|
$methods = $this->getReflectionClass($id);
|
||||||
|
foreach ($methods->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
|
||||||
|
if ($method->isStatic()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$attributes = $method->getAttributes();
|
||||||
|
foreach ($attributes as $attribute) {
|
||||||
|
$attribute->newInstance()->dispatch($object, $method->getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -377,11 +387,11 @@ class Container implements ContainerInterface
|
|||||||
private function getTypeValue(ReflectionParameter $parameter): string|int|bool|null
|
private function getTypeValue(ReflectionParameter $parameter): string|int|bool|null
|
||||||
{
|
{
|
||||||
return match ($parameter->getType()) {
|
return match ($parameter->getType()) {
|
||||||
'string' => '',
|
'string' => '',
|
||||||
'int', 'float' => 0,
|
'int', 'float' => 0,
|
||||||
'', null, 'object', 'mixed' => NULL,
|
'', null, 'object', 'mixed' => NULL,
|
||||||
'bool' => false,
|
'bool' => false,
|
||||||
'default' => null
|
'default' => null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user