Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fededda

Browse files
committed
Escape < and > in parameter descriptions, could be PHPStan templates
1 parent 1dad3a1 commit fededda

File tree

2 files changed

+5
-35
lines changed

2 files changed

+5
-35
lines changed

‎src/PHPFUI/InstaDoc/Section/CodeCommon.php‎

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public function getValueString(mixed $value) : string
189189
/**
190190
* Format comments without indentation
191191
* @template T of \ReflectionClass
192-
* @param \ReflectionMethod | \ReflectionClass<T> | null $reflection
192+
* @param \ReflectionMethod | \ReflectionClass<T> | null $reflection if \ReflectionClass, then grab the comments from the class header
193193
*/
194194
protected function formatComments(?\phpDocumentor\Reflection\DocBlock $docBlock, \ReflectionMethod | \ReflectionClass | null $reflection = null) : string
195195
{
@@ -285,7 +285,7 @@ protected function formatComments(?\phpDocumentor\Reflection\DocBlock $docBlock,
285285
$body .= $this->getColor('variable', '$' . $varname) . '';
286286
}
287287
}
288-
$body .= $this->parsedown->html($description);
288+
$body .= $this->parsedown->html(\str_replace(['<', '>'], ['&lt;', '&gt;'], $description));
289289
$ul->addItem(new \PHPFUI\ListItem($this->getColor('name', $name) . '' . $this->getColor('description', $body)));
290290
}
291291

@@ -420,7 +420,7 @@ protected function getHtmlClass(string $class) : string
420420

421421
/**
422422
* @template T of \ReflectionClass
423-
* @param \ReflectionMethod | \ReflectionClass<T> | null $reflection
423+
* @param \ReflectionMethod | \ReflectionClass<T> | null $reflection if \ReflectionClass, then grab the comments from the class header
424424
*/
425425
protected function getInheritedText(\phpDocumentor\Reflection\DocBlock $docBlock, \ReflectionMethod | \ReflectionClass | null $reflection = null, string $textType = 'getDescription') : string
426426
{
@@ -494,7 +494,7 @@ protected function getInheritedText(\phpDocumentor\Reflection\DocBlock $docBlock
494494
/**
495495
* @param array<int, \phpDocumentor\Reflection\DocBlock\Tag> $tags
496496
* @template T of \ReflectionClass
497-
* @param \ReflectionMethod | \ReflectionClass<T> | null $reflection
497+
* @param \ReflectionMethod | \ReflectionClass<T> | null $reflection if \ReflectionClass, then grab the comments from the class header
498498
*
499499
* @return array<int, \phpDocumentor\Reflection\DocBlock\Tag>
500500
*/
@@ -646,36 +646,6 @@ protected function formatAttribute(\ReflectionAttribute $attribute) : string
646646
}
647647

648648
$targeting = '';
649-
/*
650-
651-
Not sure how useful this is, so commenting out for now.
652-
653-
$target = $attribute->getTarget();
654-
$targets = [];
655-
$definedTargets = [
656-
"CLASS" => \Attribute::TARGET_CLASS,
657-
"FUNCTION" => \Attribute::TARGET_FUNCTION,
658-
"METHOD" => \Attribute::TARGET_METHOD,
659-
"PROPERTY" => \Attribute::TARGET_PROPERTY,
660-
"CLASS_CONSTANT" => \Attribute::TARGET_CLASS_CONSTANT,
661-
"PARAMETER" => \Attribute::TARGET_PARAMETER,
662-
];
663-
foreach ($definedTargets as $name => $value)
664-
{
665-
if ($target & $value)
666-
{
667-
$targets[] = '\\Attribute::TARGET_' . $name;
668-
}
669-
}
670-
if ($attribute->isRepeated())
671-
{
672-
$targets[] = '\\Attribute::IS_REPEATABLE';
673-
}
674-
if ($targets)
675-
{
676-
$targeting = ' ' . implode(' | ', $targets);
677-
}
678-
*/
679649

680650
return $this->getClassName($attribute->getName()) . $parameters . $targeting;
681651
}

‎src/PHPFUI/InstaDoc/Tests/Test81.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/**
66
* A test class with no functionality.
77
*
8-
* It is just to test InstaDoc
8+
* <b>It is just to test InstaDoc</b>
99
*
1010
* @author bruce (11/27/2021)
1111
*/

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /