3 namespace mdref\Generator
;
6 use phpDocumentor\Reflection\
{DocBlock
, DocBlock\Tags
};
8 class Prop
extends Scrap
{
9 public function __toString() : string {
10 return parent
::toString(__FILE__
, __COMPILER_HALT_OFFSET__
, [
11 "tag" => $this->getVarTag($this->ref
->getName())
17 /** @var $gen Generator */
18 /** @var $ref \ReflectionProperty */
19 /** @var $doc ?DocBlock */
20 /** @var $tag ?Tags\Param */
23 <?
= implode(" ", \Reflection
::getModifierNames($ref->getModifiers()))
24 ?
> <?
= $ref->hasType() ?
$ref->getType() : ($tag?
->getType() ??
"mixed")
25 ?
> $
<?
=$ref->getName() ?
><?php
26 if ($ref->hasDefaultValue()) :
27 ?
> = <?php
var_export($ref->getDefaultValue()) ?
><?php
28 elseif (($params = $ref->getDeclaringClass()->getConstructor()?
->getParameters())) :
29 foreach ($params as $param) :
30 if ($param->getName() === $ref->name
) :
31 if ($param->isDefaultValueAvailable()) :
32 ?
> = <?php
var_export($param->getDefaultValue()) ?
><?php
39 if (($desc = $doc?
->getSummary())) :