Merge branch 'PHP-8.2'

* PHP-8.2:
  Use PHP 7.4 syntax in gen_stub.php
This commit is contained in:
Máté Kocsis 2022-09-11 07:51:52 +02:00
commit ab6d449b3a
No known key found for this signature in database
GPG key ID: FD055E41728BF310

View file

@ -160,21 +160,17 @@ function extractStubHash(string $arginfoFile): ?string {
} }
class Context { class Context {
/** @var bool */ public bool $forceParse = false;
public $forceParse = false; public bool $forceRegeneration = false;
/** @var bool */
public $forceRegeneration = false;
/** @var iterable<ConstInfo> */ /** @var iterable<ConstInfo> */
public $allConstInfos = []; public iterable $allConstInfos = [];
/** @var FileInfo[] */ /** @var FileInfo[] */
public $parsedFiles = []; public array $parsedFiles = [];
} }
class ArrayType extends SimpleType { class ArrayType extends SimpleType {
/** @var Type */ public Type $keyType;
public $keyType; public Type $valueType;
/** @var Type */
public $valueType;
public static function createGenericArray(): self public static function createGenericArray(): self
{ {
@ -212,10 +208,8 @@ class ArrayType extends SimpleType {
} }
class SimpleType { class SimpleType {
/** @var string */ public string $name;
public $name; public bool $isBuiltin;
/** @var bool */
public $isBuiltin;
public static function fromNode(Node $node): SimpleType { public static function fromNode(Node $node): SimpleType {
if ($node instanceof Node\Name) { if ($node instanceof Node\Name) {
@ -552,9 +546,8 @@ class SimpleType {
class Type { class Type {
/** @var SimpleType[] */ /** @var SimpleType[] */
public $types; public array $types;
/** @var bool */ public bool $isIntersection;
public $isIntersection = false;
public static function fromNode(Node $node): Type { public static function fromNode(Node $node): Type {
if ($node instanceof Node\UnionType || $node instanceof Node\IntersectionType) { if ($node instanceof Node\UnionType || $node instanceof Node\IntersectionType) {
@ -780,10 +773,9 @@ class Type {
class ArginfoType { class ArginfoType {
/** @var SimpleType[] $classTypes */ /** @var SimpleType[] $classTypes */
public $classTypes; public array $classTypes;
/** @var SimpleType[] $builtinTypes */ /** @var SimpleType[] $builtinTypes */
private $builtinTypes; private array $builtinTypes;
/** /**
* @param SimpleType[] $classTypes * @param SimpleType[] $classTypes
@ -819,20 +811,14 @@ class ArgInfo {
const SEND_BY_REF = 1; const SEND_BY_REF = 1;
const SEND_PREFER_REF = 2; const SEND_PREFER_REF = 2;
/** @var string */ public string $name;
public $name; public int $sendBy;
/** @var int */ public bool $isVariadic;
public $sendBy; public ?Type $type;
/** @var bool */ public ?Type $phpDocType;
public $isVariadic; public ?string $defaultValue;
/** @var Type|null */
public $type;
/** @var Type|null */
public $phpDocType;
/** @var string|null */
public $defaultValue;
/** @var AttributeInfo[] */ /** @var AttributeInfo[] */
public $attributes; public array $attributes;
/** /**
* @param AttributeInfo[] $attributes * @param AttributeInfo[] $attributes
@ -943,8 +929,7 @@ abstract class AbstractConstName implements ConstOrClassConstName
} }
class ConstName extends AbstractConstName { class ConstName extends AbstractConstName {
/** @var string */ public string $const;
public $const;
public function __construct(string $const) public function __construct(string $const)
{ {
@ -963,10 +948,8 @@ class ConstName extends AbstractConstName {
} }
class ClassConstName extends AbstractConstName { class ClassConstName extends AbstractConstName {
/** @var Name */ public Name $class;
public $class; public string $const;
/** @var string */
public $const;
public function __construct(Name $class, string $const) public function __construct(Name $class, string $const)
{ {
@ -986,10 +969,8 @@ class ClassConstName extends AbstractConstName {
} }
class PropertyName { class PropertyName {
/** @var Name */ public Name $class;
public $class; public string $property;
/** @var string */
public $property;
public function __construct(Name $class, string $property) public function __construct(Name $class, string $property)
{ {
@ -1015,8 +996,7 @@ interface FunctionOrMethodName {
} }
class FunctionName implements FunctionOrMethodName { class FunctionName implements FunctionOrMethodName {
/** @var Name */ private Name $name;
private $name;
public function __construct(Name $name) { public function __construct(Name $name) {
$this->name = $name; $this->name = $name;
@ -1079,10 +1059,8 @@ class FunctionName implements FunctionOrMethodName {
} }
class MethodName implements FunctionOrMethodName { class MethodName implements FunctionOrMethodName {
/** @var Name */ public Name $className;
public $className; public string $methodName;
/** @var string */
public $methodName;
public function __construct(Name $className, string $methodName) { public function __construct(Name $className, string $methodName) {
$this->className = $className; $this->className = $className;
@ -1137,16 +1115,11 @@ class ReturnInfo {
self::REFCOUNT_N, self::REFCOUNT_N,
]; ];
/** @var bool */ public bool $byRef;
public $byRef; public ?Type $type;
/** @var Type|null */ public ?Type $phpDocType;
public $type; public bool $tentativeReturnType;
/** @var Type|null */ public string $refcount;
public $phpDocType;
/** @var bool */
public $tentativeReturnType;
/** @var string */
public $refcount;
public function __construct(bool $byRef, ?Type $type, ?Type $phpDocType, bool $tentativeReturnType, ?string $refcount) { public function __construct(bool $byRef, ?Type $type, ?Type $phpDocType, bool $tentativeReturnType, ?string $refcount) {
$this->byRef = $byRef; $this->byRef = $byRef;
@ -1198,32 +1171,20 @@ class ReturnInfo {
} }
class FuncInfo { class FuncInfo {
/** @var FunctionOrMethodName */ public FunctionOrMethodName $name;
public $name; public int $classFlags;
/** @var int */ public int $flags;
public $classFlags; public ?string $aliasType;
/** @var int */ public ?FunctionOrMethodName $alias;
public $flags; public bool $isDeprecated;
/** @var string|null */ public bool $supportsCompileTimeEval;
public $aliasType; public bool $verify;
/** @var FunctionName|null */
public $alias;
/** @var bool */
public $isDeprecated;
/** @var bool */
public $supportsCompileTimeEval;
/** @var bool */
public $verify;
/** @var ArgInfo[] */ /** @var ArgInfo[] */
public $args; public array $args;
/** @var ReturnInfo */ public ReturnInfo $return;
public $return; public int $numRequiredArgs;
/** @var int */ public ?string $cond;
public $numRequiredArgs; public bool $isUndocumentable;
/** @var string|null */
public $cond;
/** @var bool */
public $isUndocumentable;
/** /**
* @param ArgInfo[] $args * @param ArgInfo[] $args
@ -1608,18 +1569,10 @@ class EvaluatedValue
{ {
/** @var mixed */ /** @var mixed */
public $value; public $value;
public SimpleType $type;
/** @var SimpleType */ public ?string $cConstValue;
public $type; public bool $isUnknownConstValue;
public ?ConstInfo $originatingConst;
/** @var string|null */
public $cConstValue;
/** @var bool */
public $isUnknownConstValue;
/** @var ConstInfo|null */
public $originatingConst;
/** /**
* @param iterable<ConstInfo> $allConstInfos * @param iterable<ConstInfo> $allConstInfos
@ -1752,14 +1705,10 @@ class EvaluatedValue
abstract class VariableLike abstract class VariableLike
{ {
/** @var Type|null */ public ?Type $phpDocType;
public $phpDocType; public int $flags;
/** @var int */ public ?string $link;
public $flags; public ?int $phpVersionIdMinimumCompatibility;
/** @var string|null */
public $link;
/** @var int|null */
public $phpVersionIdMinimumCompatibility;
public function __construct( public function __construct(
int $flags, int $flags,
@ -1880,18 +1829,12 @@ abstract class VariableLike
class ConstInfo extends VariableLike class ConstInfo extends VariableLike
{ {
/** @var ConstOrClassConstName */ public ConstOrClassConstName $name;
public $name; public Expr $value;
/** @var Expr */ public bool $isDeprecated;
public $value; public ?string $valueString;
/** @var bool */ public ?string $cond;
public $isDeprecated; public ?string $cValue;
/** @var string|null */
public $valueString;
/** @var string|null */
public $cond;
/** @var string|null */
public $cValue;
public function __construct( public function __construct(
ConstOrClassConstName $name, ConstOrClassConstName $name,
@ -2146,16 +2089,11 @@ class ConstInfo extends VariableLike
class PropertyInfo extends VariableLike class PropertyInfo extends VariableLike
{ {
/** @var PropertyName */ public PropertyName $name;
public $name; public ?Type $type;
/** @var Type|null */ public ?Expr $defaultValue;
public $type; public ?string $defaultValueString;
/** @var Expr|null */ public bool $isDocReadonly;
public $defaultValue;
/** @var string|null */
public $defaultValueString;
/** @var bool */
public $isDocReadonly;
public function __construct( public function __construct(
PropertyName $name, PropertyName $name,
@ -2353,10 +2291,8 @@ class PropertyInfo extends VariableLike
} }
class EnumCaseInfo { class EnumCaseInfo {
/** @var string */ public string $name;
public $name; public ?Expr $value;
/** @var Expr|null */
public $value;
public function __construct(string $name, ?Expr $value) { public function __construct(string $name, ?Expr $value) {
$this->name = $name; $this->name = $name;
@ -2383,10 +2319,9 @@ class EnumCaseInfo {
} }
class AttributeInfo { class AttributeInfo {
/** @var string */ public string $class;
public $class;
/** @var \PhpParser\Node\Arg[] */ /** @var \PhpParser\Node\Arg[] */
public $args; public array $args;
/** @param \PhpParser\Node\Arg[] $args */ /** @param \PhpParser\Node\Arg[] $args */
public function __construct(string $class, array $args) { public function __construct(string $class, array $args) {
@ -2423,42 +2358,31 @@ class AttributeInfo {
} }
class ClassInfo { class ClassInfo {
/** @var Name */ public Name $name;
public $name; public int $flags;
/** @var int */ public string $type;
public $flags; public ?string $alias;
/** @var string */ public ?SimpleType $enumBackingType;
public $type; public bool $isDeprecated;
/** @var string|null */ public bool $isStrictProperties;
public $alias;
/** @var SimpleType|null */
public $enumBackingType;
/** @var bool */
public $isDeprecated;
/** @var bool */
public $isStrictProperties;
/** @var AttributeInfo[] */ /** @var AttributeInfo[] */
public $attributes; public array $attributes;
/** @var bool */ public bool $isNotSerializable;
public $isNotSerializable;
/** @var Name[] */ /** @var Name[] */
public $extends; public array $extends;
/** @var Name[] */ /** @var Name[] */
public $implements; public array $implements;
/** @var ConstInfo[] */ /** @var ConstInfo[] */
public $constInfos; public array $constInfos;
/** @var PropertyInfo[] */ /** @var PropertyInfo[] */
public $propertyInfos; public array $propertyInfos;
/** @var FuncInfo[] */ /** @var FuncInfo[] */
public $funcInfos; public array $funcInfos;
/** @var EnumCaseInfo[] */ /** @var EnumCaseInfo[] */
public $enumCaseInfos; public array $enumCaseInfos;
/** @var string|null */ public ?string $cond;
public $cond; public ?int $phpVersionIdMinimumCompatibility;
/** @var int|null */ public bool $isUndocumentable;
public $phpVersionIdMinimumCompatibility;
/** @var bool */
public $isUndocumentable;
/** /**
* @param AttributeInfo[] $attributes * @param AttributeInfo[] $attributes
@ -3081,23 +3005,18 @@ class ClassInfo {
class FileInfo { class FileInfo {
/** @var string[] */ /** @var string[] */
public $dependencies = []; public array $dependencies = [];
/** @var ConstInfo[] */ /** @var ConstInfo[] */
public $constInfos = []; public array $constInfos = [];
/** @var FuncInfo[] */ /** @var FuncInfo[] */
public $funcInfos = []; public array $funcInfos = [];
/** @var ClassInfo[] */ /** @var ClassInfo[] */
public $classInfos = []; public array $classInfos = [];
/** @var bool */ public bool $generateFunctionEntries = false;
public $generateFunctionEntries = false; public string $declarationPrefix = "";
/** @var string */ public ?int $generateLegacyArginfoForPhpVersionId = null;
public $declarationPrefix = ""; public bool $generateClassEntries = false;
/** @var int|null */ public bool $isUndocumentable = false;
public $generateLegacyArginfoForPhpVersionId;
/** @var bool */
public $generateClassEntries = false;
/** @var bool */
public $isUndocumentable = false;
/** /**
* @return iterable<FuncInfo> * @return iterable<FuncInfo>
@ -3144,10 +3063,8 @@ class FileInfo {
} }
class DocCommentTag { class DocCommentTag {
/** @var string */ public string $name;
public $name; public ?string $value;
/** @var string|null */
public $value;
public function __construct(string $name, ?string $value) { public function __construct(string $name, ?string $value) {
$this->name = $name; $this->name = $name;