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

Merge branch 'PHP-8.5'

* PHP-8.5:
  fix: Allow variadic syntax in PHPDoc parameter annotation in `gen_stub.php` (#20342)
This commit is contained in:
Máté Kocsis
2025-12-27 13:01:18 +01:00

View File

@@ -2215,11 +2215,11 @@ OUPUT_EXAMPLE
$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 @@ class FileInfo {
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 @@ class FileInfo {
$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 @@ class FileInfo {
}
continue;
}
if ($stmt instanceof Stmt\Function_) {
$this->funcInfos[] = parseFunctionLike(
$prettyPrinter,
@@ -4378,7 +4378,7 @@ class FileInfo {
);
continue;
}
if ($stmt instanceof Stmt\ClassLike) {
$className = $stmt->namespacedName;
$constInfos = [];
@@ -4390,10 +4390,10 @@ class FileInfo {
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 @@ class FileInfo {
throw new Exception("Not implemented {$classStmt->getType()}");
}
}
$this->classInfos[] = parseClass(
$className,
$stmt,
@@ -4461,7 +4461,7 @@ class FileInfo {
);
continue;
}
if ($stmt instanceof Stmt\Expression) {
$expr = $stmt->expr;
if ($expr instanceof Expr\Include_) {
@@ -4469,7 +4469,7 @@ class FileInfo {
continue;
}
}
throw new Exception("Unexpected node {$stmt->getType()}");
}
if (!empty($conds)) {
@@ -4501,7 +4501,7 @@ class FileInfo {
throw new Exception("Unrecognized preprocessor directive \"$text\"");
}
}
return empty($conds) ? null : implode(' && ', $conds);
}
@@ -4540,7 +4540,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);
}
@@ -4562,7 +4562,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)\]|<(?&inparens)>)*+(?::(?&type))?)\s*\$(?<name>\w+).*$/', $value, $matches);
preg_match('/^\s*(?<type>[\w\|\\\\]+(?<parens>\((?<inparens>(?:(?&parens)|[^(){}[\]<>]*+))++\)|\{(?&inparens)\}|\[(?&inparens)\]|<(?&inparens)>)*+(?::(?&type))?)\s*(\.\.\.)?\$(?<name>\w+).*$/', $value, $matches);
} elseif ($this->name === "prefer-ref") {
preg_match('/^\s*\$(?<name>\w+).*$/', $value, $matches);
}