Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added enum-related stubs and callmaps #7012

Merged
merged 1 commit into from Nov 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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