Skip to content

Commit 2df4ade

Browse files
DanielEScherzerkocsismate
authored andcommitted
gen_stub: reduce the number of public properties
The following properties are made private: * `ArrayType::$keyType`, `::$valueType` * `ArginfoType::$builtinTypes` * `ConstName::$const` * `ClassConstName::$const` * `PropertyName::$property` * `FuncInfo::$classFlags`, `::$isDeprecated`, `::$supportsCompileTimeEval`, `::$minimumPhpVersionIdCompatibility`, `::$framelessFunctionInfos`, `::$exposedDocComment` * `VariableLike::$link` * `ConstInfo::$isDeprecated`, `::$valueString`, `::$isFileCacheAllowed` * `PropertyInfo::$classFlags`, `::$defaultValue`, `::$defaultValueString`, `::$isDocReadonly`, `::$isVirtual` * `EnumCaseInfo::$name`, `::$value` * `AttributeInfo::$args` * `ClassInfo::$enumBackingType`, `::$isDeprecated`, `::$exposedDocComment`, `::$isStrictProperties`, `::$isNotSerializable`, `::$propertyInfos`, `::$enumCaseInfos` The following are made protected: * `VariableLike::$exposedDocComment`, `::$phpVersionIdMinimumCompatibility`
1 parent 6d6ac81 commit 2df4ade

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

build/gen_stub.php

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ class Context {
185185
}
186186

187187
class ArrayType extends SimpleType {
188-
public /* readonly */ Type $keyType;
189-
public /* readonly */ Type $valueType;
188+
private /* readonly */ Type $keyType;
189+
private /* readonly */ Type $valueType;
190190

191191
public static function createGenericArray(): self
192192
{
@@ -877,7 +877,7 @@ public function isUnknown(): bool
877877
}
878878

879879
class ConstName extends AbstractConstName {
880-
public /* readonly */ string $const;
880+
private /* readonly */ string $const;
881881

882882
public function __construct(?Name $namespace, string $const)
883883
{
@@ -914,7 +914,7 @@ public function getDeclarationName(): string
914914

915915
class ClassConstName extends AbstractConstName {
916916
public /* readonly */ Name $class;
917-
public /* readonly */ string $const;
917+
private /* readonly */ string $const;
918918

919919
public function __construct(Name $class, string $const)
920920
{
@@ -940,7 +940,7 @@ public function getDeclarationName(): string
940940

941941
class PropertyName implements VariableLikeName {
942942
public /* readonly */ Name $class;
943-
public /* readonly */ string $property;
943+
private /* readonly */ string $property;
944944

945945
public function __construct(Name $class, string $property)
946946
{
@@ -1148,25 +1148,25 @@ private function setRefcount(?string $refcount): void
11481148

11491149
class FuncInfo {
11501150
public /* readonly */ FunctionOrMethodName $name;
1151-
public /* readonly */ int $classFlags;
1151+
private /* readonly */ int $classFlags;
11521152
public int $flags;
11531153
public /* readonly */ ?string $aliasType;
11541154
public ?FunctionOrMethodName $alias;
1155-
public /* readonly */ bool $isDeprecated;
1156-
public bool $supportsCompileTimeEval;
1155+
private /* readonly */ bool $isDeprecated;
1156+
private bool $supportsCompileTimeEval;
11571157
public /* readonly */ bool $verify;
11581158
/** @var ArgInfo[] */
11591159
public /* readonly */ array $args;
11601160
public /* readonly */ ReturnInfo $return;
11611161
public /* readonly */ int $numRequiredArgs;
11621162
public /* readonly */ ?string $cond;
11631163
public bool $isUndocumentable;
1164-
public ?int $minimumPhpVersionIdCompatibility;
1164+
private ?int $minimumPhpVersionIdCompatibility;
11651165
/** @var AttributeInfo[] */
11661166
public array $attributes;
11671167
/** @var FramelessFunctionInfo[] */
1168-
public array $framelessFunctionInfos;
1169-
public ?ExposedDocComment $exposedDocComment;
1168+
private array $framelessFunctionInfos;
1169+
private ?ExposedDocComment $exposedDocComment;
11701170

11711171
/**
11721172
* @param ArgInfo[] $args
@@ -2274,11 +2274,11 @@ abstract class VariableLike
22742274
public int $flags;
22752275
public ?Type $type;
22762276
public /* readonly */ ?Type $phpDocType;
2277-
public /* readonly */ ?string $link;
2278-
public ?int $phpVersionIdMinimumCompatibility;
2277+
private /* readonly */ ?string $link;
2278+
protected ?int $phpVersionIdMinimumCompatibility;
22792279
/** @var AttributeInfo[] */
22802280
public array $attributes;
2281-
public /* readonly */ ?ExposedDocComment $exposedDocComment;
2281+
protected /* readonly */ ?ExposedDocComment $exposedDocComment;
22822282

22832283
/**
22842284
* @var AttributeInfo[] $attributes
@@ -2456,12 +2456,12 @@ class ConstInfo extends VariableLike
24562456
{
24572457
public /* readonly */ AbstractConstName $name;
24582458
public /* readonly */ Expr $value;
2459-
public bool $isDeprecated;
2460-
public /* readonly */ ?string $valueString;
2459+
private bool $isDeprecated;
2460+
private /* readonly */ ?string $valueString;
24612461
public /* readonly */ ?string $cond;
24622462
public /* readonly */ ?string $cValue;
24632463
public /* readonly */ bool $isUndocumentable;
2464-
public /* readonly */ bool $isFileCacheAllowed;
2464+
private /* readonly */ bool $isFileCacheAllowed;
24652465

24662466
/**
24672467
* @var AttributeInfo[] $attributes
@@ -2814,12 +2814,12 @@ protected function addModifiersToFieldSynopsis(DOMDocument $doc, DOMElement $fie
28142814

28152815
class PropertyInfo extends VariableLike
28162816
{
2817-
public /* readonly */ int $classFlags;
2817+
private /* readonly */ int $classFlags;
28182818
public /* readonly */ PropertyName $name;
2819-
public /* readonly */ ?Expr $defaultValue;
2820-
public /* readonly */ ?string $defaultValueString;
2821-
public /* readonly */ bool $isDocReadonly;
2822-
public /* readonly */ bool $isVirtual;
2819+
private /* readonly */ ?Expr $defaultValue;
2820+
private /* readonly */ ?string $defaultValueString;
2821+
private /* readonly */ bool $isDocReadonly;
2822+
private /* readonly */ bool $isVirtual;
28232823

28242824
// Map possible variable names to the known string constant, see
28252825
// ZEND_KNOWN_STRINGS
@@ -3149,8 +3149,8 @@ public function __clone()
31493149
}
31503150

31513151
class EnumCaseInfo {
3152-
public /* readonly */ string $name;
3153-
public /* readonly */ ?Expr $value;
3152+
private /* readonly */ string $name;
3153+
private /* readonly */ ?Expr $value;
31543154

31553155
public function __construct(string $name, ?Expr $value) {
31563156
$this->name = $name;
@@ -3179,7 +3179,7 @@ public function getDeclaration(array $allConstInfos): string {
31793179
class AttributeInfo {
31803180
public /* readonly */ string $class;
31813181
/** @var \PhpParser\Node\Arg[] */
3182-
public /* readonly */ array $args;
3182+
private /* readonly */ array $args;
31833183

31843184
/** @param \PhpParser\Node\Arg[] $args */
31853185
public function __construct(string $class, array $args) {
@@ -3234,25 +3234,25 @@ class ClassInfo {
32343234
public int $flags;
32353235
public string $type;
32363236
public /* readonly */ ?string $alias;
3237-
public /* readonly */ ?SimpleType $enumBackingType;
3238-
public /* readonly */ bool $isDeprecated;
3239-
public bool $isStrictProperties;
3237+
private /* readonly */ ?SimpleType $enumBackingType;
3238+
private /* readonly */ bool $isDeprecated;
3239+
private bool $isStrictProperties;
32403240
/** @var AttributeInfo[] */
32413241
public array $attributes;
3242-
public ?ExposedDocComment $exposedDocComment;
3243-
public bool $isNotSerializable;
3242+
private ?ExposedDocComment $exposedDocComment;
3243+
private bool $isNotSerializable;
32443244
/** @var Name[] */
32453245
public /* readonly */ array $extends;
32463246
/** @var Name[] */
32473247
public /* readonly */ array $implements;
32483248
/** @var ConstInfo[] */
32493249
public /* readonly */ array $constInfos;
32503250
/** @var PropertyInfo[] */
3251-
public /* readonly */ array $propertyInfos;
3251+
private /* readonly */ array $propertyInfos;
32523252
/** @var FuncInfo[] */
32533253
public array $funcInfos;
32543254
/** @var EnumCaseInfo[] */
3255-
public /* readonly */ array $enumCaseInfos;
3255+
private /* readonly */ array $enumCaseInfos;
32563256
public /* readonly */ ?string $cond;
32573257
public ?int $phpVersionIdMinimumCompatibility;
32583258
public /* readonly */ bool $isUndocumentable;

0 commit comments

Comments
 (0)