This commit is contained in:
2023-12-18 16:20:38 +08:00
parent 00c089363f
commit 04b64bb4b8
2 changed files with 12 additions and 6 deletions
+8 -6
View File
@@ -357,15 +357,17 @@ class Container implements ContainerInterface
/** /**
* @param ReflectionParameter $parameter * @param ReflectionParameter $parameter
* @return string|int|bool|null * @return string|int|bool|null
* @throws
*/ */
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()->getName()) {
'string' => '', 'string' => '',
'int', 'float' => 0, 'int', 'float' => 0,
'', null, 'object', 'mixed' => NULL, '', 'mixed' => NULL,
'bool' => false, 'array' => [],
'default' => null 'bool' => false,
default => null
}; };
} }
+4
View File
@@ -96,6 +96,10 @@ class Scanner extends Component
if (count($data) > 0) { if (count($data) > 0) {
return; return;
} }
$data = $reflect->getAttributes(\Attribute::class);
if (count($data) > 0) {
return;
}
$object = $this->container->parse($class); $object = $this->container->parse($class);
$methods = $this->container->getReflectionClass($class); $methods = $this->container->getReflectionClass($class);
foreach ($methods->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { foreach ($methods->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {