Skip to content

Commit 5636c59

Browse files
Revert REFCOUNT_SCALAR name, document redundant refcount
1 parent 3caf15a commit 5636c59

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

build/gen_stub.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,9 +1155,7 @@ public function isDestructor(): bool {
11551155
}
11561156

11571157
class ReturnInfo {
1158-
// REFCOUNT_SCALAR (formerly REFCOUNT_0) is automatically applied for
1159-
// scalars, and not allowed for non-scalars
1160-
const REFCOUNT_SCALAR = "0";
1158+
const REFCOUNT_0 = "0";
11611159
const REFCOUNT_1 = "1";
11621160
const REFCOUNT_N = "N";
11631161

@@ -1201,12 +1199,14 @@ private function setRefcount(?string $refcount): void
12011199
$isScalarType = $type !== null && $type->isScalar();
12021200

12031201
if ($refcount === null) {
1204-
$this->refcount = $isScalarType ? self::REFCOUNT_SCALAR : self::REFCOUNT_N;
1202+
$this->refcount = $isScalarType ? self::REFCOUNT_0 : self::REFCOUNT_N;
12051203
return;
12061204
}
12071205

12081206
if ($isScalarType) {
1209-
throw new Exception("@refcount is not permitted on functions returning scalar values");
1207+
throw new Exception(
1208+
"@refcount on functions returning scalar values is redundant and not permitted"
1209+
);
12101210
}
12111211

12121212
if (!in_array($refcount, ReturnInfo::REFCOUNTS_NONSCALAR, true)) {

0 commit comments

Comments
 (0)