Dockerfile
[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 private array $imports = [];
116 private array $symbols = [];
117
118 public function __construct() {}
119 public function import(\ion\Symbol\Table $table) : void {}
120
121 /** @alias ion\Symbol\Table::getMaxId */
122 public function getMaxId() : int {}
123
124 /** @alias ion\Symbol\Table::add */
125 public function add(\ion\Symbol|string $symbol) : int {}
126 /** @alias ion\Symbol\Table::find */
127 public function find(string|int $id) : ?\ion\Symbol {}
128 /** @alias ion\Symbol\Table::findLocal */
129 public function findLocal(string|int $id) : ?\ion\Symbol {}
130 }
131
132 namespace ion\Symbol\Table;
133 class Shared implements \ion\Symbol\Table {
134 public function __construct(
135 public readonly string $name,
136 public readonly int $version = 1,
137 ?array $symbols = null,
138 ) {}
139
140 /** Internal cache */
141 private array $symbols = [];
142
143 /** @alias ion\Symbol\Table::getMaxId */
144 public function getMaxId() : int {}
145
146 /** @alias ion\Symbol\Table::add */
147 public function add(\ion\Symbol|string $symbol) : int {}
148 /** @alias ion\Symbol\Table::find */
149 public function find(string|int $id) : ?\ion\Symbol {}
150 /** @alias ion\Symbol\Table::findLocal */
151 public function findLocal(string|int $id) : ?\ion\Symbol {}
152 }
153
154 namespace ion;
155 class Catalog implements Countable {
156 /** Internal cache */
157 private array $symbolTables = [];
158
159 public function __construct() {}
160
161 public function count() : int {}
162
163 public function add(Symbol\Table $table) : void {}
164 public function remove(Symbol\Table|string $table) : bool {}
165
166 public function find(string $name, int $version = 0) : ?Symbol\Table {}
167 public function findBest(string $name, int $version = 0) : ?Symbol\Table {}
168 }
169
170 namespace ion;
171 class LOB {
172 public function __construct(
173 public readonly string $value,
174 public readonly Type $type = Type::CLob,
175 ) {
176 }
177 }
178
179 namespace ion\Decimal\Context;
180 enum Rounding : int {
181 case Ceiling = 0;
182 case Up = 1;
183 case HalfUp = 2;
184 case HalfEven = 3;
185 case HalfDown = 4;
186 case Down = 5;
187 case Floor = 6;
188 case Down05Up = 7;
189 }
190
191 namespace ion\Decimal;
192 class Context {
193 public function __construct(
194 public readonly int $digits,
195 public readonly int $eMax,
196 public readonly int $eMin,
197 public readonly Context\Rounding|int $round,
198 public readonly bool $clamp,
199 ) {}
200
201 public static function Dec32() : Context {}
202 public static function Dec64() : Context {}
203 public static function Dec128() : Context {}
204 public static function DecMax(Context\Rounding|int $round = Context\Rounding::HalfEven) : Context {}
205 }
206
207 namespace ion;
208 class Decimal {
209 public function __construct(
210 public readonly string|int $number,
211 public readonly ?Decimal\Context $context = null,
212 ) {}
213
214 public function equals(Decimal $decimal) : bool {}
215 public function isInt() : bool {}
216
217 public function __toString() : string {}
218 /** @alias ion\Decimal::__toString */
219 public function toString() : string {}
220 public function toInt() : int {}
221 }
222
223 namespace ion\Timestamp;
224 enum Precision : int {
225 case Year = 0x1;
226 case Month = 0x1|0x2;
227 case Day = 0x1|0x2|0x4;
228 case Min = 0x1|0x2|0x4|0x10;
229 case Sec = 0x1|0x2|0x4|0x10|0x20;
230 case Frac = 0x1|0x2|0x4|0x10|0x20|0x40;
231 case MinTZ = 0x1|0x2|0x4|0x10|0x80;
232 case SecTZ = 0x1|0x2|0x4|0x10|0x20|0x80;
233 case FracTZ = 0x1|0x2|0x4|0x10|0x20|0x40|0x80;
234 }
235 namespace ion;
236 class Timestamp extends \DateTime {
237 public readonly int $precision;
238 public readonly string $format;
239
240 public function __construct(
241 Timestamp\Precision|int $precision,
242 ?string $format = null,
243 ?string $datetime = null,
244 ?\DateTimeZone $timezone = null,
245 ) {}
246
247 public function __toString() : string {}
248 }
249
250
251 namespace ion;
252 interface Reader extends \RecursiveIterator {
253 public function getType() : Type;
254 public function hasAnnotations() : bool;
255 public function hasAnnotation(string $annotation) : bool;
256 public function isNull() : bool;
257 public function isInStruct() : bool;
258 public function getFieldName() : string;
259 public function getFieldNameSymbol() : Symbol;
260 public function getAnnotations() : array;
261 public function getAnnotationSymbols() : array;
262 public function countAnnotations() : int;
263 public function getAnnotation(int $index) : string;
264 public function getAnnotationSymbol(int $index) : Symbol;
265
266 public function readNull() : Type;
267 public function readBool() : bool;
268 public function readInt() : int|string;
269 public function readFloat() : float;
270 public function readDecimal() : Decimal;
271 public function readTimestamp() : Timestamp;
272 public function readSymbol() : Symbol;
273 public function readString() : string;
274 /** @param ref $string */
275 public function readStringPart(&$string, int $length = 0x1000) : bool;
276 public function readLob() : string;
277 /** @param ref $string */
278 public function readLobPart(&$string, int $length = 0x1000) : bool;
279
280 public function getPosition() : int;
281 public function getDepth() : int;
282
283 public function seek(int $offset, int $length = -1) : void;
284 /*
285 public function getSymbolTable() : SymbolTable;
286 public function setSymbolTable(SymbolTable $table) : void;
287 */
288 public function getValueOffset() : int;
289 public function getValueLength() : int;
290 }
291 namespace ion\Reader;
292 class Options {
293 public function __construct(
294 public readonly ?\ion\Catalog $catalog = null,
295 public readonly ?\ion\Decimal\Context $decimalContext = null,
296 public readonly ?\Closure $onContextChange = null,
297 public readonly bool $returnSystemValues = false,
298 public readonly int $newLine = 0xa,
299 public readonly int $maxContainerDepth = 10,
300 public readonly int $maxAnnotations = 10,
301 public readonly int $maxAnnotationBuffered = 512,
302 public readonly int $symbolThreshold = 0x4000,
303 public readonly int $userValueThreshold = 0x4000,
304 public readonly int $chunkThreshold = 0x4000,
305 public readonly int $allocationPageSize = 0x10000,
306 public readonly bool $skipCharacterValidation = false,
307 ) {}
308 }
309
310 namespace ion\Reader;
311 abstract class Reader implements \ion\Reader {
312 public readonly ?Options $options;
313
314 public function hasChildren() : bool {}
315 public function getChildren() : \ion\Reader {}
316
317 public function rewind() : void {}
318 public function next() : void {}
319 public function valid() : bool {}
320 public function key() : mixed {}
321 public function current() : mixed {}
322
323 public function getType() : \ion\Type {}
324 public function hasAnnotations() : bool {}
325 public function hasAnnotation(string $annotation) : bool {}
326 public function isNull() : bool {}
327 public function isInStruct() : bool {}
328 public function getFieldName() : string {}
329 public function getFieldNameSymbol() : \ion\Symbol {}
330 public function getAnnotations() : array {}
331 public function getAnnotationSymbols() : array {}
332 public function countAnnotations() : int {}
333 public function getAnnotation(int $index) : string {}
334 public function getAnnotationSymbol(int $index) : \ion\Symbol {}
335
336 public function readNull() : \ion\Type {}
337 public function readBool() : bool {}
338 public function readInt() : int|string {}
339 public function readFloat() : float {}
340 public function readDecimal() : \ion\Decimal {}
341 public function readTimestamp() : \ion\Timestamp {}
342 public function readSymbol() : \ion\Symbol {}
343 public function readString() : string {}
344 /** @param ref $string */
345 public function readStringPart(&$string, int $length = 0x1000) : bool {}
346 public function readLob() : string {}
347 /** @param ref $string */
348 public function readLobPart(&$string, int $length = 0x1000) : bool {}
349
350 public function getPosition() : int {}
351 public function getDepth() : int{}
352
353 public function seek(int $offset, int $length = -1) : void {}
354 /*
355 public function getSymbolTable() : SymbolTable {}
356 public function setSymbolTable(SymbolTable $table) : void {}
357 */
358 public function getValueOffset() : int {}
359 public function getValueLength() : int {}
360 }
361 namespace ion\Reader;
362 interface Buffer extends \ion\Reader {
363 public function getBuffer() : string;
364 }
365
366 namespace ion\Reader\Buffer;
367 class Reader extends \ion\Reader\Reader implements \ion\Reader\Buffer {
368 public function __construct(
369 string $buffer,
370 ?\ion\Reader\Options $options = null,
371 ) {}
372
373 public function getBuffer() : string {}
374 }
375
376 namespace ion\Reader;
377 interface Stream extends \ion\Reader {
378 /** @return resource */
379 public function getStream();
380 /** @param resource $stream */
381 public function resetStream($stream) : void;
382 /** @param resource $stream */
383 public function resetStreamWithLength($stream, int $position, int $length = -1) : void;
384 }
385
386 namespace ion\Reader\Stream;
387 class Reader extends \ion\Reader\Reader implements \ion\Reader\Stream {
388 /** @param resource $stream */
389 public function __construct(
390 $stream,
391 ?\ion\Reader\Options $options = null,
392 ) {
393 }
394 /** @return resource */
395 public function getStream() {}
396 /** @param resource $stream */
397 public function resetStream($stream) : void {}
398 /** @param resource $stream */
399 public function resetStreamWithLength($stream, int $position, int $length = -1) : void {}
400 }
401
402 namespace ion\Writer;
403 class Options {
404 public function __construct(
405 public readonly ?\ion\Catalog $catalog = null,
406 public readonly ?\ion\Decimal\Context $decimalContext = null,
407 public readonly bool $outputBinary = false,
408 public readonly bool $compactFloats = false,
409 public readonly bool $escapeNonAscii = false,
410 public readonly bool $prettyPrint = false,
411 public readonly bool $indentTabs = true,
412 public readonly int $indentSize = 2,
413 public readonly bool $smallContainersInline = true,
414 public readonly bool $suppressSystemValues = false,
415 public readonly bool $flushEveryValue = false,
416 public readonly int $maxContainerDepth = 10,
417 public readonly int $maxAnnotations = 10,
418 public readonly int $tempBufferSize = 0x4000,
419 public readonly int $allocationPageSize = 0x10000,
420 ) {}
421 }
422
423 namespace ion;
424 interface Writer {
425 public function writeNull() : void;
426 public function writeTypedNull(Type $type) : void;
427 public function writeBool(bool $value) : void;
428 public function writeInt(int|string $value) : void;
429 public function writeFloat(float $value) : void;
430 public function writeDecimal(Decimal|string $value) : void;
431 public function writeTimestamp(Timestamp|string $value) : void;
432 public function writeSymbol(Symbol|string $value) : void;
433 public function writeString(string $value) : void;
434 public function writeCLob(string $value) : void;
435 public function writeBLob(string $value) : void;
436
437 public function startLob(Type $type) : void;
438 public function appendLob(string $data) : void;
439 public function finishLob() : void;
440
441 public function startContainer(Type $type) : void;
442 public function finishContainer() : void;
443
444 public function writeFieldName(string $name) : void;
445
446 public function writeAnnotation(Symbol|string ...$annotation) : void;
447
448 public function getDepth() : int;
449 public function flush() : int;
450 public function finish() : int;
451
452 public function writeOne(Reader $reader) : void;
453 public function writeAll(Reader $reader) : void;
454
455 // public function getCatalog() : Catalog;
456 // public function setCatalog(Catalog $catalog) : void;
457
458 // public function getSymbolTable() : Symbol\Table;
459 // puvlic function setSymbolTable(Symbol\Table $table) : void;
460 }
461
462 namespace ion\Writer;
463 abstract class Writer implements \ion\Writer {
464 public function writeNull() : void {}
465 public function writeTypedNull(\ion\Type $type) : void {}
466 public function writeBool(bool $value) : void {}
467 public function writeInt(int|string $value) : void {}
468 public function writeFloat(float $value) : void {}
469 public function writeDecimal(\ion\Decimal|string $value) : void {}
470 public function writeTimestamp(\ion\Timestamp|string $value) : void {}
471 public function writeSymbol(\ion\Symbol|string $value) : void {}
472 public function writeString(string $value) : void {}
473 public function writeCLob(string $value) : void {}
474 public function writeBLob(string $value) : void {}
475
476 public function startLob(\ion\Type $type) : void {}
477 public function appendLob(string $data) : void {}
478 public function finishLob() : void {}
479
480 public function startContainer(\ion\Type $type) : void {}
481 public function finishContainer() : void {}
482
483 public function writeFieldName(string $name) : void {}
484
485 public function writeAnnotation(\ion\Symbol|string ...$annotation) : void {}
486
487 public function getDepth() : int {}
488 public function flush() : int {}
489 public function finish() : int {}
490
491 public function writeOne(\ion\Reader $reader) : void {}
492 public function writeAll(\ion\Reader $reader) : void {}
493 }
494
495 namespace ion\Writer;
496 interface Buffer extends \ion\Writer {
497 public function getBuffer() : string;
498 }
499
500 namespace ion\Writer\Buffer;
501 class Writer extends \ion\Writer\Writer implements \ion\Writer\Buffer {
502 /** @param ref $buffer */
503 public function __construct(
504 ?string &$buffer,
505 ?\ion\Writer\Options $options = null,
506 ) {}
507
508 /**
509 * @return string a _copy_ of $buffer passed to the constructor
510 */
511 public function getBuffer() : string {}
512 }
513
514 namespace ion\Writer;
515 interface Stream extends \ion\Writer {
516 /** @return resource */
517 public function getStream();
518 }
519
520 namespace ion\Writer\Stream;
521 class Writer extends \ion\Writer\Writer implements \ion\Writer\Stream {
522 /** @param resource $stream */
523 public function __construct(
524 $stream,
525 ?\ion\Writer\Options $options = null,
526 ) {}
527 /** @return resource */
528 public function getStream() {}
529 }
530
531 namespace ion;
532 interface Serializer {
533 public function serialize(mixed $data) : string;
534 }
535 namespace ion;
536 interface Unserializer {
537 /** @param string|resource $data */
538 public function unserialize($data) : mixed;
539 }
540
541 namespace ion\Serializer;
542 class PHP implements \ion\Serializer {
543 public function __construct(
544 public readonly ?\ion\Writer\Options $writerOptions = null,
545 public readonly bool $multiSequence = false,
546 public readonly bool $callMagicSerialize = true,
547 public readonly ?string $callCustomSerialize = null,
548 ) {}
549 public function serialize(mixed $data) : string {}
550 }
551
552 namespace ion\Unserializer;
553 class PHP implements \ion\Unserializer {
554 public function __construct(
555 public readonly ?\ion\Reader\Options $readerOptions = null,
556 public readonly bool $multiSequence = false,
557 public readonly bool $callMagicUnserialize = true,
558 public readonly ?string $callCustomUnserialize = null,
559 ){}
560 /** @param string|resource $data */
561 public function unserialize($data) : mixed {}
562 }
563
564 namespace ion;
565 function serialize(mixed $data, ?Serializer $serializer = null) : string {}
566 /** @param string|resource $data */
567 function unserialize($data, ?Unserializer $unserializer = null) : mixed {}