Skip to content

Commit 6904019

Browse files
committed
Merge branch 'PHP-8.2'
* PHP-8.2: Validate if the refpurpose and the description is in sync (#9510)
2 parents a289bb3 + e042297 commit 6904019

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

build/gen_stub.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4442,6 +4442,14 @@ function replaceMethodSynopses(string $targetDirectory, array $funcMap, array $a
44424442
echo "Warning: $aliasName()" . ($alias->alias ? " is an alias of " . $alias->alias->__toString() . "(), but it" : "") . " is incorrectly documented as an alias for $funcName()\n";
44434443
}
44444444

4445+
$matches = [];
4446+
preg_match("/<(?:para|simpara)>\s*(?:&info.function.alias;|&info.method.alias;|&Alias;)\s+<(?:function|methodname)>\s*([\w:]+)\s*<\/(?:function|methodname)>/i", $xml, $matches);
4447+
$descriptionFuncName = $matches[1] ?? null;
4448+
$descriptionFunc = $funcMap[$descriptionFuncName] ?? null;
4449+
if ($descriptionFunc && $funcName !== $descriptionFuncName) {
4450+
echo "Warning: Alias in the method synopsis description of $pathName doesn't match the alias in the <refpurpose>\n";
4451+
}
4452+
44454453
if ($aliasName) {
44464454
$existingMethodSynopses[$aliasName] = $aliasName;
44474455
}

0 commit comments

Comments
 (0)