Exemple #1
0
 private function parseParamDomain(array $params, array $annotations, CaseSensor $sensor)
 {
     $paramTypes = array_reduce($params, function (array &$tmp, \ReflectionParameter $p) {
         return $tmp + [$p->name => $p->getClass() !== null ? $p->getClass()->name : null];
     }, []);
     $paramNames = array_keys($paramTypes);
     $lookup = array_map(function ($name) use($paramTypes) {
         return ParamAlt::__set_state(['type' => $paramTypes[$name], 'name' => $name]);
     }, array_combine($paramNames, $paramNames));
     $lookup = array_reduce($this->extractAnnotations($annotations, ParamAlt::class), function (array &$tmp, ParamAlt $a) use($paramTypes) {
         if (isset($paramTypes[$a->name])) {
             $tmp[$a->name] = $a;
         }
         return $tmp;
     }, $lookup);
     return array_map(function (ParamAlt $a) use($sensor) {
         return $this->parseInternal($a->name, $a->type, $sensor, false);
     }, $lookup);
 }
 private function parseParamComment(DocLexer $lexer, $context)
 {
     if ($ids = $this->parseDocComment($lexer, 'param', 2)) {
         $t = trim($this->complementType($ids[0], $context), '\\');
         return ParamAlt::__set_state(['type' => $t, 'name' => $ids[1]]);
     } else {
         return false;
     }
 }