X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=ion.stub.php;h=e874b927018ee1fe210d0371f9ff80ba377cac0b;hb=0ebd5a03550ffe66a371bcac0d525257faccdb1d;hp=eac98f2e55d4d4f20518d1543caca0db9cf0f9b8;hpb=1c60d5a9bfc334355a8f873cc295c055feda609a;p=awesomized%2Fext-ion diff --git a/ion.stub.php b/ion.stub.php index eac98f2..e874b92 100644 --- a/ion.stub.php +++ b/ion.stub.php @@ -36,7 +36,7 @@ enum Annotation : string { case SERIALIZABLE = "S"; case ENUM = "E"; - case FIELD_NAME_INT = "i"; + case PROPERTY = "p"; } namespace ion\Symbol; @@ -76,12 +76,15 @@ enum SID : int { namespace ion; class Symbol { public function __construct( - public readonly string $value, + public readonly ?string $value = null, public readonly int $sid = -1, public readonly ?Symbol\ImportLocation $importLocation = null, ) {} - public function equals(Symbol $symbol): bool { } + public function equals(Symbol $symbol): bool {} + public function __toString() : string {} + /** @alias ion\Symbol::__toString */ + public function toString() : string {} } namespace ion\Symbol; @@ -98,15 +101,52 @@ class Collection { } +namespace ion; +class LOB { + public function __construct( + public readonly string $value, + public readonly Type $type = Type::CLob, + ) { + } +} + +namespace ion\Decimal\Context; +enum Rounding : int { + case Ceiling = 0; + case Up = 1; + case HalfUp = 2; + case HalfEven = 3; + case HalfDown = 4; + case Down = 5; + case Floor = 6; + case Down05Up = 7; +} + +namespace ion\Decimal; +class Context { + public function __construct( + public readonly int $digits, + public readonly int $eMax, + public readonly int $eMin, + public readonly Context\Rounding|int $round, + public readonly bool $clamp, + ) {} + + public static function Dec32() : Context {} + public static function Dec64() : Context {} + public static function Dec128() : Context {} + public static function DecMax(Context\Rounding|int $round = Context\Rounding::HalfEven) : Context {} +} + namespace ion; class Decimal { public function __construct( - string|int $number, + public readonly string|int $number, public readonly ?Decimal\Context $context = null, ) {} public function equals(Decimal $decimal) : bool {} - public function zero() : void {} + public function isInt() : bool {} public function __toString() : string {} /** @alias ion\Decimal::__toString */ @@ -114,18 +154,24 @@ class Decimal { public function toInt() : int {} } -namespace ion\Decimal; -class Context { - +namespace ion\Timestamp; +enum Precision : int { + case Year = 0x1; + case Month = 0x1|0x2; + case Day = 0x1|0x2|0x4; + case Min = 0x1|0x2|0x4|0x10; + case Sec = 0x1|0x2|0x4|0x10|0x20; + case Frac = 0x1|0x2|0x4|0x10|0x20|0x40; } - - namespace ion; class Timestamp extends \DateTime { + public readonly int $precision; + public readonly string $format; + public function __construct( - public readonly int $precision, - public readonly string $format = "c", - string $datetime = "now", + Timestamp\Precision|int $precision, + ?string $format = null, + ?string $datetime = null, ?\DateTimeZone $timezone = null, ) {} @@ -416,32 +462,46 @@ class Writer extends \ion\Writer\Writer implements \ion\Writer\Stream { public function getStream() {} } -namespace ion\PHP; -class Serializer { +namespace ion; +interface Serializer { + public function __invoke(mixed $data) : string; + // protected function serialize(mixed $data) : string; +} +namespace ion; +interface Unserializer { + /** @param string|resource $data */ + public function __invoke($data) : mixed; + // /** @param string|resource $data */ + // protected function unserialize($data) : mixed; +} + +namespace ion\Serializer; +class PHP implements \ion\Serializer { public function __construct( - public readonly \ion\Writer $writer, + public readonly ?\ion\Writer\Options $writerOptions = null, + public readonly bool $multiSequence = false, public readonly bool $callMagicSerialize = true, public readonly ?string $callCustomSerialize = null, ) {} - public function __invoke(mixed $data) : void {} - protected function serialize(mixed $data) : void {} + public function __invoke(mixed $data) : string {} + protected function serialize(mixed $data) : string {} } -namespace ion\PHP; -class Unserializer { +namespace ion\Unserializer; +class PHP implements \ion\Unserializer { public function __construct( - public readonly \ion\Reader $reader, + public readonly ?\ion\Reader\Options $readerOptions = null, + public readonly bool $multiSequence = true, public readonly bool $callMagicUnserialize = true, public readonly ?string $callCustomUnserialize = null, ){} - public function __invoke() : mixed {} - protected function unserialize() : mixed {} + /** @param string|resource $data */ + public function __invoke($data) : mixed {} + /** @param string|resource $data */ + protected function unserialize($data) : mixed {} } namespace ion; -function serialize(mixed $data, Writer\Options $options = null) : string {} -function unserialize(mixed $serialized, Reader\Options $options = null) : mixed {} - - - - +function serialize(mixed $data, ?Serializer $serializer = null) : string {} +/** @param string|resource $data */ +function unserialize($data, ?Unserializer $unserializer = null) : mixed {}