Skip to content

Commit e328c68

Browse files
authored
Rename @cname to @cvalue in stubs (#9043)
@cname currently refers to the constant name in C. However, it is not always a (constant) name, but sometimes a function invocation, so naming it as @cvalue would be more appropriate.
1 parent 1416961 commit e328c68

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+701
-701
lines changed

Zend/zend_attributes.stub.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,42 @@ final class Attribute
77
{
88
/**
99
* @var int
10-
* @cname ZEND_ATTRIBUTE_TARGET_CLASS
10+
* @cvalue ZEND_ATTRIBUTE_TARGET_CLASS
1111
*/
1212
const TARGET_CLASS = UNKNOWN;
1313
/**
1414
* @var int
15-
* @cname ZEND_ATTRIBUTE_TARGET_FUNCTION
15+
* @cvalue ZEND_ATTRIBUTE_TARGET_FUNCTION
1616
*/
1717
const TARGET_FUNCTION = UNKNOWN;
1818
/**
1919
* @var int
20-
* @cname ZEND_ATTRIBUTE_TARGET_METHOD
20+
* @cvalue ZEND_ATTRIBUTE_TARGET_METHOD
2121
*/
2222
const TARGET_METHOD = UNKNOWN;
2323
/**
2424
* @var int
25-
* @cname ZEND_ATTRIBUTE_TARGET_PROPERTY
25+
* @cvalue ZEND_ATTRIBUTE_TARGET_PROPERTY
2626
*/
2727
const TARGET_PROPERTY = UNKNOWN;
2828
/**
2929
* @var int
30-
* @cname ZEND_ATTRIBUTE_TARGET_CLASS_CONST
30+
* @cvalue ZEND_ATTRIBUTE_TARGET_CLASS_CONST
3131
*/
3232
const TARGET_CLASS_CONSTANT = UNKNOWN;
3333
/**
3434
* @var int
35-
* @cname ZEND_ATTRIBUTE_TARGET_PARAMETER
35+
* @cvalue ZEND_ATTRIBUTE_TARGET_PARAMETER
3636
*/
3737
const TARGET_PARAMETER = UNKNOWN;
3838
/**
3939
* @var int
40-
* @cname ZEND_ATTRIBUTE_TARGET_ALL
40+
* @cvalue ZEND_ATTRIBUTE_TARGET_ALL
4141
*/
4242
const TARGET_ALL = UNKNOWN;
4343
/**
4444
* @var int
45-
* @cname ZEND_ATTRIBUTE_IS_REPEATABLE
45+
* @cvalue ZEND_ATTRIBUTE_IS_REPEATABLE
4646
*/
4747
const IS_REPEATABLE = UNKNOWN;
4848

Zend/zend_attributes_arginfo.h

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Zend/zend_constants.stub.php

+16-16
Original file line numberDiff line numberDiff line change
@@ -4,96 +4,96 @@
44

55
/**
66
* @var int
7-
* @cname E_ERROR
7+
* @cvalue E_ERROR
88
*/
99
const E_ERROR = UNKNOWN;
1010

1111
/**
1212
* @var int
13-
* @cname E_WARNING
13+
* @cvalue E_WARNING
1414
*/
1515
const E_WARNING = UNKNOWN;
1616

1717
/**
1818
* @var int
19-
* @cname E_PARSE
19+
* @cvalue E_PARSE
2020
*/
2121
const E_PARSE = UNKNOWN;
2222

2323
/**
2424
* @var int
25-
* @cname E_NOTICE
25+
* @cvalue E_NOTICE
2626
*/
2727
const E_NOTICE = UNKNOWN;
2828

2929
/**
3030
* @var int
31-
* @cname E_CORE_ERROR
31+
* @cvalue E_CORE_ERROR
3232
*/
3333
const E_CORE_ERROR = UNKNOWN;
3434

3535
/**
3636
* @var int
37-
* @cname E_CORE_WARNING
37+
* @cvalue E_CORE_WARNING
3838
*/
3939
const E_CORE_WARNING = UNKNOWN;
4040

4141
/**
4242
* @var int
43-
* @cname E_COMPILE_ERROR
43+
* @cvalue E_COMPILE_ERROR
4444
*/
4545
const E_COMPILE_ERROR = UNKNOWN;
4646

4747
/**
4848
* @var int
49-
* @cname E_COMPILE_WARNING
49+
* @cvalue E_COMPILE_WARNING
5050
*/
5151
const E_COMPILE_WARNING = UNKNOWN;
5252

5353
/**
5454
* @var int
55-
* @cname E_USER_ERROR
55+
* @cvalue E_USER_ERROR
5656
*/
5757
const E_USER_ERROR = UNKNOWN;
5858

5959
/**
6060
* @var int
61-
* @cname E_USER_WARNING
61+
* @cvalue E_USER_WARNING
6262
*/
6363
const E_USER_WARNING = UNKNOWN;
6464

6565
/**
6666
* @var int
67-
* @cname E_USER_NOTICE
67+
* @cvalue E_USER_NOTICE
6868
*/
6969
const E_USER_NOTICE = UNKNOWN;
7070

7171
/**
7272
* @var int
73-
* @cname E_STRICT
73+
* @cvalue E_STRICT
7474
*/
7575
const E_STRICT = UNKNOWN;
7676

7777
/**
7878
* @var int
79-
* @cname E_RECOVERABLE_ERROR
79+
* @cvalue E_RECOVERABLE_ERROR
8080
*/
8181
const E_RECOVERABLE_ERROR = UNKNOWN;
8282

8383
/**
8484
* @var int
85-
* @cname E_DEPRECATED
85+
* @cvalue E_DEPRECATED
8686
*/
8787
const E_DEPRECATED = UNKNOWN;
8888

8989
/**
9090
* @var int
91-
* @cname E_USER_DEPRECATED
91+
* @cvalue E_USER_DEPRECATED
9292
*/
9393
const E_USER_DEPRECATED = UNKNOWN;
9494

9595
/**
9696
* @var int
97-
* @cname E_ALL
97+
* @cvalue E_ALL
9898
*/
9999
const E_ALL = UNKNOWN;

Zend/zend_constants_arginfo.h

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/gen_stub.php

+23-23
Original file line numberDiff line numberDiff line change
@@ -1594,7 +1594,7 @@ class EvaluatedValue
15941594
public $type;
15951595

15961596
/** @var string|null */
1597-
public $cConstName;
1597+
public $cConstValue;
15981598

15991599
/** @var bool */
16001600
public $isUnknownConstValue;
@@ -1671,7 +1671,7 @@ private function __construct($value, SimpleType $type, ?string $cConstName, ?Con
16711671
{
16721672
$this->value = $value;
16731673
$this->type = $type;
1674-
$this->cConstName = $cConstName;
1674+
$this->cConstValue = $cConstName;
16751675
$this->originatingConst = $originatingConst;
16761676
$this->isUnknownConstValue = $isUnknownConstValue;
16771677
}
@@ -1719,8 +1719,8 @@ public function initializeZval(string $zvalName, iterable $allConstInfos): strin
17191719
*/
17201720
public function getCConstValue(iterable $allConstInfos): ?string
17211721
{
1722-
if ($this->cConstName) {
1723-
return $this->cConstName;
1722+
if ($this->cConstValue) {
1723+
return $this->cConstValue;
17241724
}
17251725

17261726
if ($this->originatingConst) {
@@ -1872,7 +1872,7 @@ class ConstInfo extends VariableLike
18721872
/** @var string|null */
18731873
public $cond;
18741874
/** @var string|null */
1875-
public $cname;
1875+
public $cValue;
18761876

18771877
public function __construct(
18781878
ConstOrClassConstName $name,
@@ -1882,7 +1882,7 @@ public function __construct(
18821882
?Type $phpDocType,
18831883
bool $isDeprecated,
18841884
?string $cond,
1885-
?string $cname,
1885+
?string $cValue,
18861886
?string $link,
18871887
?int $phpVersionIdMinimumCompatibility
18881888
) {
@@ -1891,7 +1891,7 @@ public function __construct(
18911891
$this->valueString = $valueString;
18921892
$this->isDeprecated = $isDeprecated;
18931893
$this->cond = $cond;
1894-
$this->cname = $cname;
1894+
$this->cValue = $cValue;
18951895
parent::__construct($flags, $phpDocType, $link, $phpVersionIdMinimumCompatibility);
18961896
}
18971897

@@ -1903,7 +1903,7 @@ public function getValue(iterable $allConstInfos): EvaluatedValue
19031903
return EvaluatedValue::createFromExpression(
19041904
$this->value,
19051905
$this->phpDocType->tryToSimpleType(),
1906-
$this->cname,
1906+
$this->cValue,
19071907
$allConstInfos
19081908
);
19091909
}
@@ -1948,7 +1948,7 @@ protected function addTypeToFieldSynopsis(DOMDocument $doc, DOMElement $fieldsyn
19481948
*/
19491949
protected function getFieldSynopsisValueString(iterable $allConstInfos): ?string
19501950
{
1951-
$value = EvaluatedValue::createFromExpression($this->value, null, $this->cname, $allConstInfos);
1951+
$value = EvaluatedValue::createFromExpression($this->value, null, $this->cValue, $allConstInfos);
19521952
if ($value->originatingConst) {
19531953
return $value->originatingConst->getFieldSynopsisValueString($allConstInfos);
19541954
}
@@ -1971,9 +1971,9 @@ public function getDeclaration(iterable $allConstInfos): string
19711971
throw new Exception("Constant " . $this->name->__toString() . " must have a simple built-in type");
19721972
}
19731973

1974-
$value = EvaluatedValue::createFromExpression($this->value, $type, $this->cname, $allConstInfos);
1975-
if ($value->isUnknownConstValue && !$value->cConstName) {
1976-
throw new Exception("Constant " . $this->name->__toString() . " must have a @cname annotation");
1974+
$value = EvaluatedValue::createFromExpression($this->value, $type, $this->cValue, $allConstInfos);
1975+
if ($value->isUnknownConstValue && !$value->cConstValue) {
1976+
throw new Exception("Constant " . $this->name->__toString() . " must have a @cvalue annotation");
19771977
}
19781978

19791979
$code = "";
@@ -2059,35 +2059,35 @@ private function getClassConstDeclaration(EvaluatedValue $value, iterable $allCo
20592059

20602060
private function getValueAssertion(EvaluatedValue $value): string
20612061
{
2062-
if ($value->isUnknownConstValue || $value->originatingConst || $value->cConstName === null) {
2062+
if ($value->isUnknownConstValue || $value->originatingConst || $value->cConstValue === null) {
20632063
return "";
20642064
}
20652065

2066-
$cName = $value->cConstName;
2066+
$cConstValue = $value->cConstValue;
20672067
$constValue = $value->value;
20682068

20692069
if ($value->type->isNull()) {
2070-
return "\tZEND_ASSERT($cName == NULL);\n";
2070+
return "\tZEND_ASSERT($cConstValue == NULL);\n";
20712071
}
20722072

20732073
if ($value->type->isBool()) {
20742074
$cValue = $constValue ? "true" : "false";
2075-
return "\tZEND_ASSERT($cName == $cValue);\n";
2075+
return "\tZEND_ASSERT($cConstValue == $cValue);\n";
20762076
}
20772077

20782078
if ($value->type->isInt()) {
20792079
$cValue = (int) $constValue;
2080-
return "\tZEND_ASSERT($cName == $cValue);\n";
2080+
return "\tZEND_ASSERT($cConstValue == $cValue);\n";
20812081
}
20822082

20832083
if ($value->type->isFloat()) {
20842084
$cValue = (float) $constValue;
2085-
return "\tZEND_ASSERT($cName == $cValue);\n";
2085+
return "\tZEND_ASSERT($cConstValue == $cValue);\n";
20862086
}
20872087

20882088
if ($value->type->isString()) {
20892089
$cValue = '"' . addslashes($constValue) . '"';
2090-
return "\tZEND_ASSERT(strcmp($cName, $cValue) == 0);\n";
2090+
return "\tZEND_ASSERT(strcmp($cConstValue, $cValue) == 0);\n";
20912091
}
20922092

20932093
throw new Exception("Unimplemented constant type");
@@ -3376,7 +3376,7 @@ function parseConstLike(
33763376
): ConstInfo {
33773377
$phpDocType = null;
33783378
$deprecated = false;
3379-
$cname = null;
3379+
$cValue = null;
33803380
$link = null;
33813381
if ($docComment) {
33823382
$tags = parseDocComment($docComment);
@@ -3385,8 +3385,8 @@ function parseConstLike(
33853385
$phpDocType = $tag->getType();
33863386
} elseif ($tag->name === 'deprecated') {
33873387
$deprecated = true;
3388-
} elseif ($tag->name === 'cname') {
3389-
$cname = $tag->value;
3388+
} elseif ($tag->name === 'cvalue') {
3389+
$cValue = $tag->value;
33903390
} elseif ($tag->name === 'link') {
33913391
$link = $tag->value;
33923392
}
@@ -3405,7 +3405,7 @@ function parseConstLike(
34053405
Type::fromString($phpDocType),
34063406
$deprecated,
34073407
$cond,
3408-
$cname,
3408+
$cValue,
34093409
$link,
34103410
$phpVersionIdMinimumCompatibility
34113411
);

0 commit comments

Comments
 (0)