Skip to content

Commit

Permalink
Merge pull request #7012 from weirdan/enum-stubs-and-callmaps
Browse files Browse the repository at this point in the history
  • Loading branch information
weirdan committed Nov 28, 2021
2 parents cd2abc7 + 41256c7 commit 1af805e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
11 changes: 10 additions & 1 deletion dictionaries/CallMap.php
Expand Up @@ -2518,6 +2518,7 @@
'enchant_dict_store_replacement' => ['void', 'dictionary'=>'resource', 'misspelled'=>'string', 'correct'=>'string'],
'enchant_dict_suggest' => ['array', 'dictionary'=>'resource', 'word'=>'string'],
'end' => ['mixed|false', '&r_array'=>'array|object'],
'enum_exists' => ['bool', 'class' => 'class-string', 'autoload=' => 'bool'],
'Error::__clone' => ['void'],
'Error::__construct' => ['void', 'message='=>'string', 'code='=>'int', 'previous='=>'?Throwable|?Error'],
'Error::__toString' => ['string'],
Expand Down Expand Up @@ -8406,7 +8407,7 @@
'mysqli::get_warnings' => ['mysqli_warning'],
'mysqli::init' => ['false|null'],
'mysqli::kill' => ['bool', 'process_id'=>'int'],
'mysqli::more_results' => ['bool'],
'mysqli::more_results' => ['bool'],
'mysqli::multi_query' => ['bool', 'query'=>'string'],
'mysqli::next_result' => ['bool'],
'mysqli::options' => ['bool', 'option'=>'int', 'value'=>'string|int'],
Expand Down Expand Up @@ -11369,6 +11370,14 @@
'ReflectionClassConstant::isPrivate' => ['bool'],
'ReflectionClassConstant::isProtected' => ['bool'],
'ReflectionClassConstant::isPublic' => ['bool'],
'ReflectionEnum::getBackingType' => ['?ReflectionType'],
'ReflectionEnum::getCase' => ['ReflectionEnumUnitCase', 'name' => 'string'],
'ReflectionEnum::getCases' => ['list<ReflectionEnumUnitCase>'],
'ReflectionEnum::hasCase' => ['bool', 'name' => 'string'],
'ReflectionEnum::isBacked' => ['bool'],
'ReflectionEnumUnitCase::getEnum' => ['ReflectionEnum'],
'ReflectionEnumUnitCase::getValue' => ['UnitEnum'],
'ReflectionEnumBackedCase::getBackingValue' => ['string|int'],
'ReflectionExtension::__clone' => ['void'],
'ReflectionExtension::__construct' => ['void', 'name'=>'string'],
'ReflectionExtension::__toString' => ['string'],
Expand Down
9 changes: 9 additions & 0 deletions dictionaries/CallMap_81_delta.php
Expand Up @@ -17,6 +17,7 @@
return [
'added' => [
'array_is_list' => ['bool', 'array' => 'array'],
'enum_exists' => ['bool', 'class' => 'class-string', 'autoload=' => 'bool'],
'fsync' => ['bool', 'stream' => 'resource'],
'fdatasync' => ['bool', 'stream' => 'resource'],
'imageavif' => ['bool', 'image'=>'GdImage', 'file='=>'resource|string|null', 'quality='=>'int', 'speed='=>'int'],
Expand All @@ -36,6 +37,14 @@
'Fiber::getCurrent' => ['?self'],
'Fiber::suspend' => ['mixed', 'value='=>'null|mixed'],
'FiberError::__construct' => ['void'],
'ReflectionEnum::getBackingType' => ['?ReflectionType'],
'ReflectionEnum::getCase' => ['ReflectionEnumUnitCase', 'name' => 'string'],
'ReflectionEnum::getCases' => ['list<ReflectionEnumUnitCase>'],
'ReflectionEnum::hasCase' => ['bool', 'name' => 'string'],
'ReflectionEnum::isBacked' => ['bool'],
'ReflectionEnumUnitCase::getEnum' => ['ReflectionEnum'],
'ReflectionEnumUnitCase::getValue' => ['UnitEnum'],
'ReflectionEnumBackedCase::getBackingValue' => ['string|int'],
],

'changed' => [
Expand Down
21 changes: 21 additions & 0 deletions stubs/Php81.phpstub
Expand Up @@ -14,6 +14,27 @@ namespace {
public static function from(string|int $value): static;
public static function tryFrom(string|int $value): ?static;
}

class ReflectionEnum extends ReflectionClass implements Reflector
{
public function getBackingType(): ?ReflectionType;
public function getCase(string $name): ReflectionEnumUnitCase;
/** @return list<ReflectionEnumUnitCase> */
public function getCases(): array;
public function hasCase(string $name): bool;
public function isBacked(): bool;
}

class ReflectionEnumUnitCase extends ReflectionClassConstant implements Reflector
{
public function getEnum(): ReflectionEnum;
public function getValue(): UnitEnum;
}

class ReflectionEnumBackedCase extends ReflectionEnumUnitCase implements Reflector
{
public function getBackingValue(): int|string;
}
}

namespace FTP {
Expand Down

0 comments on commit 1af805e

Please sign in to comment.