Skip to content

Commit 9c25df1

Browse files
committed
Fix missing mutating flag on internal test
1 parent 8ad32d0 commit 9c25df1

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

build/gen_stub.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,7 @@ class FuncInfo {
11761176
/** @var FramelessFunctionInfo[] */
11771177
private array $framelessFunctionInfos;
11781178
private ?ExposedDocComment $exposedDocComment;
1179+
private bool $isMutating;
11791180

11801181
/**
11811182
* @param ArgInfo[] $args
@@ -1199,7 +1200,8 @@ public function __construct(
11991200
?int $minimumPhpVersionIdCompatibility,
12001201
array $attributes,
12011202
array $framelessFunctionInfos,
1202-
?ExposedDocComment $exposedDocComment
1203+
?ExposedDocComment $exposedDocComment,
1204+
bool $isMutating,
12031205
) {
12041206
$this->name = $name;
12051207
$this->classFlags = $classFlags;
@@ -1218,6 +1220,7 @@ public function __construct(
12181220
$this->attributes = $attributes;
12191221
$this->framelessFunctionInfos = $framelessFunctionInfos;
12201222
$this->exposedDocComment = $exposedDocComment;
1223+
$this->isMutating = $isMutating;
12211224
if ($return->tentativeReturnType && $this->isFinalMethod()) {
12221225
throw new Exception("Tentative return inapplicable for final method");
12231226
}
@@ -1518,6 +1521,10 @@ private function getArginfoFlagsByPhpVersions(): array
15181521
$flags[] = "ZEND_ACC_DEPRECATED";
15191522
}
15201523

1524+
if ($this->isMutating) {
1525+
$flags[] = "ZEND_ACC_MUTATING";
1526+
}
1527+
15211528
foreach ($this->attributes as $attr) {
15221529
switch ($attr->class) {
15231530
case "Deprecated":
@@ -4344,6 +4351,7 @@ function parseFunctionLike(
43444351
$docParamTypes = [];
43454352
$refcount = null;
43464353
$framelessFunctionInfos = [];
4354+
$isMutating = false;
43474355

43484356
if ($comments) {
43494357
$tags = parseDocComments($comments);
@@ -4404,6 +4412,10 @@ function parseFunctionLike(
44044412
case 'frameless-function':
44054413
$framelessFunctionInfos[] = new FramelessFunctionInfo($tag->getValue());
44064414
break;
4415+
4416+
case 'mutating':
4417+
$isMutating = true;
4418+
break;
44074419
}
44084420
}
44094421
}
@@ -4507,7 +4519,8 @@ function parseFunctionLike(
45074519
$minimumPhpVersionIdCompatibility,
45084520
AttributeInfo::createFromGroups($func->attrGroups),
45094521
$framelessFunctionInfos,
4510-
ExposedDocComment::extractExposedComment($comments)
4522+
ExposedDocComment::extractExposedComment($comments),
4523+
$isMutating,
45114524
);
45124525
} catch (Exception $e) {
45134526
throw new Exception($name . "(): " .$e->getMessage());

ext/zend_test/test.stub.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ public static function callStatic(): void {}
181181
class ZendTestBox {
182182
public mixed $value;
183183

184-
public /* mutating */ function setNull(): void {}
184+
/** @mutating */
185+
public function setNull(): void {}
185186
}
186187

187188
enum ZendTestUnitEnum {

ext/zend_test/test_arginfo.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/zend_test/tests/structs.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $copy->value++;
1212
var_dump($box);
1313
var_dump($copy);
1414
$copy = $box;
15-
$copy->setNull();
15+
$copy->setNull!();
1616
var_dump($box);
1717
var_dump($copy);
1818

0 commit comments

Comments
 (0)