public function __construct($reflector = null, $context = null, $config = [])
{
parent::__construct($reflector, $context, $config);
if ($reflector === null) {
return;
}
$this->isReturnByReference = $reflector->isByRef();
foreach ($reflector->getArguments() as $arg) {
$arg = new ParamDoc($arg, $context, ['sourceFile' => $this->sourceFile]);
$this->params[$arg->name] = $arg;
}
foreach ($this->tags as $i => $tag) {
if ($tag instanceof ThrowsTag) {
$this->exceptions[$tag->getType()] = $tag->getDescription();
unset($this->tags[$i]);
} elseif ($tag instanceof PropertyTag) {
// ignore property tag
} elseif ($tag instanceof ParamTag) {
$paramName = $tag->getVariableName();
if (!isset($this->params[$paramName]) && $context !== null) {
$context->errors[] = ['line' => $this->startLine, 'file' => $this->sourceFile, 'message' => "Undefined parameter documented: {$paramName} in {$this->name}()."];
continue;
}
$this->params[$paramName]->description = static::mbUcFirst($tag->getDescription());
$this->params[$paramName]->type = $tag->getType();
$this->params[$paramName]->types = $tag->getTypes();
unset($this->tags[$i]);
} elseif ($tag instanceof ReturnTag) {
$this->returnType = $tag->getType();
$this->returnTypes = $tag->getTypes();
$this->return = static::mbUcFirst($tag->getDescription());
unset($this->tags[$i]);
}
}
}