3 namespace mdref\Generator
;
6 use phpDocumentor\Reflection\DocBlock
;
8 class Cls
extends Scrap
{
9 public function __toString() :string {
10 return parent
::toString(__FILE__
, __COMPILER_HALT_OFFSET__
);
14 /** @var $gen Generator */
15 /** @var $ref \ReflectionClass */
16 /** @var $doc DocBlock */
17 /** @var $patch callable as function(string, \Reflector) */
21 if ($ref instanceof \ReflectionEnum
) :
24 ?
><?
= implode(" ", \Reflection
::getModifierNames($ref->getModifiers()));
25 ?
> <?
= $ref->isInterface() ?
"interface" : "class"
29 ?
> <?
= $ref->getName() ?
><?php
31 if (($parent = $ref->getParentClass())) :
32 ?
> extends <?
= $parent->getName() ?
><?php
34 if (($implements = $ref->getInterfaceNames())) : sort($implements);
35 ?
> implements <?
= implode(", ", $implements); ?
><?php
40 <?
= $doc?
->getSummary() ?
>
43 <?
= $doc?
->getDescription() ?
>
46 <?php
$patch(SeeAlso
::class, $ref) ?
>
53 if (!($consts = array_filter($ref->getReflectionConstants(), fn($rc) => $rc->getDeclaringClass()->getName() === $ref->getName()))) :
56 /** @var \ReflectionClassConstant $rc */
57 foreach ($consts as $rc) :
58 ?
> * <span
class="constant"><?
= $rc->getName();
59 ?
></span
> = <span
><?php
60 if ($rc->getValue() instanceof \UnitEnum
) :
61 var_export($rc->getValue()->value
);
63 var_export($rc->getValue());
75 if (!($props = array_filter($ref->getProperties(), fn($rp) => $rp->getDeclaringClass()->getName() === $ref->getName()))) :
78 foreach ($props as $rp) :
80 $patch(Prop
::class, $rp);