/**
* @param \phpDocumentor\Reflection\ClassReflector\PropertyReflector $reflector
* @param Context $context
* @param array $config
*/
public function __construct($reflector = null, $context = null, $config = [])
{
parent::__construct($reflector, $context, $config);
if ($reflector === null) {
return;
}
$this->visibility = $reflector->getVisibility();
$this->isStatic = $reflector->isStatic();
// bypass $reflector->getDefault() for short array syntax
if ($reflector->getNode()->default) {
$this->defaultValue = PrettyPrinter::getRepresentationOfValue($reflector->getNode()->default);
}
$hasInheritdoc = false;
foreach ($this->tags as $tag) {
if ($tag->getName() === 'inheritdoc') {
$hasInheritdoc = true;
}
if ($tag instanceof VarTag) {
$this->type = $tag->getType();
$this->types = $tag->getTypes();
$this->description = ucfirst($tag->getDescription());
if (($pos = strpos($this->description, '.')) !== false) {
$this->shortDescription = substr($this->description, 0, $pos + 1);
} else {
$this->shortDescription = $this->description;
}
}
}
if (empty($this->shortDescription) && $context !== null && !$hasInheritdoc) {
$context->errors[] = ['line' => $this->startLine, 'file' => $this->sourceFile, 'message' => "No short description for element '{$this->name}'"];
}
}