1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

fix: Allow variadic syntax in PHPDoc parameter annotation in gen_stub.php (#20342)

Closes #20277

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
This commit is contained in:
Michael Telgmann
2025-12-27 12:53:15 +01:00
committed by GitHub
parent 99ed66b49f
commit 09cb5ad442

View File

@@ -3323,7 +3323,7 @@ class DocCommentTag {
$matches = [];
if ($this->name === "param") {
preg_match('/^\s*([\w\|\\\\\[\]<>, ]+)\s*(?:[{(]|\$\w+).*$/', $value, $matches);
preg_match('/^\s*([\w\|\\\\\[\]<>, ]+)\s*(?:[{(]|(\.\.\.)?\$\w+).*$/', $value, $matches);
} elseif ($this->name === "return" || $this->name === "var") {
preg_match('/^\s*([\w\|\\\\\[\]<>, ]+)/', $value, $matches);
}
@@ -3345,7 +3345,7 @@ class DocCommentTag {
if ($this->name === "param") {
// Allow for parsing extended types like callable(string):mixed in docblocks
preg_match('/^\s*(?<type>[\w\|\\\\]+(?<parens>\((?<inparens>(?:(?&parens)|[^(){}[\]]*+))++\)|\{(?&inparens)\}|\[(?&inparens)\])*+(?::(?&type))?)\s*\$(?<name>\w+).*$/', $value, $matches);
preg_match('/^\s*(?<type>[\w\|\\\\]+(?<parens>\((?<inparens>(?:(?&parens)|[^(){}[\]]*+))++\)|\{(?&inparens)\}|\[(?&inparens)\])*+(?::(?&type))?)\s*(\.\.\.)?\$(?<name>\w+).*$/', $value, $matches);
} elseif ($this->name === "prefer-ref") {
preg_match('/^\s*\$(?<name>\w+).*$/', $value, $matches);
}