Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions build/gen_stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -3323,12 +3323,12 @@ public function getType(): string {
$matches = [];

if ($this->name === "param") {
preg_match('/^\s*([\w\|\\\\\[\]<>, ]+)\s*(?:[{(]|\$\w+).*$/', $value, $matches);
preg_match('/^\s*([\w\|\\\\\[\]<>, ]+)\s*(?<type>[{(]|(\.\.\.)?\$\w+).*$/', $value, $matches);
} elseif ($this->name === "return" || $this->name === "var") {
preg_match('/^\s*([\w\|\\\\\[\]<>, ]+)/', $value, $matches);
preg_match('/^\s*(?<type>[\w\|\\\\\[\]<>, ]+)/', $value, $matches);
}

if (!isset($matches[1])) {
if (!isset($matches["type"])) {
throw new Exception("@$this->name doesn't contain a type or has an invalid format \"$value\"");
}

Expand All @@ -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);
}
Expand Down
Loading