diff --git a/build/gen_stub.php b/build/gen_stub.php index e5fbe4867525..fcf33cd0b9dd 100755 --- a/build/gen_stub.php +++ b/build/gen_stub.php @@ -2215,11 +2215,11 @@ public function toArgInfoCode(?int $minPHPCompatability): string { $this->numRequiredArgs, $minPHPCompatability === null || $minPHPCompatability >= PHP_81_VERSION_ID ); - + foreach ($this->args as $argInfo) { $code .= $argInfo->toZendInfo(); } - + $code .= "ZEND_END_ARG_INFO()"; return $code . "\n"; } @@ -4310,13 +4310,13 @@ protected function pName_FullyQualified(Name\FullyQualified $node): string { return implode('\\', $node->getParts()); } }; - + $stmts = $parser->parse($code); $nodeTraverser->traverse($stmts); - + $fileTags = DocCommentTag::parseDocComments(self::getFileDocComments($stmts)); $fileInfo = new FileInfo($fileTags); - + $fileInfo->handleStatements($stmts, $prettyPrinter); return $fileInfo; } @@ -4337,16 +4337,16 @@ private function handleStatements(array $stmts, PrettyPrinterAbstract $prettyPri $conds = []; foreach ($stmts as $stmt) { $cond = self::handlePreprocessorConditions($conds, $stmt); - + if ($stmt instanceof Stmt\Nop) { continue; } - + if ($stmt instanceof Stmt\Namespace_) { $this->handleStatements($stmt->stmts, $prettyPrinter); continue; } - + if ($stmt instanceof Stmt\Const_) { foreach ($stmt->consts as $const) { $this->constInfos[] = parseConstLike( @@ -4364,7 +4364,7 @@ private function handleStatements(array $stmts, PrettyPrinterAbstract $prettyPri } continue; } - + if ($stmt instanceof Stmt\Function_) { $this->funcInfos[] = parseFunctionLike( $prettyPrinter, @@ -4378,7 +4378,7 @@ private function handleStatements(array $stmts, PrettyPrinterAbstract $prettyPri ); continue; } - + if ($stmt instanceof Stmt\ClassLike) { $className = $stmt->namespacedName; $constInfos = []; @@ -4390,10 +4390,10 @@ private function handleStatements(array $stmts, PrettyPrinterAbstract $prettyPri if ($classStmt instanceof Stmt\Nop) { continue; } - + $classFlags = $stmt instanceof Class_ ? $stmt->flags : 0; $abstractFlag = $stmt instanceof Stmt\Interface_ ? Modifiers::ABSTRACT : 0; - + if ($classStmt instanceof Stmt\ClassConst) { foreach ($classStmt->consts as $const) { $constInfos[] = parseConstLike( @@ -4447,7 +4447,7 @@ private function handleStatements(array $stmts, PrettyPrinterAbstract $prettyPri throw new Exception("Not implemented {$classStmt->getType()}"); } } - + $this->classInfos[] = parseClass( $className, $stmt, @@ -4461,7 +4461,7 @@ private function handleStatements(array $stmts, PrettyPrinterAbstract $prettyPri ); continue; } - + if ($stmt instanceof Stmt\Expression) { $expr = $stmt->expr; if ($expr instanceof Expr\Include_) { @@ -4469,7 +4469,7 @@ private function handleStatements(array $stmts, PrettyPrinterAbstract $prettyPri continue; } } - + throw new Exception("Unexpected node {$stmt->getType()}"); } if (!empty($conds)) { @@ -4501,7 +4501,7 @@ private static function handlePreprocessorConditions(array &$conds, Stmt $stmt): throw new Exception("Unrecognized preprocessor directive \"$text\""); } } - + return empty($conds) ? null : implode(' && ', $conds); } @@ -4540,7 +4540,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); } @@ -4562,7 +4562,7 @@ public function getVariableName(): string { if ($this->name === "param") { // Allow for parsing extended types like callable(string):mixed in docblocks - preg_match('/^\s*(?[\w\|\\\\]+(?\((?(?:(?&parens)|[^(){}[\]<>]*+))++\)|\{(?&inparens)\}|\[(?&inparens)\]|<(?&inparens)>)*+(?::(?&type))?)\s*\$(?\w+).*$/', $value, $matches); + preg_match('/^\s*(?[\w\|\\\\]+(?\((?(?:(?&parens)|[^(){}[\]<>]*+))++\)|\{(?&inparens)\}|\[(?&inparens)\]|<(?&inparens)>)*+(?::(?&type))?)\s*(\.\.\.)?\$(?\w+).*$/', $value, $matches); } elseif ($this->name === "prefer-ref") { preg_match('/^\s*\$(?\w+).*$/', $value, $matches); }