/** * Creates a new Descriptor from the given Reflector. * * @param ParamTag $data * * @return ParamDescriptor */ public function create($data) { $descriptor = new ParamDescriptor($data->getName()); $descriptor->setDescription($data->getDescription()); $descriptor->setVariableName($data->getVariableName()); $descriptor->setTypes($data->getTypes()); return $descriptor; }
/** * Creates a new Descriptor from the given Reflector. * * @param ParamTag $data * * @return ParamDescriptor */ public function create($data) { $descriptor = new ParamDescriptor($data->getName()); $descriptor->setDescription($data->getDescription()); $descriptor->setVariableName($data->getVariableName()); /** @var Collection $types */ $types = $this->builder->buildDescriptor(new Collection($data->getTypes())); $descriptor->setTypes($types); return $descriptor; }
/** * Checks the typehint of the argument versus the @param tag. * * If the argument has no typehint we do not check anything. When multiple * type are given then the typehint needs to be one of them. * * @param \phpDocumentor\Reflection\DocBlock\Tag\ParamTag $param * @param \phpDocumentor\Reflection\FunctionReflector\ArgumentReflector $argument * * @return bool whether an issue occurred */ protected function doesArgumentTypehintMatchParam(\phpDocumentor\Reflection\DocBlock\Tag\ParamTag $param, \phpDocumentor\Reflection\FunctionReflector\ArgumentReflector $argument) { if (!$argument->getType() || in_array($argument->getType(), $param->getTypes())) { return true; } $this->logParserError('ERROR', 50016, $this->lineNumber, array($argument->getName(), $this->entityName . '()')); return false; }
/** * Checks the typehint of the argument versus the @param tag. * * If the argument has no typehint we do not check anything. When multiple * type are given then the typehint needs to be one of them. * * @param ParamTag $param * @param ArgumentReflector $argument * * @return Error|null */ protected function doesArgumentTypehintMatchParam(ParamTag $param, ArgumentReflector $argument, $element) { if (!$argument->getType() || in_array($argument->getType(), $param->getTypes())) { return null; } elseif ($argument->getType() == 'array' && substr($param->getType(), -2) == '[]') { return null; } return new Error(LogLevel::ERROR, 'PPC:ERR-50016', $argument->getLinenumber(), array($argument->getName(), $element->getName())); }