Skip to content

Commit 09cb5ad

Browse files
mitelgiluuu1994
andauthored
fix: Allow variadic syntax in PHPDoc parameter annotation in gen_stub.php (php#20342)
Closes php#20277 Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
1 parent 99ed66b commit 09cb5ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

build/gen_stub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3323,7 +3323,7 @@ public function getType(): string {
33233323
$matches = [];
33243324

33253325
if ($this->name === "param") {
3326-
preg_match('/^\s*([\w\|\\\\\[\]<>, ]+)\s*(?:[{(]|\$\w+).*$/', $value, $matches);
3326+
preg_match('/^\s*([\w\|\\\\\[\]<>, ]+)\s*(?:[{(]|(\.\.\.)?\$\w+).*$/', $value, $matches);
33273327
} elseif ($this->name === "return" || $this->name === "var") {
33283328
preg_match('/^\s*([\w\|\\\\\[\]<>, ]+)/', $value, $matches);
33293329
}
@@ -3345,7 +3345,7 @@ public function getVariableName(): string {
33453345

33463346
if ($this->name === "param") {
33473347
// Allow for parsing extended types like callable(string):mixed in docblocks
3348-
preg_match('/^\s*(?<type>[\w\|\\\\]+(?<parens>\((?<inparens>(?:(?&parens)|[^(){}[\]]*+))++\)|\{(?&inparens)\}|\[(?&inparens)\])*+(?::(?&type))?)\s*\$(?<name>\w+).*$/', $value, $matches);
3348+
preg_match('/^\s*(?<type>[\w\|\\\\]+(?<parens>\((?<inparens>(?:(?&parens)|[^(){}[\]]*+))++\)|\{(?&inparens)\}|\[(?&inparens)\])*+(?::(?&type))?)\s*(\.\.\.)?\$(?<name>\w+).*$/', $value, $matches);
33493349
} elseif ($this->name === "prefer-ref") {
33503350
preg_match('/^\s*\$(?<name>\w+).*$/', $value, $matches);
33513351
}

0 commit comments

Comments
 (0)