2021-05-03 23:54:09 +02:00
|
|
|
<?php
|
2021-09-04 22:44:06 +02:00
|
|
|
namespace {
|
|
|
|
interface UnitEnum {
|
2021-11-22 13:38:08 +01:00
|
|
|
/** @var non-empty-string $name */
|
2021-11-22 13:47:36 +01:00
|
|
|
public readonly string $name;
|
2021-11-28 08:37:57 +01:00
|
|
|
|
2021-12-20 23:20:50 +01:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
2021-12-21 12:06:41 +01:00
|
|
|
* @return list<static>
|
2021-12-20 23:20:50 +01:00
|
|
|
*/
|
2021-09-04 22:44:06 +02:00
|
|
|
public static function cases(): array;
|
|
|
|
}
|
2021-11-28 08:37:57 +01:00
|
|
|
|
|
|
|
interface BackedEnum
|
|
|
|
{
|
|
|
|
public readonly int|string $value;
|
2021-12-20 23:20:50 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*/
|
2021-11-28 08:37:57 +01:00
|
|
|
public static function from(string|int $value): static;
|
2021-12-20 23:20:50 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*/
|
2021-11-28 08:37:57 +01:00
|
|
|
public static function tryFrom(string|int $value): ?static;
|
|
|
|
}
|
2021-11-28 10:41:43 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
{
|
2021-12-20 23:20:50 +01:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*/
|
2021-11-28 10:41:43 +01:00
|
|
|
public function getEnum(): ReflectionEnum;
|
2021-12-20 23:20:50 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*/
|
2021-11-28 10:41:43 +01:00
|
|
|
public function getValue(): UnitEnum;
|
|
|
|
}
|
|
|
|
|
|
|
|
class ReflectionEnumBackedCase extends ReflectionEnumUnitCase implements Reflector
|
|
|
|
{
|
2021-12-20 23:20:50 +01:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*/
|
2021-11-28 10:41:43 +01:00
|
|
|
public function getBackingValue(): int|string;
|
|
|
|
}
|
2021-09-04 22:44:06 +02:00
|
|
|
}
|
2021-05-03 23:54:09 +02:00
|
|
|
|
2021-09-04 22:44:06 +02:00
|
|
|
namespace FTP {
|
|
|
|
final class Connection {}
|
2021-05-03 23:54:09 +02:00
|
|
|
}
|
2021-10-02 11:58:08 +02:00
|
|
|
|
|
|
|
namespace IMAP {
|
|
|
|
final class Connection {}
|
2021-10-02 19:30:50 +02:00
|
|
|
}
|
|
|
|
|
2021-10-03 07:52:16 +02:00
|
|
|
namespace LDAP {
|
2021-10-02 19:30:50 +02:00
|
|
|
final class Connection {}
|
|
|
|
final class Result {}
|
|
|
|
final class ResultEntry {}
|
2021-10-04 13:41:31 +02:00
|
|
|
}
|
|
|
|
|
2021-10-14 19:30:03 +02:00
|
|
|
namespace PgSql {
|
|
|
|
final class Connection {}
|
|
|
|
final class Result {}
|
|
|
|
final class Lob {}
|
|
|
|
}
|
2021-10-14 20:38:26 +02:00
|
|
|
|
|
|
|
namespace PSpell {
|
|
|
|
final class Config {}
|
|
|
|
final class Dictionary {}
|
|
|
|
}
|