Skip to content
Merged
Changes from all commits
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
36 changes: 18 additions & 18 deletions build/gen_stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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(
Expand All @@ -4364,7 +4364,7 @@ private function handleStatements(array $stmts, PrettyPrinterAbstract $prettyPri
}
continue;
}

if ($stmt instanceof Stmt\Function_) {
$this->funcInfos[] = parseFunctionLike(
$prettyPrinter,
Expand All @@ -4378,7 +4378,7 @@ private function handleStatements(array $stmts, PrettyPrinterAbstract $prettyPri
);
continue;
}

if ($stmt instanceof Stmt\ClassLike) {
$className = $stmt->namespacedName;
$constInfos = [];
Expand All @@ -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(
Expand Down Expand Up @@ -4447,7 +4447,7 @@ private function handleStatements(array $stmts, PrettyPrinterAbstract $prettyPri
throw new Exception("Not implemented {$classStmt->getType()}");
}
}

$this->classInfos[] = parseClass(
$className,
$stmt,
Expand All @@ -4461,15 +4461,15 @@ private function handleStatements(array $stmts, PrettyPrinterAbstract $prettyPri
);
continue;
}

if ($stmt instanceof Stmt\Expression) {
$expr = $stmt->expr;
if ($expr instanceof Expr\Include_) {
$this->dependencies[] = (string)EvaluatedValue::createFromExpression($expr->expr, null, null, [])->value;
continue;
}
}

throw new Exception("Unexpected node {$stmt->getType()}");
}
if (!empty($conds)) {
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}
Expand All @@ -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*(?<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);
}
Expand Down