Commit 09cb5ad4429 for php.net
commit 09cb5ad4429913e80b9762aaf39a28a362a424c2
Author: Michael Telgmann <mitelg@users.noreply.github.com>
Date: Sat Dec 27 12:53:15 2025 +0100
fix: Allow variadic syntax in PHPDoc parameter annotation in `gen_stub.php` (#20342)
Closes #20277
Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
diff --git a/build/gen_stub.php b/build/gen_stub.php
index a83c6c13bf8..9d6bd2ce393 100755
--- a/build/gen_stub.php
+++ b/build/gen_stub.php
@@ -3323,7 +3323,7 @@ public function getType(): string {
$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 @@ public function getVariableName(): string {
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);
}