mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Merge pull request #7012 from weirdan/enum-stubs-and-callmaps
This commit is contained in:
commit
1af805eca3
@ -2518,6 +2518,7 @@ return [
|
||||
'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'],
|
||||
@ -8406,7 +8407,7 @@ return [
|
||||
'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'],
|
||||
@ -11369,6 +11370,14 @@ return [
|
||||
'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'],
|
||||
|
@ -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'],
|
||||
@ -36,6 +37,14 @@ return [
|
||||
'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' => [
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user