Skip to content

Commit b06f2bc

Browse files
committed
Improve documentation generation
- Really trim leading and trailing hyphens (single hyphens were not trimmed before) - Create the necesary directories for even namespaced methods when generating methodsynopsis
1 parent be69262 commit b06f2bc

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

build/gen_stub.php

+10-4
Original file line numberDiff line numberDiff line change
@@ -2610,7 +2610,7 @@ protected function getFieldSynopsisDefaultLinkend(): string
26102610
{
26112611
$className = str_replace(["\\", "_"], ["-", "-"], $this->name->class->toLowerString());
26122612

2613-
return "$className.constants." . strtolower(str_replace(["__", "_"], ["", "-"], $this->name->getDeclarationName()));
2613+
return "$className.constants." . strtolower(str_replace("_", "-", trim($this->name->getDeclarationName(), "_")));
26142614
}
26152615

26162616
protected function getFieldSynopsisName(): string
@@ -3052,7 +3052,7 @@ protected function getFieldSynopsisDefaultLinkend(): string
30523052
{
30533053
$className = str_replace(["\\", "_"], ["-", "-"], $this->name->class->toLowerString());
30543054

3055-
return "$className.props." . strtolower(str_replace(["__", "_"], ["", "-"], $this->name->getDeclarationName()));
3055+
return "$className.props." . strtolower(str_replace("_", "-", trim($this->name->getDeclarationName(), "_")));
30563056
}
30573057

30583058
protected function getFieldSynopsisName(): string
@@ -6424,8 +6424,14 @@ function(?ArgInfo $aliasArg, ?ArgInfo $aliasedArg) use ($aliasFunc, $aliasedFunc
64246424
}
64256425

64266426
foreach ($methodSynopses as $filename => $content) {
6427-
if (!file_exists("$manualTarget/$filename")) {
6428-
if (file_put_contents("$manualTarget/$filename", $content)) {
6427+
$path = "$manualTarget/$filename";
6428+
6429+
if (!file_exists($path)) {
6430+
if (!file_exists(dirname($path))) {
6431+
mkdir(dirname($path));
6432+
}
6433+
6434+
if (file_put_contents($path, $content)) {
64296435
echo "Saved $filename\n";
64306436
}
64316437
}

0 commit comments

Comments
 (0)