Skip to content

Commit

Permalink
修复无参数定义
Browse files Browse the repository at this point in the history
  • Loading branch information
kiss291323003 committed Feb 7, 2023
1 parent 498fce8 commit 1eb955e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/AnnotationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ public function __hook(?array $actionArg = [],?array $onRequestArg = null)
$ref = ReflectionCache::getInstance()->getClassReflection(static::class);
if($ref->hasMethod($this->getActionName())){
$ref = $ref->getMethod($this->getActionName());
$type = null;
$parameters = $ref->getParameters();
//如果用数组来接收全部参数
$type = $parameters[0]->getType();
if($type){
$type = $type->getName();
if(!empty($parameters)){
//如果用数组来接收全部参数
$type = $parameters[0]->getType();
if($type){
$type = $type->getName();
}
}
if(count($parameters) == 1 && $type == "array"){
$key = $parameters[0]->name;
Expand Down

0 comments on commit 1eb955e

Please sign in to comment.