eee
This commit is contained in:
+4
-2
@@ -361,13 +361,15 @@ class Container implements ContainerInterface
|
|||||||
*/
|
*/
|
||||||
private function getTypeValue(ReflectionParameter $parameter): string|int|bool|null
|
private function getTypeValue(ReflectionParameter $parameter): string|int|bool|null
|
||||||
{
|
{
|
||||||
|
$class = $parameter->getDeclaringClass()->getName();
|
||||||
|
$name = $parameter->getName();
|
||||||
return match ($parameter->getType()->getName()) {
|
return match ($parameter->getType()->getName()) {
|
||||||
'string' => '',
|
'string' => '',
|
||||||
'int', 'float' => 0,
|
'int', 'float' => 0,
|
||||||
'', 'mixed' => NULL,
|
'', 'mixed' => NULL,
|
||||||
'array' => [],
|
|
||||||
'object' => throw new Exception('Param type must has default value.'),
|
|
||||||
'bool' => false,
|
'bool' => false,
|
||||||
|
'object' => throw new Exception('Param type ' . $class . '::' . $name . ' must has default value.'),
|
||||||
|
'array' => [],
|
||||||
default => null
|
default => null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user