add ci workflow
[awesomized/ext-ion] / ion.stub.php
index 750ee9c0bf6dd5166eeb1bf4011d3cc3e6d9a64a..aa897366bd48ed07f1d860f864643c55722f2e41 100644 (file)
@@ -5,8 +5,20 @@
  * @generate-function-entries static
  */
 
-
 namespace ion;
+
+function serialize(mixed $data, ?Serializer $serializer = null) : string {}
+/** @param string|resource $data */
+function unserialize($data, ?Unserializer $unserializer = null) : mixed {}
+
+interface Serializer {
+    public function serialize(mixed $data) : string;
+}
+interface Unserializer {
+    /** @param string|resource $data */
+    public function unserialize($data) : mixed;
+}
+
 enum Type : int {
     case Null       = 0x000;
     case Bool       = 0x100;
@@ -27,7 +39,151 @@ enum Type : int {
     case NONE       =-0x200;
 }
 
+class Symbol {
+    public function __construct(
+        public readonly ?string $value = null,
+        public readonly int $sid = -1,
+        public readonly ?Symbol\ImportLocation $importLocation = null,
+    ) {}
+
+    public function equals(Symbol $symbol): bool {}
+    public function __toString() : string {}
+    /** @alias ion\Symbol::__toString */
+    public function toString() : string {}
+}
+
+class Catalog implements Countable {
+    /** Internal cache */
+    private array $symbolTables = [];
+
+    public function __construct() {}
+
+    public function count() : int {}
+
+    public function add(Symbol\Table $table) : void {}
+    public function remove(Symbol\Table|string $table) : bool {}
+
+    public function find(string $name, int $version = 0) : ?Symbol\Table {}
+    public function findBest(string $name, int $version = 0) : ?Symbol\Table {}
+}
+
+class LOB {
+    public function __construct(
+        public readonly string $value,
+        public readonly Type $type = Type::CLob,
+    ) {
+    }
+}
+
+class Decimal {
+    public function __construct(
+        public readonly string|int $number,
+        public readonly ?Decimal\Context $context = null,
+    ) {}
+
+    public function equals(Decimal $decimal) : bool {}
+    public function isInt() : bool {}
+
+    public function __toString() : string {}
+    /** @alias ion\Decimal::__toString */
+    public function toString() : string {}
+    public function toInt() : int {}
+}
+
+class Timestamp extends \DateTime {
+    public readonly int $precision;
+    public readonly string $format;
+
+    public function __construct(
+        Timestamp\Precision|int $precision,
+        Timestamp\Format|string|null $format = null,
+        ?string $datetime = null,
+        ?\DateTimeZone $timezone = null,
+    ) {}
+
+    public function __toString() : string {}
+}
+
+interface Reader extends \RecursiveIterator {
+    public function getType() : Type;
+    public function hasAnnotations() : bool;
+    public function hasAnnotation(string $annotation) : bool;
+    public function isNull() : bool;
+    public function isInStruct() : bool;
+    public function getFieldName() : string;
+    public function getFieldNameSymbol() : Symbol;
+    public function getAnnotations() : array;
+    public function getAnnotationSymbols() : array;
+    public function countAnnotations() : int;
+    public function getAnnotation(int $index) : string;
+    public function getAnnotationSymbol(int $index) : Symbol;
+
+    public function readNull() : Type;
+    public function readBool() : bool;
+    public function readInt() : int|string;
+    public function readFloat() : float;
+    public function readDecimal() : Decimal;
+    public function readTimestamp() : Timestamp;
+    public function readSymbol() : Symbol;
+    public function readString() : string;
+    /** @param ref $string */
+    public function readStringPart(&$string, int $length = 0x1000) : bool;
+    public function readLob() : string;
+    /** @param ref $string */
+    public function readLobPart(&$string, int $length = 0x1000) : bool;
+
+    public function getPosition() : int;
+    public function getDepth() : int;
+
+    public function seek(int $offset, int $length = -1) : void;
+    /*
+    public function getSymbolTable() : SymbolTable;
+    public function setSymbolTable(SymbolTable $table) : void;
+    */
+    public function getValueOffset() : int;
+    public function getValueLength() : int;
+}
+
+interface Writer {
+    public function writeNull() : void;
+    public function writeTypedNull(Type $type) : void;
+    public function writeBool(bool $value) : void;
+    public function writeInt(int|string $value) : void;
+    public function writeFloat(float $value) : void;
+    public function writeDecimal(Decimal|string $value) : void;
+    public function writeTimestamp(Timestamp|string $value) : void;
+    public function writeSymbol(Symbol|string $value) : void;
+    public function writeString(string $value) : void;
+    public function writeCLob(string $value) : void;
+    public function writeBLob(string $value) : void;
+
+    public function startLob(Type $type) : void;
+    public function appendLob(string $data) : void;
+    public function finishLob() : void;
+
+    public function startContainer(Type $type) : void;
+    public function finishContainer() : void;
+
+    public function writeFieldName(string $name) : void;
+
+    public function writeAnnotation(Symbol|string ...$annotation) : void;
+
+    public function getDepth() : int;
+    public function flush() : int;
+    public function finish() : int;
+
+    // public function writeOne(Reader $reader) : void;
+    // public function writeAll(Reader $reader) : void;
+
+    // public function getCatalog() : Catalog;
+    // public function setCatalog(Catalog $catalog) : void;
+
+    // public function getSymbolTable() : Symbol\Table;
+    // puvlic function setSymbolTable(Symbol\Table $table) : void;
+}
+
 namespace ion\Symbol;
+
 class ImportLocation {
     public function __construct(
         public readonly string $name,
@@ -35,14 +191,25 @@ class ImportLocation {
     ) {}
 }
 
-namespace ion\Symbol;
 interface Enum {
     public function toSymbol() : \ion\Symbol;
     public function toSID() : int;
     public function toString() : string;
 }
 
+interface Table {
+    public function getMaxId() : int;
+
+    public function add(\ion\Symbol|string $symbol) : int;
+    public function find(string|int $id) : ?\ion\Symbol;
+    public function findLocal(string|int $id) : ?\ion\Symbol;
+}
+
 namespace ion\Symbol\Table;
+
+function PHP() : \ion\Symbol\Table {}
+function System() : \ion\Symbol\Table {}
+
 enum System : string implements \ion\Symbol\Enum {
     case Ion                = '$ion';
     case Ivm_1_0            = '$ion_1_0';
@@ -62,7 +229,6 @@ enum System : string implements \ion\Symbol\Enum {
     public function toString() : string {}
 }
 
-namespace ion\Symbol\Table;
 enum PHP : string implements \ion\Symbol\Enum {
     case PHP            = 'PHP';
     case Reference      = 'R';
@@ -83,34 +249,6 @@ enum PHP : string implements \ion\Symbol\Enum {
     public function toString() : string {}
 }
 
-namespace ion;
-class Symbol {
-    public function __construct(
-        public readonly ?string $value = null,
-        public readonly int $sid = -1,
-        public readonly ?Symbol\ImportLocation $importLocation = null,
-    ) {}
-
-    public function equals(Symbol $symbol): bool {}
-    public function __toString() : string {}
-    /** @alias ion\Symbol::__toString */
-    public function toString() : string {}
-}
-
-namespace ion\Symbol;
-interface Table {
-    public function getMaxId() : int;
-
-    public function add(\ion\Symbol|string $symbol) : int;
-    public function find(string|int $id) : ?\ion\Symbol;
-    public function findLocal(string|int $id) : ?\ion\Symbol;
-}
-
-namespace ion\Symbol\Table;
-function PHP() : \ion\Symbol\Table {}
-function System() : \ion\Symbol\Table {}
-
-namespace ion\Symbol\Table;
 class Local implements \ion\Symbol\Table {
     /** Internal cache */
     private array $imports = [];
@@ -131,7 +269,6 @@ class Local implements \ion\Symbol\Table {
     public function findLocal(string|int $id) : ?\ion\Symbol {}
 }
 
-namespace ion\Symbol\Table;
 class Shared implements \ion\Symbol\Table {
     public function __construct(
         public readonly string $name,
@@ -153,44 +290,8 @@ class Shared implements \ion\Symbol\Table {
     public function findLocal(string|int $id) : ?\ion\Symbol {}
 }
 
-namespace ion;
-class Catalog implements Countable {
-    /** Internal cache */
-    private array $symbolTables = [];
-
-    public function __construct() {}
-
-    public function count() : int {}
-
-    public function add(Symbol\Table $table) : void {}
-    public function remove(Symbol\Table|string $table) : bool {}
-
-    public function find(string $name, int $version = 0) : ?Symbol\Table {}
-    public function findBest(string $name, int $version = 0) : ?Symbol\Table {}
-}
-
-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,
@@ -206,23 +307,21 @@ class Context {
     public static function DecMax(Context\Rounding|int $round = Context\Rounding::HalfEven) : Context {}
 }
 
-namespace ion;
-class Decimal {
-    public function __construct(
-        public readonly string|int $number,
-        public readonly ?Decimal\Context $context = null,
-    ) {}
-
-    public function equals(Decimal $decimal) : bool {}
-    public function isInt() : bool {}
+namespace ion\Decimal\Context;
 
-    public function __toString() : string {}
-    /** @alias ion\Decimal::__toString */
-    public function toString() : string {}
-    public function toInt() : int {}
+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\Timestamp;
+
 enum Precision : int {
     case Year           = 0x1;
     case Month          = 0x1|0x2;
@@ -235,7 +334,6 @@ enum Precision : int {
     case FracTZ         = 0x1|0x2|0x4|0x10|0x20|0x40|0x80;
 }
 
-namespace ion\Timestamp;
 enum Format : string {
     case Year           = "Y\T";
     case Month          = "Y-m\T";
@@ -247,64 +345,9 @@ enum Format : string {
     case SecTZ          = "Y-m-d\TH:i:sP";
     case FracTZ         = "Y-m-d\TH:i:s.vP";
 }
-namespace ion;
-class Timestamp extends \DateTime {
-    public readonly int $precision;
-    public readonly string $format;
-
-    public function __construct(
-        Timestamp\Precision|int $precision,
-        Timestamp\Format|string|null $format = null,
-        ?string $datetime = null,
-        ?\DateTimeZone $timezone = null,
-    ) {}
-
-    public function __toString() : string {}
-}
-
-
-namespace ion;
-interface Reader extends \RecursiveIterator {
-    public function getType() : Type;
-    public function hasAnnotations() : bool;
-    public function hasAnnotation(string $annotation) : bool;
-    public function isNull() : bool;
-    public function isInStruct() : bool;
-    public function getFieldName() : string;
-    public function getFieldNameSymbol() : Symbol;
-    public function getAnnotations() : array;
-    public function getAnnotationSymbols() : array;
-    public function countAnnotations() : int;
-    public function getAnnotation(int $index) : string;
-    public function getAnnotationSymbol(int $index) : Symbol;
-
-    public function readNull() : Type;
-    public function readBool() : bool;
-    public function readInt() : int|string;
-    public function readFloat() : float;
-    public function readDecimal() : Decimal;
-    public function readTimestamp() : Timestamp;
-    public function readSymbol() : Symbol;
-    public function readString() : string;
-    /** @param ref $string */
-    public function readStringPart(&$string, int $length = 0x1000) : bool;
-    public function readLob() : string;
-    /** @param ref $string */
-    public function readLobPart(&$string, int $length = 0x1000) : bool;
-
-    public function getPosition() : int;
-    public function getDepth() : int;
-
-    public function seek(int $offset, int $length = -1) : void;
-    /*
-    public function getSymbolTable() : SymbolTable;
-    public function setSymbolTable(SymbolTable $table) : void;
-    */
-    public function getValueOffset() : int;
-    public function getValueLength() : int;
-}
 
 namespace ion\Reader;
+
 class Options {
     public function __construct(
         public readonly ?\ion\Catalog $catalog = null,
@@ -323,7 +366,6 @@ class Options {
     ) {}
 }
 
-namespace ion\Reader;
 abstract class Reader implements \ion\Reader {
     public readonly ?Options $options;
 
@@ -374,12 +416,22 @@ abstract class Reader implements \ion\Reader {
     public function getValueOffset() : int {}
     public function getValueLength() : int {}
 }
-namespace ion\Reader;
+
 interface Buffer extends \ion\Reader {
     public function getBuffer() : string;
 }
 
+interface Stream extends \ion\Reader {
+    /** @return resource */
+    public function getStream();
+    /** @param resource $stream */
+    public function resetStream($stream) : void;
+    /** @param resource $stream */
+    public function resetStreamWithLength($stream, int $length) : void;
+}
+
 namespace ion\Reader\Buffer;
+
 class Reader extends \ion\Reader\Reader implements \ion\Reader\Buffer {
     public function __construct(
         string $buffer,
@@ -389,17 +441,8 @@ class Reader extends \ion\Reader\Reader implements \ion\Reader\Buffer {
     public function getBuffer() : string {}
 }
 
-namespace ion\Reader;
-interface Stream extends \ion\Reader {
-    /** @return resource */
-    public function getStream();
-    /** @param resource $stream */
-    public function resetStream($stream) : void;
-    /** @param resource $stream */
-    public function resetStreamWithLength($stream, int $length) : void;
-}
-
 namespace ion\Reader\Stream;
+
 class Reader extends \ion\Reader\Reader implements \ion\Reader\Stream {
     /** @param resource $stream */
     public function __construct(
@@ -416,6 +459,7 @@ class Reader extends \ion\Reader\Reader implements \ion\Reader\Stream {
 }
 
 namespace ion\Writer;
+
 class Options {
     public function __construct(
         public readonly ?\ion\Catalog $catalog = null,
@@ -436,46 +480,6 @@ class Options {
     ) {}
 }
 
-namespace ion;
-interface Writer {
-    public function writeNull() : void;
-    public function writeTypedNull(Type $type) : void;
-    public function writeBool(bool $value) : void;
-    public function writeInt(int|string $value) : void;
-    public function writeFloat(float $value) : void;
-    public function writeDecimal(Decimal|string $value) : void;
-    public function writeTimestamp(Timestamp|string $value) : void;
-    public function writeSymbol(Symbol|string $value) : void;
-    public function writeString(string $value) : void;
-    public function writeCLob(string $value) : void;
-    public function writeBLob(string $value) : void;
-
-    public function startLob(Type $type) : void;
-    public function appendLob(string $data) : void;
-    public function finishLob() : void;
-
-    public function startContainer(Type $type) : void;
-    public function finishContainer() : void;
-
-    public function writeFieldName(string $name) : void;
-
-    public function writeAnnotation(Symbol|string ...$annotation) : void;
-
-    public function getDepth() : int;
-    public function flush() : int;
-    public function finish() : int;
-
-    // public function writeOne(Reader $reader) : void;
-    // public function writeAll(Reader $reader) : void;
-
-    // public function getCatalog() : Catalog;
-    // public function setCatalog(Catalog $catalog) : void;
-
-    // public function getSymbolTable() : Symbol\Table;
-    // puvlic function setSymbolTable(Symbol\Table $table) : void;
-}
-
-namespace ion\Writer;
 abstract class Writer implements \ion\Writer {
     public function writeNull() : void {}
     public function writeTypedNull(\ion\Type $type) : void {}
@@ -508,13 +512,18 @@ abstract class Writer implements \ion\Writer {
     // public function writeAll(\ion\Reader $reader) : void {}
 }
 
-namespace ion\Writer;
 interface Buffer extends \ion\Writer {
     public function getBuffer() : string;
     public function resetBuffer() : void;
 }
 
+interface Stream extends \ion\Writer {
+    /** @return resource */
+    public function getStream();
+}
+
 namespace ion\Writer\Buffer;
+
 class Writer extends \ion\Writer\Writer implements \ion\Writer\Buffer {
     public function __construct(
         ?\ion\Writer\Options $options = null,
@@ -524,13 +533,8 @@ class Writer extends \ion\Writer\Writer implements \ion\Writer\Buffer {
     public function resetBuffer() : void {}
 }
 
-namespace ion\Writer;
-interface Stream extends \ion\Writer {
-    /** @return resource */
-    public function getStream();
-}
-
 namespace ion\Writer\Stream;
+
 class Writer extends \ion\Writer\Writer implements \ion\Writer\Stream {
     /** @param resource $stream */
     public function __construct(
@@ -541,17 +545,8 @@ class Writer extends \ion\Writer\Writer implements \ion\Writer\Stream {
     public function getStream() {}
 }
 
-namespace ion;
-interface Serializer {
-    public function serialize(mixed $data) : string;
-}
-namespace ion;
-interface Unserializer {
-    /** @param string|resource $data */
-    public function unserialize($data) : mixed;
-}
-
 namespace ion\Serializer;
+
 class PHP implements \ion\Serializer {
     public function __construct(
         public readonly ?\ion\Writer\Options $writerOptions = null,
@@ -563,6 +558,7 @@ class PHP implements \ion\Serializer {
 }
 
 namespace ion\Unserializer;
+
 class PHP implements \ion\Unserializer {
     public function __construct(
         public readonly ?\ion\Reader\Options $readerOptions = null,
@@ -573,8 +569,3 @@ class PHP implements \ion\Unserializer {
     /** @param string|resource $data */
     public function unserialize($data) : mixed {}
 }
-
-namespace ion;
-function serialize(mixed $data, ?Serializer $serializer = null) : string {}
-/** @param string|resource $data */
-function unserialize($data, ?Unserializer $unserializer = null) : mixed {}