/** * @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}'"]; } }
/** * @param \phpDocumentor\Reflection\FunctionReflector\ArgumentReflector $reflector * @param Context $context * @param array $config */ public function __construct($reflector = null, $context = null, $config = []) { parent::__construct($config); if ($reflector === null) { return; } $this->name = $reflector->getName(); $this->typeHint = $reflector->getType(); $this->isOptional = $reflector->getDefault() !== null; // bypass $reflector->getDefault() for short array syntax if ($reflector->getNode()->default) { $this->defaultValue = PrettyPrinter::getRepresentationOfValue($reflector->getNode()->default); } $this->isPassedByReference = $reflector->isByRef(); }