Skip to content

Commit 038b4b6

Browse files
committed
Merge branch 'PHP-8.1'
2 parents 4914ead + 73063db commit 038b4b6

File tree

1 file changed

+42
-3
lines changed

1 file changed

+42
-3
lines changed

build/gen_stub.php

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,16 @@ function processStubFile(string $stubFile, Context $context): ?FileInfo {
7171
}
7272

7373
if ($fileInfo->generateLegacyArginfo) {
74-
foreach ($fileInfo->getAllFuncInfos() as $funcInfo) {
74+
$legacyFileInfo = clone $fileInfo;
75+
76+
foreach ($legacyFileInfo->getAllFuncInfos() as $funcInfo) {
7577
$funcInfo->discardInfoForOldPhpVersions();
7678
}
77-
foreach ($fileInfo->getAllPropertyInfos() as $propertyInfo) {
79+
foreach ($legacyFileInfo->getAllPropertyInfos() as $propertyInfo) {
7880
$propertyInfo->discardInfoForOldPhpVersions();
7981
}
8082

81-
$arginfoCode = generateArgInfoCode($fileInfo, $stubHash);
83+
$arginfoCode = generateArgInfoCode($legacyFileInfo, $stubHash);
8284
if (($context->forceRegeneration || $stubHash !== $oldStubHash) && file_put_contents($legacyFile, $arginfoCode)) {
8385
echo "Saved $legacyFile\n";
8486
}
@@ -1324,6 +1326,14 @@ public function getMethodSynopsisElement(array $funcMap, array $aliasMap, DOMDoc
13241326

13251327
return $methodSynopsis;
13261328
}
1329+
1330+
public function __clone()
1331+
{
1332+
foreach ($this->args as $key => $argInfo) {
1333+
$this->args[$key] = clone $argInfo;
1334+
}
1335+
$this->return = clone $this->return;
1336+
}
13271337
}
13281338

13291339
function initializeZval(string $zvalName, $value): string
@@ -1555,6 +1565,13 @@ function (Expr $expr) use (&$defaultValueConstant) {
15551565

15561566
return $evaluator->evaluateDirectly($this->defaultValue);
15571567
}
1568+
1569+
public function __clone()
1570+
{
1571+
if ($this->type) {
1572+
$this->type = clone $this->type;
1573+
}
1574+
}
15581575
}
15591576

15601577
class EnumCaseInfo {
@@ -2045,6 +2062,17 @@ private function createIncludeElement(DOMDocument $doc, string $query): DOMEleme
20452062

20462063
return $includeElement;
20472064
}
2065+
2066+
public function __clone()
2067+
{
2068+
foreach ($this->propertyInfos as $key => $propertyInfo) {
2069+
$this->propertyInfos[$key] = clone $propertyInfo;
2070+
}
2071+
2072+
foreach ($this->funcInfos as $key => $funcInfo) {
2073+
$this->funcInfos[$key] = clone $funcInfo;
2074+
}
2075+
}
20482076
}
20492077

20502078
class FileInfo {
@@ -2079,6 +2107,17 @@ public function getAllPropertyInfos(): iterable {
20792107
yield from $classInfo->propertyInfos;
20802108
}
20812109
}
2110+
2111+
public function __clone()
2112+
{
2113+
foreach ($this->funcInfos as $key => $funcInfo) {
2114+
$this->funcInfos[$key] = clone $funcInfo;
2115+
}
2116+
2117+
foreach ($this->classInfos as $key => $classInfo) {
2118+
$this->classInfos[$key] = clone $classInfo;
2119+
}
2120+
}
20822121
}
20832122

20842123
class DocCommentTag {

0 commit comments

Comments
 (0)