define clonability
[awesomized/ext-ion] / ion.stub.php
1 <?php
2
3 /**
4 * @generate-class-entries static
5 * @generate-function-entries static
6 */
7
8
9 namespace ion;
10 enum Type : int {
11 case Null = 0x000;
12 case Bool = 0x100;
13 case Int = 0x200;
14 case Float = 0x400;
15 case Decimal = 0x500;
16 case Timestamp = 0x600;
17 case Symbol = 0x700;
18 case String = 0x800;
19 case CLob = 0x900;
20 case BLob = 0xa00;
21 case AList = 0xb00;
22 case SExp = 0xc00;
23 case Struct = 0xd00;
24 case Datagram = 0xf00;
25
26 case EOF =-0x100;
27 case NONE =-0x200;
28 }
29
30 namespace ion\Symbol;
31 class ImportLocation {
32 public function __construct(
33 public readonly string $name,
34 public readonly int $location,
35 ) {}
36 }
37
38 namespace ion\Symbol;
39 interface Enum {
40 public function toSymbol() : \ion\Symbol;
41 public function toSID() : int;
42 public function toString() : string;
43 }
44
45 namespace ion\Symbol\Table;
46 enum System : string implements \ion\Symbol\Enum {
47 case Ion = '$ion';
48 case Ivm_1_0 = '$ion_1_0';
49 case IonSymbolTable = '$ion_symbol_table';
50 case Name = 'name';
51 case Version = 'version';
52 case Imports = 'imports';
53 case Symbols = 'symbols';
54 case MaxId = 'max_id';
55 case SharedSymbolTable = '$ion_shared_symbol_table';
56
57 /** @alias ion\Symbol\Enum::toSymbol */
58 public function toSymbol() : \ion\Symbol {}
59 /** @alias ion\Symbol\Enum::toSID */
60 public function toSID() : int {}
61 /** @alias ion\Symbol\Enum::toString */
62 public function toString() : string {}
63 }
64
65 namespace ion\Symbol\Table;
66 enum PHP : string implements \ion\Symbol\Enum {
67 case PHP = 'PHP';
68 case Reference = 'R';
69 case Backref = 'r';
70 case Property = 'p';
71 case Object = 'o';
72 case ClassObject = 'c';
73 case MagicObject = 'O';
74 case CustomObject = 'C';
75 case Enum = 'E';
76 case Serializable = 'S';
77
78 /** @alias ion\Symbol\Enum::toSymbol */
79 public function toSymbol() : \ion\Symbol {}
80 /** @alias ion\Symbol\Enum::toSID */
81 public function toSID() : int {}
82 /** @alias ion\Symbol\Enum::toString */
83 public function toString() : string {}
84 }
85
86 namespace ion;
87 class Symbol {
88 public function __construct(
89 public readonly ?string $value = null,
90 public readonly int $sid = -1,
91 public readonly ?Symbol\ImportLocation $importLocation = null,
92 ) {}
93
94 public function equals(Symbol $symbol): bool {}
95 public function __toString() : string {}
96 /** @alias ion\Symbol::__toString */
97 public function toString() : string {}
98 }
99
100 namespace ion\Symbol;
101 interface Table {
102 public function getMaxId() : int;
103
104 public function add(\ion\Symbol|string $symbol) : int;
105 public function find(string|int $id) : ?\ion\Symbol;
106 public function findLocal(string|int $id) : ?\ion\Symbol;
107 }
108
109 namespace ion\Symbol\Table;
110 function PHP() : \ion\Symbol\Table {}
111 function System() : \ion\Symbol\Table {}
112
113 namespace ion\Symbol\Table;
114 class Local implements \ion\Symbol\Table {
115 /** Internal cache */
116 private array $imports = [];
117 /** Internal cache */
118 private array $symbols = [];
119
120 public function __construct() {}
121 public function import(\ion\Symbol\Table $table) : void {}
122
123 /** @alias ion\Symbol\Table::getMaxId */
124 public function getMaxId() : int {}
125
126 /** @alias ion\Symbol\Table::add */
127 public function add(\ion\Symbol|string $symbol) : int {}
128 /** @alias ion\Symbol\Table::find */
129 public function find(string|int $id) : ?\ion\Symbol {}
130 /** @alias ion\Symbol\Table::findLocal */
131 public function findLocal(string|int $id) : ?\ion\Symbol {}
132 }
133
134 namespace ion\Symbol\Table;
135 class Shared implements \ion\Symbol\Table {
136 public function __construct(
137 public readonly string $name,
138 public readonly int $version = 1,
139 ?array $symbols = null,
140 ) {}
141
142 /** Internal cache */
143 private array $symbols = [];
144
145 /** @alias ion\Symbol\Table::getMaxId */
146 public function getMaxId() : int {}
147
148 /** @alias ion\Symbol\Table::add */
149 public function add(\ion\Symbol|string $symbol) : int {}
150 /** @alias ion\Symbol\Table::find */
151 public function find(string|int $id) : ?\ion\Symbol {}
152 /** @alias ion\Symbol\Table::findLocal */
153 public function findLocal(string|int $id) : ?\ion\Symbol {}
154 }
155
156 namespace ion;
157 class Catalog implements Countable {
158 /** Internal cache */
159 private array $symbolTables = [];
160
161 public function __construct() {}
162
163 public function count() : int {}
164
165 public function add(Symbol\Table $table) : void {}
166 public function remove(Symbol\Table|string $table) : bool {}
167
168 public function find(string $name, int $version = 0) : ?Symbol\Table {}
169 public function findBest(string $name, int $version = 0) : ?Symbol\Table {}
170 }
171
172 namespace ion;
173 class LOB {
174 public function __construct(
175 public readonly string $value,
176 public readonly Type $type = Type::CLob,
177 ) {
178 }
179 }
180
181 namespace ion\Decimal\Context;
182 enum Rounding : int {
183 case Ceiling = 0;
184 case Up = 1;
185 case HalfUp = 2;
186 case HalfEven = 3;
187 case HalfDown = 4;
188 case Down = 5;
189 case Floor = 6;
190 case Down05Up = 7;
191 }
192
193 namespace ion\Decimal;
194 class Context {
195 public function __construct(
196 public readonly int $digits,
197 public readonly int $eMax,
198 public readonly int $eMin,
199 public readonly Context\Rounding|int $round,
200 public readonly bool $clamp,
201 ) {}
202
203 public static function Dec32() : Context {}
204 public static function Dec64() : Context {}
205 public static function Dec128() : Context {}
206 public static function DecMax(Context\Rounding|int $round = Context\Rounding::HalfEven) : Context {}
207 }
208
209 namespace ion;
210 class Decimal {
211 public function __construct(
212 public readonly string|int $number,
213 public readonly ?Decimal\Context $context = null,
214 ) {}
215
216 public function equals(Decimal $decimal) : bool {}
217 public function isInt() : bool {}
218
219 public function __toString() : string {}
220 /** @alias ion\Decimal::__toString */
221 public function toString() : string {}
222 public function toInt() : int {}
223 }
224
225 namespace ion\Timestamp;
226 enum Precision : int {
227 case Year = 0x1;
228 case Month = 0x1|0x2;
229 case Day = 0x1|0x2|0x4;
230 case Min = 0x1|0x2|0x4|0x10;
231 case Sec = 0x1|0x2|0x4|0x10|0x20;
232 case Frac = 0x1|0x2|0x4|0x10|0x20|0x40;
233 case MinTZ = 0x1|0x2|0x4|0x10|0x80;
234 case SecTZ = 0x1|0x2|0x4|0x10|0x20|0x80;
235 case FracTZ = 0x1|0x2|0x4|0x10|0x20|0x40|0x80;
236 }
237 namespace ion;
238 class Timestamp extends \DateTime {
239 public readonly int $precision;
240 public readonly string $format;
241
242 public function __construct(
243 Timestamp\Precision|int $precision,
244 ?string $format = null,
245 ?string $datetime = null,
246 ?\DateTimeZone $timezone = null,
247 ) {}
248
249 public function __toString() : string {}
250 }
251
252
253 namespace ion;
254 interface Reader extends \RecursiveIterator {
255 public function getType() : Type;
256 public function hasAnnotations() : bool;
257 public function hasAnnotation(string $annotation) : bool;
258 public function isNull() : bool;
259 public function isInStruct() : bool;
260 public function getFieldName() : string;
261 public function getFieldNameSymbol() : Symbol;
262 public function getAnnotations() : array;
263 public function getAnnotationSymbols() : array;
264 public function countAnnotations() : int;
265 public function getAnnotation(int $index) : string;
266 public function getAnnotationSymbol(int $index) : Symbol;
267
268 public function readNull() : Type;
269 public function readBool() : bool;
270 public function readInt() : int|string;
271 public function readFloat() : float;
272 public function readDecimal() : Decimal;
273 public function readTimestamp() : Timestamp;
274 public function readSymbol() : Symbol;
275 public function readString() : string;
276 /** @param ref $string */
277 public function readStringPart(&$string, int $length = 0x1000) : bool;
278 public function readLob() : string;
279 /** @param ref $string */
280 public function readLobPart(&$string, int $length = 0x1000) : bool;
281
282 public function getPosition() : int;
283 public function getDepth() : int;
284
285 public function seek(int $offset, int $length = -1) : void;
286 /*
287 public function getSymbolTable() : SymbolTable;
288 public function setSymbolTable(SymbolTable $table) : void;
289 */
290 public function getValueOffset() : int;
291 public function getValueLength() : int;
292 }
293
294 namespace ion\Reader;
295 class Options {
296 public function __construct(
297 public readonly ?\ion\Catalog $catalog = null,
298 public readonly ?\ion\Decimal\Context $decimalContext = null,
299 public readonly ?\Closure $onContextChange = null,
300 public readonly bool $returnSystemValues = false,
301 public readonly int $newLine = 0xa,
302 public readonly int $maxContainerDepth = 10,
303 public readonly int $maxAnnotations = 10,
304 public readonly int $maxAnnotationBuffered = 512,
305 public readonly int $symbolThreshold = 0x4000,
306 public readonly int $userValueThreshold = 0x4000,
307 public readonly int $chunkThreshold = 0x4000,
308 public readonly int $allocationPageSize = 0x10000,
309 public readonly bool $skipCharacterValidation = false,
310 ) {}
311 }
312
313 namespace ion\Reader;
314 abstract class Reader implements \ion\Reader {
315 public readonly ?Options $options;
316
317 public function hasChildren() : bool {}
318 public function getChildren() : \ion\Reader {}
319
320 public function rewind() : void {}
321 public function next() : void {}
322 public function valid() : bool {}
323 public function key() : mixed {}
324 public function current() : mixed {}
325
326 public function getType() : \ion\Type {}
327 public function hasAnnotations() : bool {}
328 public function hasAnnotation(string $annotation) : bool {}
329 public function isNull() : bool {}
330 public function isInStruct() : bool {}
331 public function getFieldName() : string {}
332 public function getFieldNameSymbol() : \ion\Symbol {}
333 public function getAnnotations() : array {}
334 public function getAnnotationSymbols() : array {}
335 public function countAnnotations() : int {}
336 public function getAnnotation(int $index) : string {}
337 public function getAnnotationSymbol(int $index) : \ion\Symbol {}
338
339 public function readNull() : \ion\Type {}
340 public function readBool() : bool {}
341 public function readInt() : int|string {}
342 public function readFloat() : float {}
343 public function readDecimal() : \ion\Decimal {}
344 public function readTimestamp() : \ion\Timestamp {}
345 public function readSymbol() : \ion\Symbol {}
346 public function readString() : string {}
347 /** @param ref $string */
348 public function readStringPart(&$string, int $length = 0x1000) : bool {}
349 public function readLob() : string {}
350 /** @param ref $string */
351 public function readLobPart(&$string, int $length = 0x1000) : bool {}
352
353 public function getPosition() : int {}
354 public function getDepth() : int{}
355
356 public function seek(int $offset, int $length = -1) : void {}
357 /*
358 public function getSymbolTable() : SymbolTable {}
359 public function setSymbolTable(SymbolTable $table) : void {}
360 */
361 public function getValueOffset() : int {}
362 public function getValueLength() : int {}
363 }
364 namespace ion\Reader;
365 interface Buffer extends \ion\Reader {
366 public function getBuffer() : string;
367 }
368
369 namespace ion\Reader\Buffer;
370 class Reader extends \ion\Reader\Reader implements \ion\Reader\Buffer {
371 public function __construct(
372 string $buffer,
373 ?\ion\Reader\Options $options = null,
374 ) {}
375
376 public function getBuffer() : string {}
377 }
378
379 namespace ion\Reader;
380 interface Stream extends \ion\Reader {
381 /** @return resource */
382 public function getStream();
383 /** @param resource $stream */
384 public function resetStream($stream) : void;
385 /** @param resource $stream */
386 public function resetStreamWithLength($stream, int $position, int $length = -1) : void;
387 }
388
389 namespace ion\Reader\Stream;
390 class Reader extends \ion\Reader\Reader implements \ion\Reader\Stream {
391 /** @param resource $stream */
392 public function __construct(
393 $stream,
394 ?\ion\Reader\Options $options = null,
395 ) {
396 }
397 /** @return resource */
398 public function getStream() {}
399 /** @param resource $stream */
400 public function resetStream($stream) : void {}
401 /** @param resource $stream */
402 public function resetStreamWithLength($stream, int $position, int $length = -1) : void {}
403 }
404
405 namespace ion\Writer;
406 class Options {
407 public function __construct(
408 public readonly ?\ion\Catalog $catalog = null,
409 public readonly ?\ion\Decimal\Context $decimalContext = null,
410 public readonly bool $outputBinary = false,
411 public readonly bool $compactFloats = false,
412 public readonly bool $escapeNonAscii = false,
413 public readonly bool $prettyPrint = false,
414 public readonly bool $indentTabs = true,
415 public readonly int $indentSize = 2,
416 public readonly bool $smallContainersInline = true,
417 public readonly bool $suppressSystemValues = false,
418 public readonly bool $flushEveryValue = false,
419 public readonly int $maxContainerDepth = 10,
420 public readonly int $maxAnnotations = 10,
421 public readonly int $tempBufferSize = 0x4000,
422 public readonly int $allocationPageSize = 0x10000,
423 ) {}
424 }
425
426 namespace ion;
427 interface Writer {
428 public function writeNull() : void;
429 public function writeTypedNull(Type $type) : void;
430 public function writeBool(bool $value) : void;
431 public function writeInt(int|string $value) : void;
432 public function writeFloat(float $value) : void;
433 public function writeDecimal(Decimal|string $value) : void;
434 public function writeTimestamp(Timestamp|string $value) : void;
435 public function writeSymbol(Symbol|string $value) : void;
436 public function writeString(string $value) : void;
437 public function writeCLob(string $value) : void;
438 public function writeBLob(string $value) : void;
439
440 public function startLob(Type $type) : void;
441 public function appendLob(string $data) : void;
442 public function finishLob() : void;
443
444 public function startContainer(Type $type) : void;
445 public function finishContainer() : void;
446
447 public function writeFieldName(string $name) : void;
448
449 public function writeAnnotation(Symbol|string ...$annotation) : void;
450
451 public function getDepth() : int;
452 public function flush() : int;
453 public function finish() : int;
454
455 public function writeOne(Reader $reader) : void;
456 public function writeAll(Reader $reader) : void;
457
458 // public function getCatalog() : Catalog;
459 // public function setCatalog(Catalog $catalog) : void;
460
461 // public function getSymbolTable() : Symbol\Table;
462 // puvlic function setSymbolTable(Symbol\Table $table) : void;
463 }
464
465 namespace ion\Writer;
466 abstract class Writer implements \ion\Writer {
467 public function writeNull() : void {}
468 public function writeTypedNull(\ion\Type $type) : void {}
469 public function writeBool(bool $value) : void {}
470 public function writeInt(int|string $value) : void {}
471 public function writeFloat(float $value) : void {}
472 public function writeDecimal(\ion\Decimal|string $value) : void {}
473 public function writeTimestamp(\ion\Timestamp|string $value) : void {}
474 public function writeSymbol(\ion\Symbol|string $value) : void {}
475 public function writeString(string $value) : void {}
476 public function writeCLob(string $value) : void {}
477 public function writeBLob(string $value) : void {}
478
479 public function startLob(\ion\Type $type) : void {}
480 public function appendLob(string $data) : void {}
481 public function finishLob() : void {}
482
483 public function startContainer(\ion\Type $type) : void {}
484 public function finishContainer() : void {}
485
486 public function writeFieldName(string $name) : void {}
487
488 public function writeAnnotation(\ion\Symbol|string ...$annotation) : void {}
489
490 public function getDepth() : int {}
491 public function flush() : int {}
492 public function finish() : int {}
493
494 public function writeOne(\ion\Reader $reader) : void {}
495 public function writeAll(\ion\Reader $reader) : void {}
496 }
497
498 namespace ion\Writer;
499 interface Buffer extends \ion\Writer {
500 public function getBuffer() : string;
501 }
502
503 namespace ion\Writer\Buffer;
504 class Writer extends \ion\Writer\Writer implements \ion\Writer\Buffer {
505 /** @param ref $buffer */
506 public function __construct(
507 ?string &$buffer,
508 ?\ion\Writer\Options $options = null,
509 ) {}
510
511 /**
512 * @return string a _copy_ of $buffer passed to the constructor
513 */
514 public function getBuffer() : string {}
515 }
516
517 namespace ion\Writer;
518 interface Stream extends \ion\Writer {
519 /** @return resource */
520 public function getStream();
521 }
522
523 namespace ion\Writer\Stream;
524 class Writer extends \ion\Writer\Writer implements \ion\Writer\Stream {
525 /** @param resource $stream */
526 public function __construct(
527 $stream,
528 ?\ion\Writer\Options $options = null,
529 ) {}
530 /** @return resource */
531 public function getStream() {}
532 }
533
534 namespace ion;
535 interface Serializer {
536 public function serialize(mixed $data) : string;
537 }
538 namespace ion;
539 interface Unserializer {
540 /** @param string|resource $data */
541 public function unserialize($data) : mixed;
542 }
543
544 namespace ion\Serializer;
545 class PHP implements \ion\Serializer {
546 public function __construct(
547 public readonly ?\ion\Writer\Options $writerOptions = null,
548 public readonly bool $multiSequence = false,
549 public readonly bool $callMagicSerialize = true,
550 public readonly ?string $callCustomSerialize = null,
551 ) {}
552 public function serialize(mixed $data) : string {}
553 }
554
555 namespace ion\Unserializer;
556 class PHP implements \ion\Unserializer {
557 public function __construct(
558 public readonly ?\ion\Reader\Options $readerOptions = null,
559 public readonly bool $multiSequence = false,
560 public readonly bool $callMagicUnserialize = true,
561 public readonly ?string $callCustomUnserialize = null,
562 ){}
563 /** @param string|resource $data */
564 public function unserialize($data) : mixed {}
565 }
566
567 namespace ion;
568 function serialize(mixed $data, ?Serializer $serializer = null) : string {}
569 /** @param string|resource $data */
570 function unserialize($data, ?Unserializer $unserializer = null) : mixed {}