Skip to content

Commit 6df57dc

Browse files
committed
fix 忽略判断
1 parent a6d5b34 commit 6df57dc

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/AnnotationController.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __hook(?array $actionArg = [],?array $onRequestArg = null)
4040
}
4141

4242
$this->preHandleProperty();
43-
$onRequestArg = $this->runParamsValidate($this->getActionName(),$this->request());
43+
$onRequestArg = $cloneOnRequestArg = $this->runParamsValidate($this->getActionName(),$this->request());
4444
/** @var Param $actionParam */
4545
foreach ($onRequestArg as $actionParam){
4646
$onRequestArg[$actionParam->name] = self::handlerParam($actionParam);
@@ -59,15 +59,17 @@ public function __hook(?array $actionArg = [],?array $onRequestArg = null)
5959
}
6060
if(count($parameters) == 1 && $type == "array"){
6161
$key = $parameters[0]->name;
62-
//传递全部参数的时候,仅仅保留注解定义的参数。
62+
//传递全部参数的时候,仅仅保留注解定义的参数。且做忽略判断
6363
$temps = Utility::parseMethodParams($ref,$this->getActionName());
6464
/**
6565
* @var $keyKey
6666
* @var Param $temp
6767
*/
6868
foreach ($temps as $keyKey => $temp){
6969
$temps[$keyKey] = $onRequestArg[$keyKey] !== null ? $onRequestArg[$keyKey] : null;
70-
if($temp->ignorePassArgWhenNull && $temps[$keyKey] === null){
70+
//找出解析后的param实例
71+
$test = $cloneOnRequestArg[$keyKey];
72+
if($test->ignorePassArgWhenNull && !$test->hasSet()){
7173
unset($temps[$keyKey]);
7274
}
7375
}

0 commit comments

Comments
 (0)