xref: /php-src/ext/dom/php_dom.stub.php (revision a3b27c08)
1<?php
2
3/** @generate-class-entries */
4
5namespace
6{
7    /**
8     * @var int
9     * @cvalue XML_ELEMENT_NODE
10     */
11    const XML_ELEMENT_NODE = UNKNOWN;
12    /**
13     * @var int
14     * @cvalue XML_ATTRIBUTE_NODE
15     */
16    const XML_ATTRIBUTE_NODE = UNKNOWN;
17    /**
18     * @var int
19     * @cvalue XML_TEXT_NODE
20     */
21    const XML_TEXT_NODE = UNKNOWN;
22    /**
23     * @var int
24     * @cvalue XML_CDATA_SECTION_NODE
25     */
26    const XML_CDATA_SECTION_NODE = UNKNOWN;
27    /**
28     * @var int
29     * @cvalue XML_ENTITY_REF_NODE
30     */
31    const XML_ENTITY_REF_NODE = UNKNOWN;
32    /**
33     * @var int
34     * @cvalue XML_ENTITY_NODE
35     */
36    const XML_ENTITY_NODE = UNKNOWN;
37    /**
38     * @var int
39     * @cvalue XML_PI_NODE
40     */
41    const XML_PI_NODE = UNKNOWN;
42    /**
43     * @var int
44     * @cvalue XML_COMMENT_NODE
45     */
46    const XML_COMMENT_NODE = UNKNOWN;
47    /**
48     * @var int
49     * @cvalue XML_DOCUMENT_NODE
50     */
51    const XML_DOCUMENT_NODE = UNKNOWN;
52    /**
53     * @var int
54     * @cvalue XML_DOCUMENT_TYPE_NODE
55     */
56    const XML_DOCUMENT_TYPE_NODE = UNKNOWN;
57    /**
58     * @var int
59     * @cvalue XML_DOCUMENT_FRAG_NODE
60     */
61    const XML_DOCUMENT_FRAG_NODE = UNKNOWN;
62    /**
63     * @var int
64     * @cvalue XML_NOTATION_NODE
65     */
66    const XML_NOTATION_NODE = UNKNOWN;
67    /**
68     * @var int
69     * @cvalue XML_HTML_DOCUMENT_NODE
70     */
71    const XML_HTML_DOCUMENT_NODE = UNKNOWN;
72    /**
73     * @var int
74     * @cvalue XML_DTD_NODE
75     */
76    const XML_DTD_NODE = UNKNOWN;
77    /**
78     * @var int
79     * @cvalue XML_ELEMENT_DECL
80     */
81    const XML_ELEMENT_DECL_NODE = UNKNOWN;
82    /**
83     * @var int
84     * @cvalue XML_ATTRIBUTE_DECL
85     */
86    const XML_ATTRIBUTE_DECL_NODE = UNKNOWN;
87    /**
88     * @var int
89     * @cvalue XML_ENTITY_DECL
90     */
91    const XML_ENTITY_DECL_NODE = UNKNOWN;
92    /**
93     * @var int
94     * @cvalue XML_NAMESPACE_DECL
95     */
96    const XML_NAMESPACE_DECL_NODE = UNKNOWN;
97    /**
98     * @var int
99     * @cvalue XML_LOCAL_NAMESPACE
100     */
101    const XML_LOCAL_NAMESPACE = UNKNOWN;
102    /**
103     * @var int
104     * @cvalue XML_ATTRIBUTE_CDATA
105     */
106    const XML_ATTRIBUTE_CDATA = UNKNOWN;
107    /**
108     * @var int
109     * @cvalue XML_ATTRIBUTE_ID
110     */
111    const XML_ATTRIBUTE_ID = UNKNOWN;
112    /**
113     * @var int
114     * @cvalue XML_ATTRIBUTE_IDREF
115     */
116    const XML_ATTRIBUTE_IDREF = UNKNOWN;
117    /**
118     * @var int
119     * @cvalue XML_ATTRIBUTE_IDREFS
120     */
121    const XML_ATTRIBUTE_IDREFS = UNKNOWN;
122    /**
123     * @var int
124     * @cvalue XML_ATTRIBUTE_ENTITIES
125     */
126    const XML_ATTRIBUTE_ENTITY = UNKNOWN;
127    /**
128     * @var int
129     * @cvalue XML_ATTRIBUTE_NMTOKEN
130     */
131    const XML_ATTRIBUTE_NMTOKEN = UNKNOWN;
132    /**
133     * @var int
134     * @cvalue XML_ATTRIBUTE_NMTOKENS
135     */
136    const XML_ATTRIBUTE_NMTOKENS = UNKNOWN;
137    /**
138     * @var int
139     * @cvalue XML_ATTRIBUTE_ENUMERATION
140     */
141    const XML_ATTRIBUTE_ENUMERATION = UNKNOWN;
142    /**
143     * @var int
144     * @cvalue XML_ATTRIBUTE_NOTATION
145     */
146    const XML_ATTRIBUTE_NOTATION = UNKNOWN;
147
148    /**
149     * @var int
150     * @deprecated is no longer used since 8.4
151     * @cvalue PHP_ERR
152     */
153    const DOM_PHP_ERR = UNKNOWN;
154    /**
155     * @var int
156     * @cvalue INDEX_SIZE_ERR
157     */
158    const DOM_INDEX_SIZE_ERR = UNKNOWN;
159    /**
160     * @var int
161     * @cvalue DOMSTRING_SIZE_ERR
162     */
163    const DOMSTRING_SIZE_ERR = UNKNOWN;
164    /**
165     * @var int
166     * @cvalue HIERARCHY_REQUEST_ERR
167     */
168    const DOM_HIERARCHY_REQUEST_ERR = UNKNOWN;
169    /**
170     * @var int
171     * @cvalue WRONG_DOCUMENT_ERR
172     */
173    const DOM_WRONG_DOCUMENT_ERR = UNKNOWN;
174    /**
175     * @var int
176     * @cvalue INVALID_CHARACTER_ERR
177     */
178    const DOM_INVALID_CHARACTER_ERR = UNKNOWN;
179    /**
180     * @var int
181     * @cvalue NO_DATA_ALLOWED_ERR
182     */
183    const DOM_NO_DATA_ALLOWED_ERR = UNKNOWN;
184    /**
185     * @var int
186     * @cvalue NO_MODIFICATION_ALLOWED_ERR
187     */
188    const DOM_NO_MODIFICATION_ALLOWED_ERR = UNKNOWN;
189    /**
190     * @var int
191     * @cvalue NOT_FOUND_ERR
192     */
193    const DOM_NOT_FOUND_ERR = UNKNOWN;
194    /**
195     * @var int
196     * @cvalue NOT_SUPPORTED_ERR
197     */
198    const DOM_NOT_SUPPORTED_ERR = UNKNOWN;
199    /**
200     * @var int
201     * @cvalue INUSE_ATTRIBUTE_ERR
202     */
203    const DOM_INUSE_ATTRIBUTE_ERR = UNKNOWN;
204    /**
205     * @var int
206     * @cvalue INVALID_STATE_ERR
207     */
208    const DOM_INVALID_STATE_ERR = UNKNOWN;
209    /**
210     * @var int
211     * @cvalue SYNTAX_ERR
212     */
213    const DOM_SYNTAX_ERR = UNKNOWN;
214    /**
215     * @var int
216     * @cvalue INVALID_MODIFICATION_ERR
217     */
218    const DOM_INVALID_MODIFICATION_ERR = UNKNOWN;
219    /**
220     * @var int
221     * @cvalue NAMESPACE_ERR
222     */
223    const DOM_NAMESPACE_ERR = UNKNOWN;
224    /**
225     * @var int
226     * @cvalue INVALID_ACCESS_ERR
227     */
228    const DOM_INVALID_ACCESS_ERR = UNKNOWN;
229    /**
230     * @var int
231     * @cvalue VALIDATION_ERR
232     */
233    const DOM_VALIDATION_ERR = UNKNOWN;
234
235    class DOMDocumentType extends DOMNode
236    {
237        /**
238         * @readonly
239         * @virtual
240         */
241        public string $name;
242
243        /**
244         * @readonly
245         * @virtual
246         */
247        public DOMNamedNodeMap $entities;
248
249        /**
250         * @readonly
251         * @virtual
252         */
253        public DOMNamedNodeMap $notations;
254
255        /**
256         * @readonly
257         * @virtual
258         */
259        public string $publicId;
260
261        /**
262         * @readonly
263         * @virtual
264         */
265        public string $systemId;
266
267        /**
268         * @readonly
269         * @virtual
270         */
271        public ?string $internalSubset;
272    }
273
274    class DOMCdataSection extends DOMText
275    {
276        public function __construct(string $data) {}
277    }
278
279    class DOMComment extends DOMCharacterData
280    {
281        public function __construct(string $data = "") {}
282    }
283
284    interface DOMParentNode
285    {
286        /** @param DOMNode|string $nodes */
287        public function append(...$nodes): void;
288
289        /** @param DOMNode|string $nodes */
290        public function prepend(...$nodes): void;
291
292        /** @param DOMNode|string $nodes */
293        public function replaceChildren(...$nodes): void;
294    }
295
296    interface DOMChildNode
297    {
298        public function remove(): void;
299
300        /** @param DOMNode|string $nodes */
301        public function before(... $nodes): void;
302
303        /** @param DOMNode|string $nodes */
304        public function after(...$nodes): void;
305
306        /** @param DOMNode|string $nodes */
307        public function replaceWith(...$nodes): void;
308    }
309
310    class DOMNode
311    {
312        public const int DOCUMENT_POSITION_DISCONNECTED = 0x01;
313        public const int DOCUMENT_POSITION_PRECEDING = 0x02;
314        public const int DOCUMENT_POSITION_FOLLOWING = 0x04;
315        public const int DOCUMENT_POSITION_CONTAINS = 0x08;
316        public const int DOCUMENT_POSITION_CONTAINED_BY = 0x10;
317        public const int DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
318
319        /**
320         * @readonly
321         * @virtual
322         */
323        public string $nodeName;
324
325        /** @virtual */
326        public ?string $nodeValue;
327
328        /**
329         * @readonly
330         * @virtual
331         */
332        public int $nodeType;
333
334        /**
335         * @readonly
336         * @virtual
337         */
338        public ?DOMNode $parentNode;
339
340        /**
341         * @readonly
342         * @virtual
343         */
344        public ?DOMElement $parentElement;
345
346        /**
347         * @readonly
348         * @virtual
349         */
350        public DOMNodeList $childNodes;
351
352        /**
353         * @readonly
354         * @virtual
355         */
356        public ?DOMNode $firstChild;
357
358        /**
359         * @readonly
360         * @virtual
361         */
362        public ?DOMNode $lastChild;
363
364        /**
365         * @readonly
366         * @virtual
367         */
368        public ?DOMNode $previousSibling;
369
370        /**
371         * @readonly
372         * @virtual
373         */
374        public ?DOMNode $nextSibling;
375
376        /**
377         * @readonly
378         * @virtual
379         */
380        public ?DOMNamedNodeMap $attributes;
381
382        /**
383         * @readonly
384         * @virtual
385         */
386        public bool $isConnected;
387
388        /**
389         * @readonly
390         * @virtual
391         */
392        public ?DOMDocument $ownerDocument;
393
394        /**
395         * @readonly
396         * @virtual
397         */
398        public ?string $namespaceURI;
399
400        /** @virtual */
401        public string $prefix;
402
403        /**
404         * @readonly
405         * @virtual
406         */
407        public ?string $localName;
408
409        /**
410         * @readonly
411         * @virtual
412         */
413        public ?string $baseURI;
414
415        /** @virtual */
416        public string $textContent;
417
418        /** @return DOMNode|false */
419        public function appendChild(DOMNode $node) {}
420
421        /** @tentative-return-type */
422        public function C14N(bool $exclusive = false, bool $withComments = false, ?array $xpath = null, ?array $nsPrefixes = null): string|false {}
423
424        /** @tentative-return-type */
425        public function C14NFile(string $uri, bool $exclusive = false, bool $withComments = false, ?array $xpath = null, ?array $nsPrefixes = null): int|false {}
426
427        /** @return DOMNode|false */
428        public function cloneNode(bool $deep = false) {}
429
430        /** @tentative-return-type */
431        public function getLineNo(): int {}
432
433        /** @tentative-return-type */
434        public function getNodePath(): ?string {}
435
436        /** @tentative-return-type */
437        public function hasAttributes(): bool {}
438
439        /** @tentative-return-type */
440        public function hasChildNodes(): bool {}
441
442        /** @return DOMNode|false */
443        public function insertBefore(DOMNode $node, ?DOMNode $child = null) {}
444
445        /** @tentative-return-type */
446        public function isDefaultNamespace(string $namespace): bool {}
447
448        /** @tentative-return-type */
449        public function isSameNode(DOMNode $otherNode): bool {}
450
451        public function isEqualNode(?DOMNode $otherNode): bool {}
452
453        /** @tentative-return-type */
454        public function isSupported(string $feature, string $version): bool {}
455
456        /** @tentative-return-type */
457        public function lookupNamespaceURI(?string $prefix): ?string {}
458
459        /** @tentative-return-type */
460        public function lookupPrefix(string $namespace): ?string {}
461
462        /** @tentative-return-type */
463        public function normalize(): void {}
464
465        /** @return DOMNode|false */
466        public function removeChild(DOMNode $child) {}
467
468        /** @return DOMNode|false */
469        public function replaceChild(DOMNode $node, DOMNode $child) {}
470
471        public function contains(DOMNode|DOMNameSpaceNode|null $other): bool {}
472
473        public function getRootNode(?array $options = null): DOMNode {}
474
475        public function compareDocumentPosition(DOMNode $other): int {}
476
477        public function __sleep(): array {}
478
479        public function __wakeup(): void {}
480    }
481
482    class DOMNameSpaceNode
483    {
484        /**
485         * @readonly
486         * @virtual
487         */
488        public string $nodeName;
489
490        /**
491         * @readonly
492         * @virtual
493         */
494        public ?string $nodeValue;
495
496        /**
497         * @readonly
498         * @virtual
499         */
500        public int $nodeType;
501
502        /**
503         * @readonly
504         * @virtual
505         */
506        public string $prefix;
507
508        /**
509         * @readonly
510         * @virtual
511         */
512        public ?string $localName;
513
514        /**
515         * @readonly
516         * @virtual
517         */
518        public ?string $namespaceURI;
519
520        /**
521         * @readonly
522         * @virtual
523         */
524        public bool $isConnected;
525
526        /**
527         * @readonly
528         * @virtual
529         */
530        public ?DOMDocument $ownerDocument;
531
532        /**
533         * @readonly
534         * @virtual
535         */
536        public ?DOMNode $parentNode;
537
538        /**
539         * @readonly
540         * @virtual
541         */
542        public ?DOMElement $parentElement;
543
544        /** @implementation-alias DOMNode::__sleep */
545        public function __sleep(): array {}
546
547        /** @implementation-alias DOMNode::__wakeup */
548        public function __wakeup(): void {}
549    }
550
551    class DOMImplementation
552    {
553        /** @tentative-return-type */
554        public function hasFeature(string $feature, string $version): bool {}
555
556        /** @return DOMDocumentType|false */
557        public function createDocumentType(string $qualifiedName, string $publicId = "", string $systemId = "") {}
558
559        /** @tentative-return-type */
560        public function createDocument(?string $namespace = null, string $qualifiedName = "", ?DOMDocumentType $doctype = null): DOMDocument {}
561    }
562
563    class DOMDocumentFragment extends DOMNode implements DOMParentNode
564    {
565        /**
566         * @readonly
567         * @virtual
568         */
569        public ?DOMElement $firstElementChild;
570
571        /**
572         * @readonly
573         * @virtual
574         */
575        public ?DOMElement $lastElementChild;
576
577        /**
578         * @readonly
579         * @virtual
580         */
581        public int $childElementCount;
582
583        public function __construct() {}
584
585        /** @tentative-return-type */
586        public function appendXML(string $data): bool {}
587
588        /**
589         * @param DOMNode|string $nodes
590         * @implementation-alias DOMElement::append
591         */
592        public function append(...$nodes): void {}
593
594        /**
595         * @param DOMNode|string $nodes
596         * @implementation-alias DOMElement::prepend
597         */
598        public function prepend(...$nodes): void {}
599
600        /**
601         * @param DOMNode|string $nodes
602         * @implementation-alias DOMDocument::replaceChildren
603         */
604        public function replaceChildren(...$nodes): void {}
605    }
606
607    class DOMNodeList implements IteratorAggregate, Countable
608    {
609        /**
610         * @readonly
611         * @virtual
612         */
613        public int $length;
614
615        /** @tentative-return-type */
616        public function count(): int {}
617
618        public function getIterator(): Iterator {}
619
620        /** @return DOMElement|DOMNode|DOMNameSpaceNode|null */
621        public function item(int $index) {}
622    }
623
624    class DOMCharacterData extends DOMNode implements DOMChildNode
625    {
626        /** @virtual */
627        public string $data;
628
629        /**
630         * @readonly
631         * @virtual
632         */
633        public int $length;
634
635        /**
636         * @readonly
637         * @virtual
638         */
639        public ?DOMElement $previousElementSibling;
640
641        /**
642         * @readonly
643         * @virtual
644         */
645        public ?DOMElement $nextElementSibling;
646
647        /** @tentative-return-type */
648        public function appendData(string $data): true {}
649
650        /** @return string|false */
651        public function substringData(int $offset, int $count) {}
652
653        /** @tentative-return-type */
654        public function insertData(int $offset, string $data): bool {}
655
656        /** @tentative-return-type */
657        public function deleteData(int $offset, int $count): bool {}
658
659        /** @tentative-return-type */
660        public function replaceData(int $offset, int $count, string $data): bool {}
661
662        /**
663         * @param DOMNode|string $nodes
664         * @implementation-alias DOMElement::replaceWith
665         */
666        public function replaceWith(...$nodes): void {}
667
668        /** @implementation-alias DOMElement::remove */
669        public function remove(): void {}
670
671        /**
672         * @param DOMNode|string $nodes
673         * @implementation-alias DOMElement::before
674         */
675        public function before(... $nodes): void {}
676
677        /**
678         * @param DOMNode|string $nodes
679         * @implementation-alias DOMElement::after
680         */
681        public function after(...$nodes): void {}
682    }
683
684    class DOMAttr extends DOMNode
685    {
686        /**
687         * @readonly
688         * @virtual
689         */
690        public string $name;
691
692        /**
693         * @readonly
694         * @virtual
695         */
696        public bool $specified;
697
698        /** @virtual */
699        public string $value;
700
701        /**
702         * @readonly
703         * @virtual
704         */
705        public ?DOMElement $ownerElement;
706
707        /**
708         * @readonly
709         * @virtual
710         */
711        public mixed $schemaTypeInfo;
712
713        public function __construct(string $name, string $value = "") {}
714
715        /** @tentative-return-type */
716        public function isId(): bool {}
717    }
718
719    class DOMElement extends DOMNode implements \DOMParentNode, \DOMChildNode
720    {
721        /**
722         * @readonly
723         * @virtual
724         */
725        public string $tagName;
726
727        /** @virtual */
728        public string $className;
729
730        /** @virtual */
731        public string $id;
732
733        /**
734         * @readonly
735         * @virtual
736         */
737        public mixed $schemaTypeInfo;
738
739        /**
740         * @readonly
741         * @virtual
742         */
743        public ?DOMElement $firstElementChild;
744
745        /**
746         * @readonly
747         * @virtual
748         */
749        public ?DOMElement $lastElementChild;
750
751        /**
752         * @readonly
753         * @virtual
754         */
755        public int $childElementCount;
756
757        /**
758         * @readonly
759         * @virtual
760         */
761        public ?DOMElement $previousElementSibling;
762
763        /**
764         * @readonly
765         * @virtual
766         */
767        public ?DOMElement $nextElementSibling;
768
769        public function __construct(string $qualifiedName, ?string $value = null, string $namespace = "") {}
770
771        /** @tentative-return-type */
772        public function getAttribute(string $qualifiedName): string {}
773
774        public function getAttributeNames(): array {}
775
776        /** @tentative-return-type */
777        public function getAttributeNS(?string $namespace, string $localName): string {}
778
779        /** @return DOMAttr|DOMNameSpaceNode|false */
780        public function getAttributeNode(string $qualifiedName) {}
781
782        /** @return DOMAttr|DOMNameSpaceNode|null */
783        public function getAttributeNodeNS(?string $namespace, string $localName) {}
784
785        /** @tentative-return-type */
786        public function getElementsByTagName(string $qualifiedName): DOMNodeList {}
787
788        /** @tentative-return-type */
789        public function getElementsByTagNameNS(?string $namespace, string $localName): DOMNodeList {}
790
791        /** @tentative-return-type */
792        public function hasAttribute(string $qualifiedName): bool {}
793
794        /** @tentative-return-type */
795        public function hasAttributeNS(?string $namespace, string $localName): bool {}
796
797        /** @tentative-return-type */
798        public function removeAttribute(string $qualifiedName): bool {}
799
800        /** @tentative-return-type */
801        public function removeAttributeNS(?string $namespace, string $localName): void {}
802
803        /** @return DOMAttr|false */
804        public function removeAttributeNode(DOMAttr $attr) {}
805
806        /** @return DOMAttr|bool */
807        public function setAttribute(string $qualifiedName, string $value) {}
808
809        /** @tentative-return-type */
810        public function setAttributeNS(?string $namespace, string $qualifiedName, string $value): void {}
811
812        /** @return DOMAttr|null|false */
813        public function setAttributeNode(DOMAttr $attr) {}
814
815        /** @return DOMAttr|null|false */
816        public function setAttributeNodeNS(DOMAttr $attr) {}
817
818        /** @tentative-return-type */
819        public function setIdAttribute(string $qualifiedName, bool $isId): void {}
820
821        /** @tentative-return-type */
822        public function setIdAttributeNS(string $namespace, string $qualifiedName, bool $isId): void {}
823
824        /** @tentative-return-type */
825        public function setIdAttributeNode(DOMAttr $attr, bool $isId): void {}
826
827        public function toggleAttribute(string $qualifiedName, ?bool $force = null): bool {}
828
829        public function remove(): void {}
830
831        /** @param DOMNode|string $nodes */
832        public function before(... $nodes): void {}
833
834        /** @param DOMNode|string $nodes */
835        public function after(...$nodes): void {}
836
837        /** @param DOMNode|string $nodes */
838        public function replaceWith(...$nodes): void {}
839
840        /** @param DOMNode|string $nodes */
841        public function append(...$nodes): void {}
842
843        /** @param DOMNode|string $nodes */
844        public function prepend(...$nodes): void {}
845
846        /** @param DOMNode|string $nodes */
847        public function replaceChildren(...$nodes): void {}
848
849        public function insertAdjacentElement(string $where, DOMElement $element): ?DOMElement {}
850
851        public function insertAdjacentText(string $where, string $data): void {}
852    }
853
854    class DOMDocument extends DOMNode implements DOMParentNode
855    {
856        /**
857         * @readonly
858         * @virtual
859         */
860        public ?DOMDocumentType $doctype;
861
862        /**
863         * @readonly
864         * @virtual
865         */
866        public DOMImplementation $implementation;
867
868        /**
869         * @readonly
870         * @virtual
871         */
872        public ?DOMElement $documentElement;
873
874        /**
875         * @readonly
876         * @deprecated
877         * @virtual
878         */
879        public ?string $actualEncoding;
880
881        /** @virtual */
882        public ?string $encoding;
883
884        /**
885         * @readonly
886         * @virtual
887         */
888        public ?string $xmlEncoding;
889
890        /** @virtual */
891        public bool $standalone;
892
893        /** @virtual */
894        public bool $xmlStandalone;
895
896        /** @virtual */
897        public ?string $version;
898
899        /** @virtual */
900        public ?string $xmlVersion;
901
902        /** @virtual */
903        public bool $strictErrorChecking;
904
905        /** @virtual */
906        public ?string $documentURI;
907
908        /**
909         * @readonly
910         * @deprecated
911         * @virtual
912         */
913        public mixed $config;
914
915        /** @virtual */
916        public bool $formatOutput;
917
918        /** @virtual */
919        public bool $validateOnParse;
920
921        /** @virtual */
922        public bool $resolveExternals;
923
924        /** @virtual */
925        public bool $preserveWhiteSpace;
926
927        /** @virtual */
928        public bool $recover;
929
930        /** @virtual */
931        public bool $substituteEntities;
932
933        /**
934         * @readonly
935         * @virtual
936         */
937        public ?DOMElement $firstElementChild;
938
939        /**
940         * @readonly
941         * @virtual
942         */
943        public ?DOMElement $lastElementChild;
944
945        /**
946         * @readonly
947         * @virtual
948         */
949        public int $childElementCount;
950
951        public function __construct(string $version = "1.0", string $encoding = "") {}
952
953        /** @return DOMAttr|false */
954        public function createAttribute(string $localName) {}
955
956        /** @return DOMAttr|false */
957        public function createAttributeNS(?string $namespace, string $qualifiedName) {}
958
959        /** @return DOMCdataSection|false */
960        public function createCDATASection(string $data) {}
961
962        /** @tentative-return-type */
963        public function createComment(string $data): DOMComment {}
964
965        /** @tentative-return-type */
966        public function createDocumentFragment(): DOMDocumentFragment {}
967
968        /** @return DOMElement|false */
969        public function createElement(string $localName, string $value = "")  {}
970
971        /** @return DOMElement|false */
972        public function createElementNS(?string $namespace, string $qualifiedName, string $value = "") {}
973
974        /** @return DOMEntityReference|false */
975        public function createEntityReference(string $name) {}
976
977        /** @return DOMProcessingInstruction|false */
978        public function createProcessingInstruction(string $target, string $data = "") {}
979
980        /** @tentative-return-type */
981        public function createTextNode(string $data): DOMText {}
982
983        /** @tentative-return-type */
984        public function getElementById(string $elementId): ?DOMElement {}
985
986        /**
987         * @tentative-return-type
988         * @implementation-alias DOMElement::getElementsByTagName
989         */
990        public function getElementsByTagName(string $qualifiedName): DOMNodeList {}
991
992        /**
993         * @tentative-return-type
994         * @implementation-alias DOMElement::getElementsByTagNameNS
995         */
996        public function getElementsByTagNameNS(?string $namespace, string $localName): DOMNodeList {}
997
998        /** @return DOMNode|false */
999        public function importNode(DOMNode $node, bool $deep = false) {}
1000
1001        /** @tentative-return-type */
1002        public function load(string $filename, int $options = 0): bool {}
1003
1004        /** @tentative-return-type */
1005        public function loadXML(string $source, int $options = 0): bool {}
1006
1007        /** @tentative-return-type */
1008        public function normalizeDocument(): void {}
1009
1010        /** @tentative-return-type */
1011        public function registerNodeClass(string $baseClass, ?string $extendedClass): true {}
1012
1013        /** @tentative-return-type */
1014        public function save(string $filename, int $options = 0): int|false {}
1015
1016#ifdef LIBXML_HTML_ENABLED
1017        /** @tentative-return-type */
1018        public function loadHTML(string $source, int $options = 0): bool {}
1019
1020        /** @tentative-return-type */
1021        public function loadHTMLFile(string $filename, int $options = 0): bool {}
1022
1023        /** @tentative-return-type */
1024        public function saveHTML(?DOMNode $node = null): string|false {}
1025
1026        /** @tentative-return-type */
1027        public function saveHTMLFile(string $filename): int|false {}
1028#endif
1029
1030        /** @tentative-return-type */
1031        public function saveXML(?DOMNode $node = null, int $options = 0): string|false {}
1032
1033#ifdef LIBXML_SCHEMAS_ENABLED
1034        /** @tentative-return-type */
1035        public function schemaValidate(string $filename, int $flags = 0): bool {}
1036
1037        /** @tentative-return-type */
1038        public function schemaValidateSource(string $source, int $flags = 0): bool {}
1039
1040        /** @tentative-return-type */
1041        public function relaxNGValidate(string $filename): bool {}
1042
1043        /** @tentative-return-type */
1044        public function relaxNGValidateSource(string $source): bool {}
1045#endif
1046
1047        /** @tentative-return-type */
1048        public function validate(): bool {}
1049
1050        /** @tentative-return-type */
1051        public function xinclude(int $options = 0): int|false {}
1052
1053        /** @tentative-return-type */
1054        public function adoptNode(DOMNode $node): DOMNode|false {}
1055
1056        /**
1057         * @param DOMNode|string $nodes
1058         * @implementation-alias DOMElement::append
1059         */
1060        public function append(...$nodes): void {}
1061
1062        /**
1063         * @param DOMNode|string $nodes
1064         * @implementation-alias DOMElement::prepend
1065         */
1066        public function prepend(...$nodes): void {}
1067
1068        /** @param DOMNode|string $nodes */
1069        public function replaceChildren(...$nodes): void {}
1070    }
1071
1072    /** @alias Dom\DOMException */
1073    final class DOMException extends Exception
1074    {
1075        /**
1076         * Intentionally left untyped for BC reasons
1077         * @var int
1078         */
1079        public $code = 0; // TODO add proper type (i.e. int|string)
1080    }
1081
1082    class DOMText extends DOMCharacterData
1083    {
1084        /**
1085         * @readonly
1086         * @virtual
1087         */
1088        public string $wholeText;
1089
1090        public function __construct(string $data = "") {}
1091
1092        /** @tentative-return-type */
1093        public function isWhitespaceInElementContent(): bool {}
1094
1095        /**
1096         * @tentative-return-type
1097         * @alias DOMText::isWhitespaceInElementContent
1098         */
1099        public function isElementContentWhitespace(): bool {}
1100
1101        /** @return DOMText|false */
1102        public function splitText(int $offset) {}
1103    }
1104
1105    class DOMNamedNodeMap implements IteratorAggregate, Countable
1106    {
1107        /**
1108         * @readonly
1109         * @virtual
1110         */
1111        public int $length;
1112
1113        /** @tentative-return-type */
1114        public function getNamedItem(string $qualifiedName): ?DOMNode {}
1115
1116        /** @tentative-return-type */
1117        public function getNamedItemNS(?string $namespace, string $localName): ?DOMNode {}
1118
1119        /** @tentative-return-type */
1120        public function item(int $index): ?DOMNode {}
1121
1122        /** @tentative-return-type */
1123        public function count(): int {}
1124
1125        public function getIterator(): Iterator {}
1126    }
1127
1128    class DOMEntity extends DOMNode
1129    {
1130        /**
1131         * @readonly
1132         * @virtual
1133         */
1134        public ?string $publicId;
1135
1136        /**
1137         * @readonly
1138         * @virtual
1139         */
1140        public ?string $systemId;
1141
1142        /**
1143         * @readonly
1144         * @virtual
1145         */
1146        public ?string $notationName;
1147
1148        /**
1149         * @readonly
1150         * @deprecated
1151         * @virtual
1152         */
1153        public ?string $actualEncoding;
1154
1155        /**
1156         * @readonly
1157         * @deprecated
1158         * @virtual
1159         */
1160        public ?string $encoding;
1161
1162        /**
1163         * @readonly
1164         * @deprecated
1165         * @virtual
1166         */
1167        public ?string $version;
1168    }
1169
1170    class DOMEntityReference extends DOMNode
1171    {
1172        public function __construct(string $name) {}
1173    }
1174
1175    class DOMNotation extends DOMNode
1176    {
1177        /**
1178         * @readonly
1179         * @virtual
1180         */
1181        public string $publicId;
1182
1183        /**
1184         * @readonly
1185         * @virtual
1186         */
1187        public string $systemId;
1188    }
1189
1190    class DOMProcessingInstruction extends DOMNode
1191    {
1192        /**
1193         * @readonly
1194         * @virtual
1195         */
1196        public string $target;
1197
1198        /** @virtual */
1199        public string $data;
1200
1201        public function __construct(string $name, string $value = "") {}
1202    }
1203
1204#ifdef LIBXML_XPATH_ENABLED
1205    /** @not-serializable */
1206    class DOMXPath
1207    {
1208        /**
1209         * @readonly
1210         * @virtual
1211         */
1212        public DOMDocument $document;
1213
1214        /** @virtual */
1215        public bool $registerNodeNamespaces;
1216
1217        public function __construct(DOMDocument $document, bool $registerNodeNS = true) {}
1218
1219        /** @tentative-return-type */
1220        public function evaluate(string $expression, ?DOMNode $contextNode = null, bool $registerNodeNS = true): mixed {}
1221
1222        /** @tentative-return-type */
1223        public function query(string $expression, ?DOMNode $contextNode = null, bool $registerNodeNS = true): mixed {}
1224
1225        /** @tentative-return-type */
1226        public function registerNamespace(string $prefix, string $namespace): bool {}
1227
1228        /** @tentative-return-type */
1229        public function registerPhpFunctions(string|array|null $restrict = null): void {}
1230
1231        public function registerPhpFunctionNS(string $namespaceURI, string $name, callable $callable): void {}
1232
1233        public static function quote(string $str): string {}
1234    }
1235#endif
1236
1237    function dom_import_simplexml(object $node): DOMAttr|DOMElement {}
1238}
1239
1240namespace Dom
1241{
1242    /**
1243     * @var int
1244     * @cvalue INDEX_SIZE_ERR
1245     */
1246    const INDEX_SIZE_ERR = UNKNOWN;
1247    /**
1248     * @var int
1249     * @cvalue DOMSTRING_SIZE_ERR
1250     */
1251    const STRING_SIZE_ERR = UNKNOWN;
1252    /**
1253     * @var int
1254     * @cvalue HIERARCHY_REQUEST_ERR
1255     */
1256    const HIERARCHY_REQUEST_ERR = UNKNOWN;
1257    /**
1258     * @var int
1259     * @cvalue WRONG_DOCUMENT_ERR
1260     */
1261    const WRONG_DOCUMENT_ERR = UNKNOWN;
1262    /**
1263     * @var int
1264     * @cvalue INVALID_CHARACTER_ERR
1265     */
1266    const INVALID_CHARACTER_ERR = UNKNOWN;
1267    /**
1268     * @var int
1269     * @cvalue NO_DATA_ALLOWED_ERR
1270     */
1271    const NO_DATA_ALLOWED_ERR = UNKNOWN;
1272    /**
1273     * @var int
1274     * @cvalue NO_MODIFICATION_ALLOWED_ERR
1275     */
1276    const NO_MODIFICATION_ALLOWED_ERR = UNKNOWN;
1277    /**
1278     * @var int
1279     * @cvalue NOT_FOUND_ERR
1280     */
1281    const NOT_FOUND_ERR = UNKNOWN;
1282    /**
1283     * @var int
1284     * @cvalue NOT_SUPPORTED_ERR
1285     */
1286    const NOT_SUPPORTED_ERR = UNKNOWN;
1287    /**
1288     * @var int
1289     * @cvalue INUSE_ATTRIBUTE_ERR
1290     */
1291    const INUSE_ATTRIBUTE_ERR = UNKNOWN;
1292    /**
1293     * @var int
1294     * @cvalue INVALID_STATE_ERR
1295     */
1296    const INVALID_STATE_ERR = UNKNOWN;
1297    /**
1298     * @var int
1299     * @cvalue SYNTAX_ERR
1300     */
1301    const SYNTAX_ERR = UNKNOWN;
1302    /**
1303     * @var int
1304     * @cvalue INVALID_MODIFICATION_ERR
1305     */
1306    const INVALID_MODIFICATION_ERR = UNKNOWN;
1307    /**
1308     * @var int
1309     * @cvalue NAMESPACE_ERR
1310     */
1311    const NAMESPACE_ERR = UNKNOWN;
1312    /**
1313     * @var int
1314     * @cvalue VALIDATION_ERR
1315     */
1316    const VALIDATION_ERR = UNKNOWN;
1317
1318    /**
1319     * @var int
1320     * @cvalue DOM_HTML_NO_DEFAULT_NS
1321     */
1322    const HTML_NO_DEFAULT_NS = UNKNOWN;
1323
1324    interface ParentNode
1325    {
1326        public function append(Node|string ...$nodes): void;
1327        public function prepend(Node|string ...$nodes): void;
1328        public function replaceChildren(Node|string ...$nodes): void;
1329
1330        public function querySelector(string $selectors): ?Element;
1331        public function querySelectorAll(string $selectors): NodeList;
1332    }
1333
1334    interface ChildNode
1335    {
1336        public function remove(): void;
1337        public function before(Node|string ...$nodes): void;
1338        public function after(Node|string ...$nodes): void;
1339        public function replaceWith(Node|string ...$nodes): void;
1340    }
1341
1342    /**
1343     * @strict-properties
1344     * @not-serializable
1345     */
1346    class Implementation
1347    {
1348        public function createDocumentType(string $qualifiedName, string $publicId, string $systemId): DocumentType {}
1349
1350        public function createDocument(?string $namespace, string $qualifiedName, ?DocumentType $doctype = null): XMLDocument {}
1351
1352        public function createHTMLDocument(?string $title = null): HTMLDocument {}
1353    }
1354
1355    /** @strict-properties */
1356    class Node
1357    {
1358        private final function __construct() {}
1359
1360        /**
1361         * @readonly
1362         * @virtual
1363         */
1364        public int $nodeType;
1365        /**
1366         * @readonly
1367         * @virtual
1368         */
1369        public string $nodeName;
1370
1371        /**
1372         * @readonly
1373         * @virtual
1374         */
1375        public string $baseURI;
1376
1377        /**
1378         * @readonly
1379         * @virtual
1380         */
1381        public bool $isConnected;
1382        /**
1383         * @readonly
1384         * @virtual
1385         */
1386        public ?Document $ownerDocument;
1387
1388        /** @implementation-alias DOMNode::getRootNode */
1389        public function getRootNode(array $options = []): Node {}
1390        /**
1391         * @readonly
1392         * @virtual
1393         */
1394        public ?Node $parentNode;
1395        /**
1396         * @readonly
1397         * @virtual
1398         */
1399        public ?Element $parentElement;
1400        /** @implementation-alias DOMNode::hasChildNodes */
1401        public function hasChildNodes(): bool {}
1402        /**
1403         * @readonly
1404         * @virtual
1405         */
1406        public NodeList $childNodes;
1407        /**
1408         * @readonly
1409         * @virtual
1410         */
1411        public ?Node $firstChild;
1412        /**
1413         * @readonly
1414         * @virtual
1415         */
1416        public ?Node $lastChild;
1417        /**
1418         * @readonly
1419         * @virtual
1420         */
1421        public ?Node $previousSibling;
1422        /**
1423         * @readonly
1424         * @virtual
1425         */
1426        public ?Node $nextSibling;
1427
1428        /** @virtual */
1429        public ?string $nodeValue;
1430        /** @virtual */
1431        public ?string $textContent;
1432        /** @implementation-alias DOMNode::normalize */
1433        public function normalize(): void {}
1434
1435        /** @implementation-alias DOMNode::cloneNode */
1436        public function cloneNode(bool $deep = false): Node {}
1437        public function isEqualNode(?Node $otherNode): bool {}
1438        public function isSameNode(?Node $otherNode): bool {}
1439
1440        public const int DOCUMENT_POSITION_DISCONNECTED = 0x01;
1441        public const int DOCUMENT_POSITION_PRECEDING = 0x02;
1442        public const int DOCUMENT_POSITION_FOLLOWING = 0x04;
1443        public const int DOCUMENT_POSITION_CONTAINS = 0x08;
1444        public const int DOCUMENT_POSITION_CONTAINED_BY = 0x10;
1445        public const int DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
1446        public function compareDocumentPosition(Node $other): int {}
1447        public function contains(?Node $other): bool {}
1448
1449        public function lookupPrefix(?string $namespace): ?string {}
1450        /** @implementation-alias DOMNode::lookupNamespaceURI */
1451        public function lookupNamespaceURI(?string $prefix): ?string {}
1452        public function isDefaultNamespace(?string $namespace): bool {}
1453
1454        public function insertBefore(Node $node, ?Node $child): Node {}
1455        public function appendChild(Node $node): Node {}
1456        public function replaceChild(Node $node, Node $child): Node {}
1457        public function removeChild(Node $child): Node {}
1458
1459        /** @implementation-alias DOMNode::getLineNo */
1460        public function getLineNo(): int {}
1461        public function getNodePath(): string {}
1462
1463        /** @implementation-alias DOMNode::C14N */
1464        public function C14N(bool $exclusive = false, bool $withComments = false, ?array $xpath = null, ?array $nsPrefixes = null): string|false {}
1465        /** @implementation-alias DOMNode::C14NFile */
1466        public function C14NFile(string $uri, bool $exclusive = false, bool $withComments = false, ?array $xpath = null, ?array $nsPrefixes = null): int|false {}
1467
1468        /** @implementation-alias DOMNode::__sleep */
1469        public function __sleep(): array {}
1470        /** @implementation-alias DOMNode::__wakeup */
1471        public function __wakeup(): void {}
1472    }
1473
1474    class NodeList implements \IteratorAggregate, \Countable
1475    {
1476        /**
1477         * @readonly
1478         * @virtual
1479         */
1480        public int $length;
1481
1482        /** @implementation-alias DOMNodeList::count */
1483        public function count(): int {}
1484
1485        /** @implementation-alias DOMNodeList::getIterator */
1486        public function getIterator(): \Iterator {}
1487
1488        /** @implementation-alias DOMNodeList::item */
1489        public function item(int $index): ?Node {}
1490    }
1491
1492    class NamedNodeMap implements \IteratorAggregate, \Countable
1493    {
1494        /**
1495         * @readonly
1496         * @virtual
1497         */
1498        public int $length;
1499
1500        /** @implementation-alias DOMNamedNodeMap::item */
1501        public function item(int $index): ?Attr {}
1502        /** @implementation-alias DOMNamedNodeMap::getNamedItem */
1503        public function getNamedItem(string $qualifiedName): ?Attr {}
1504        /** @implementation-alias DOMNamedNodeMap::getNamedItemNS */
1505        public function getNamedItemNS(?string $namespace, string $localName): ?Attr {}
1506
1507        /** @implementation-alias DOMNamedNodeMap::count */
1508        public function count(): int {}
1509
1510        /** @implementation-alias DOMNamedNodeMap::getIterator */
1511        public function getIterator(): \Iterator {}
1512    }
1513
1514    class DtdNamedNodeMap implements \IteratorAggregate, \Countable
1515    {
1516        /**
1517         * @readonly
1518         * @virtual
1519         */
1520        public int $length;
1521
1522        /** @implementation-alias DOMNamedNodeMap::item */
1523        public function item(int $index): Entity|Notation|null {}
1524        /** @implementation-alias DOMNamedNodeMap::getNamedItem */
1525        public function getNamedItem(string $qualifiedName): Entity|Notation|null {}
1526        /** @implementation-alias DOMNamedNodeMap::getNamedItemNS */
1527        public function getNamedItemNS(?string $namespace, string $localName): Entity|Notation|null {}
1528
1529        /** @implementation-alias DOMNamedNodeMap::count */
1530        public function count(): int {}
1531
1532        /** @implementation-alias DOMNamedNodeMap::getIterator */
1533        public function getIterator(): \Iterator {}
1534    }
1535
1536    class HTMLCollection implements \IteratorAggregate, \Countable
1537    {
1538        /**
1539         * @readonly
1540         * @virtual
1541         */
1542        public int $length;
1543
1544        /** @implementation-alias DOMNodeList::item */
1545        public function item(int $index): ?Element {}
1546
1547        public function namedItem(string $key): ?Element {}
1548
1549        /** @implementation-alias DOMNodeList::count */
1550        public function count(): int {}
1551
1552        /** @implementation-alias DOMNodeList::getIterator */
1553        public function getIterator(): \Iterator {}
1554    }
1555
1556    enum AdjacentPosition : string
1557    {
1558        case BeforeBegin = "beforebegin";
1559        case AfterBegin = "afterbegin";
1560        case BeforeEnd = "beforeend";
1561        case AfterEnd = "afterend";
1562    }
1563
1564    class Element extends Node implements ParentNode, ChildNode
1565    {
1566        /**
1567         * @readonly
1568         * @virtual
1569         */
1570        public ?string $namespaceURI;
1571        /**
1572         * @readonly
1573         * @virtual
1574         */
1575        public ?string $prefix;
1576        /**
1577         * @readonly
1578         * @virtual
1579         */
1580        public string $localName;
1581        /**
1582         * @readonly
1583         * @virtual
1584         */
1585        public string $tagName;
1586
1587        /** @virtual */
1588        public string $id;
1589        /** @virtual */
1590        public string $className;
1591        /** @readonly */
1592        public TokenList $classList;
1593
1594        /** @implementation-alias DOMNode::hasAttributes */
1595        public function hasAttributes(): bool {}
1596        /**
1597         * @readonly
1598         * @virtual
1599         */
1600        public NamedNodeMap $attributes;
1601        /** @implementation-alias DOMElement::getAttributeNames */
1602        public function getAttributeNames(): array {}
1603        /** @implementation-alias DOMElement::getAttribute */
1604        public function getAttribute(string $qualifiedName): ?string {}
1605        /** @implementation-alias DOMElement::getAttributeNS */
1606        public function getAttributeNS(?string $namespace, string $localName): ?string {}
1607        /** @implementation-alias DOMElement::setAttribute */
1608        public function setAttribute(string $qualifiedName, string $value): void {}
1609        /** @implementation-alias DOMElement::setAttributeNS */
1610        public function setAttributeNS(?string $namespace, string $qualifiedName, string $value): void {}
1611        public function removeAttribute(string $qualifiedName): void {}
1612        /** @implementation-alias DOMElement::removeAttributeNS */
1613        public function removeAttributeNS(?string $namespace, string $localName): void {}
1614        /** @implementation-alias DOMElement::toggleAttribute */
1615        public function toggleAttribute(string $qualifiedName, ?bool $force = null): bool {}
1616        /** @implementation-alias DOMElement::hasAttribute */
1617        public function hasAttribute(string $qualifiedName): bool {}
1618        /** @implementation-alias DOMElement::hasAttributeNS */
1619        public function hasAttributeNS(?string $namespace, string $localName): bool {}
1620
1621        /** @implementation-alias DOMElement::getAttributeNode */
1622        public function getAttributeNode(string $qualifiedName): ?Attr {}
1623        /** @implementation-alias DOMElement::getAttributeNodeNS */
1624        public function getAttributeNodeNS(?string $namespace, string $localName): ?Attr {}
1625        /** @implementation-alias Dom\Element::setAttributeNodeNS */
1626        public function setAttributeNode(Attr $attr) : ?Attr {}
1627        public function setAttributeNodeNS(Attr $attr) : ?Attr {}
1628        public function removeAttributeNode(Attr $attr) : Attr {}
1629
1630        public function getElementsByTagName(string $qualifiedName): HTMLCollection {}
1631        public function getElementsByTagNameNS(?string $namespace, string $localName): HTMLCollection {}
1632
1633        public function insertAdjacentElement(AdjacentPosition $where, Element $element): ?Element {}
1634        public function insertAdjacentText(AdjacentPosition $where, string $data): void {}
1635        public function insertAdjacentHTML(AdjacentPosition $where, string $string): void {}
1636
1637        /**
1638         * @readonly
1639         * @virtual
1640         */
1641        public ?Element $firstElementChild;
1642        /**
1643         * @readonly
1644         * @virtual
1645         */
1646        public ?Element $lastElementChild;
1647        /**
1648         * @readonly
1649         * @virtual
1650         */
1651        public int $childElementCount;
1652        /**
1653         * @readonly
1654         * @virtual
1655         */
1656        public ?Element $previousElementSibling;
1657        /**
1658         * @readonly
1659         * @virtual
1660         */
1661        public ?Element $nextElementSibling;
1662
1663        /** @implementation-alias DOMElement::setIdAttribute */
1664        public function setIdAttribute(string $qualifiedName, bool $isId): void {}
1665        /** @implementation-alias DOMElement::setIdAttributeNS */
1666        public function setIdAttributeNS(?string $namespace, string $qualifiedName, bool $isId): void {}
1667        public function setIdAttributeNode(Attr $attr, bool $isId): void {}
1668
1669        /** @implementation-alias DOMElement::remove */
1670        public function remove(): void {}
1671        /** @implementation-alias DOMElement::before */
1672        public function before(Node|string ...$nodes): void {}
1673        /** @implementation-alias DOMElement::after */
1674        public function after(Node|string ...$nodes): void {}
1675        /** @implementation-alias DOMElement::replaceWith */
1676        public function replaceWith(Node|string ...$nodes): void {}
1677        /** @implementation-alias DOMElement::append */
1678        public function append(Node|string ...$nodes): void {}
1679        /** @implementation-alias DOMElement::prepend */
1680        public function prepend(Node|string ...$nodes): void {}
1681        /** @implementation-alias DOMElement::replaceChildren */
1682        public function replaceChildren(Node|string ...$nodes): void {}
1683
1684        public function querySelector(string $selectors): ?Element {}
1685        public function querySelectorAll(string $selectors): NodeList {}
1686        public function closest(string $selectors): ?Element {}
1687        public function matches(string $selectors): bool {}
1688
1689        /** @virtual */
1690        public string $innerHTML;
1691
1692        /** @virtual */
1693        public string $outerHTML;
1694
1695        /** @virtual */
1696        public string $substitutedNodeValue;
1697
1698        /** @return list<NamespaceInfo> */
1699        public function getInScopeNamespaces(): array {}
1700
1701        /** @return list<NamespaceInfo> */
1702        public function getDescendantNamespaces(): array {}
1703
1704        public function rename(?string $namespaceURI, string $qualifiedName): void {}
1705    }
1706
1707    class HTMLElement extends Element
1708    {
1709    }
1710
1711    class Attr extends Node
1712    {
1713        /**
1714         * @readonly
1715         * @virtual
1716         */
1717        public ?string $namespaceURI;
1718        /**
1719         * @readonly
1720         * @virtual
1721         */
1722        public ?string $prefix;
1723        /**
1724         * @readonly
1725         * @virtual
1726         */
1727        public string $localName;
1728        /**
1729         * @readonly
1730         * @virtual
1731         */
1732        public string $name;
1733        /** @virtual */
1734        public string $value;
1735
1736        /**
1737         * @readonly
1738         * @virtual
1739         */
1740        public ?Element $ownerElement;
1741
1742        /**
1743         * @readonly
1744         * @virtual
1745         */
1746        public bool $specified;
1747
1748        /** @implementation-alias DOMAttr::isId */
1749        public function isId(): bool {}
1750
1751        /** @implementation-alias Dom\Element::rename */
1752        public function rename(?string $namespaceURI, string $qualifiedName): void {}
1753    }
1754
1755    class CharacterData extends Node implements ChildNode
1756    {
1757        /**
1758         * @readonly
1759         * @virtual
1760         */
1761        public ?Element $previousElementSibling;
1762        /**
1763         * @readonly
1764         * @virtual
1765         */
1766        public ?Element $nextElementSibling;
1767
1768        /** @virtual */
1769        public string $data;
1770        /**
1771         * @readonly
1772         * @virtual
1773         */
1774        public int $length;
1775        /** @implementation-alias DOMCharacterData::substringData */
1776        public function substringData(int $offset, int $count): string {}
1777        public function appendData(string $data): void {}
1778        public function insertData(int $offset, string $data): void {}
1779        public function deleteData(int $offset, int $count): void {}
1780        public function replaceData(int $offset, int $count, string $data): void {}
1781
1782        /** @implementation-alias DOMElement::remove */
1783        public function remove(): void {}
1784        /** @implementation-alias DOMElement::before */
1785        public function before(Node|string ...$nodes): void {}
1786        /** @implementation-alias DOMElement::after */
1787        public function after(Node|string ...$nodes): void {}
1788        /** @implementation-alias DOMElement::replaceWith */
1789        public function replaceWith(Node|string ...$nodes): void {}
1790    }
1791
1792    class Text extends CharacterData
1793    {
1794        /* No constructor because Node has a final private constructor, so PHP does not allow overriding that. */
1795
1796        /** @implementation-alias DOMText::splitText */
1797        public function splitText(int $offset): Text {}
1798        /**
1799         * @readonly
1800         * @virtual
1801         */
1802        public string $wholeText;
1803    }
1804
1805    class CDATASection extends Text {}
1806
1807    class ProcessingInstruction extends CharacterData
1808    {
1809        /**
1810         * @readonly
1811         * @virtual
1812         */
1813        public string $target;
1814    }
1815
1816    class Comment extends CharacterData
1817    {
1818        /* No constructor because Node has a final private constructor, so PHP does not allow overriding that. */
1819    }
1820
1821    class DocumentType extends Node implements ChildNode
1822    {
1823        /**
1824         * @readonly
1825         * @virtual
1826         */
1827        public string $name;
1828        /**
1829         * @readonly
1830         * @virtual
1831         */
1832        public DtdNamedNodeMap $entities;
1833        /**
1834         * @readonly
1835         * @virtual
1836         */
1837        public DtdNamedNodeMap $notations;
1838        /**
1839         * @readonly
1840         * @virtual
1841         */
1842        public string $publicId;
1843        /**
1844         * @readonly
1845         * @virtual
1846         */
1847        public string $systemId;
1848        /**
1849         * @readonly
1850         * @virtual
1851         */
1852        public ?string $internalSubset;
1853
1854        /** @implementation-alias DOMElement::remove */
1855        public function remove(): void {}
1856        /** @implementation-alias DOMElement::before */
1857        public function before(Node|string ...$nodes): void {}
1858        /** @implementation-alias DOMElement::after */
1859        public function after(Node|string ...$nodes): void {}
1860        /** @implementation-alias DOMElement::replaceWith */
1861        public function replaceWith(Node|string ...$nodes): void {}
1862    }
1863
1864    class DocumentFragment extends Node implements ParentNode
1865    {
1866        /**
1867         * @readonly
1868         * @virtual
1869         */
1870        public ?Element $firstElementChild;
1871        /**
1872         * @readonly
1873         * @virtual
1874         */
1875        public ?Element $lastElementChild;
1876        /**
1877         * @readonly
1878         * @virtual
1879         */
1880        public int $childElementCount;
1881
1882        /** @implementation-alias DOMDocumentFragment::appendXML */
1883        public function appendXml(string $data): bool {}
1884        /** @implementation-alias DOMElement::append */
1885        public function append(Node|string ...$nodes): void {}
1886        /** @implementation-alias DOMElement::prepend */
1887        public function prepend(Node|string ...$nodes): void {}
1888        /** @implementation-alias DOMElement::replaceChildren */
1889        public function replaceChildren(Node|string ...$nodes): void {}
1890
1891        /** @implementation-alias Dom\Element::querySelector */
1892        public function querySelector(string $selectors): ?Element {}
1893        /** @implementation-alias Dom\Element::querySelectorAll */
1894        public function querySelectorAll(string $selectors): NodeList {}
1895    }
1896
1897    class Entity extends Node
1898    {
1899        /**
1900         * @readonly
1901         * @virtual
1902         */
1903        public ?string $publicId;
1904        /**
1905         * @readonly
1906         * @virtual
1907         */
1908        public ?string $systemId;
1909        /**
1910         * @readonly
1911         * @virtual
1912         */
1913        public ?string $notationName;
1914    }
1915
1916    class EntityReference extends Node {}
1917
1918    class Notation extends Node
1919    {
1920        /**
1921         * @readonly
1922         * @virtual
1923         */
1924        public string $publicId;
1925        /**
1926         * @readonly
1927         * @virtual
1928         */
1929        public string $systemId;
1930    }
1931
1932    abstract class Document extends Node implements ParentNode
1933    {
1934        /** @readonly */
1935        public Implementation $implementation;
1936        /** @virtual */
1937        public string $URL;
1938        /** @virtual */
1939        public string $documentURI;
1940        /** @virtual */
1941        public string $characterSet;
1942        /** @virtual */
1943        public string $charset;
1944        /** @virtual */
1945        public string $inputEncoding;
1946
1947        /**
1948         * @readonly
1949         * @virtual
1950         */
1951        public ?DocumentType $doctype;
1952        /**
1953         * @readonly
1954         * @virtual
1955         */
1956        public ?Element $documentElement;
1957        /** @implementation-alias Dom\Element::getElementsByTagName */
1958        public function getElementsByTagName(string $qualifiedName): HTMLCollection {}
1959        /** @implementation-alias Dom\Element::getElementsByTagNameNS */
1960        public function getElementsByTagNameNS(?string $namespace, string $localName): HTMLCollection {}
1961
1962        public function createElement(string $localName): Element {}
1963        public function createElementNS(?string $namespace, string $qualifiedName): Element {}
1964        /** @implementation-alias DOMDocument::createDocumentFragment */
1965        public function createDocumentFragment(): DocumentFragment {}
1966        /** @implementation-alias DOMDocument::createTextNode */
1967        public function createTextNode(string $data): Text {}
1968        /** @implementation-alias DOMDocument::createCDATASection */
1969        public function createCDATASection(string $data): CDATASection {}
1970        /** @implementation-alias DOMDocument::createComment */
1971        public function createComment(string $data): Comment {}
1972        public function createProcessingInstruction(string $target, string $data): ProcessingInstruction {}
1973
1974        public function importNode(?Node $node, bool $deep = false): Node {}
1975        public function adoptNode(Node $node): Node {}
1976
1977        /** @implementation-alias DOMDocument::createAttribute */
1978        public function createAttribute(string $localName): Attr {}
1979        /** @implementation-alias DOMDocument::createAttributeNS */
1980        public function createAttributeNS(?string $namespace, string $qualifiedName): Attr {}
1981
1982        /**
1983         * @readonly
1984         * @virtual
1985         */
1986        public ?Element $firstElementChild;
1987        /**
1988         * @readonly
1989         * @virtual
1990         */
1991        public ?Element $lastElementChild;
1992        /**
1993         * @readonly
1994         * @virtual
1995         */
1996        public int $childElementCount;
1997
1998        /** @implementation-alias DOMDocument::getElementById */
1999        public function getElementById(string $elementId): ?Element {}
2000
2001        public function registerNodeClass(string $baseClass, ?string $extendedClass): void {}
2002
2003#ifdef LIBXML_SCHEMAS_ENABLED
2004        /** @implementation-alias DOMDocument::schemaValidate */
2005        public function schemaValidate(string $filename, int $flags = 0): bool {}
2006        /** @implementation-alias DOMDocument::schemaValidateSource */
2007        public function schemaValidateSource(string $source, int $flags = 0): bool {}
2008        /** @implementation-alias DOMDocument::relaxNGValidate */
2009        public function relaxNgValidate(string $filename): bool {}
2010        /** @implementation-alias DOMDocument::relaxNGValidateSource */
2011        public function relaxNgValidateSource(string $source): bool {}
2012#endif
2013
2014        /** @implementation-alias DOMElement::append */
2015        public function append(Node|string ...$nodes): void {}
2016        /** @implementation-alias DOMElement::prepend */
2017        public function prepend(Node|string ...$nodes): void {}
2018        /** @implementation-alias DOMDocument::replaceChildren */
2019        public function replaceChildren(Node|string ...$nodes): void {}
2020
2021        public function importLegacyNode(\DOMNode $node, bool $deep = false): Node {}
2022
2023        /** @implementation-alias Dom\Element::querySelector */
2024        public function querySelector(string $selectors): ?Element {}
2025        /** @implementation-alias Dom\Element::querySelectorAll */
2026        public function querySelectorAll(string $selectors): NodeList {}
2027
2028        /** @virtual */
2029        public ?HTMLElement $body;
2030        /**
2031         * @readonly
2032         * @virtual
2033         */
2034        public ?HTMLElement $head;
2035        /** @virtual */
2036        public string $title;
2037    }
2038
2039    final class HTMLDocument extends Document
2040    {
2041        public static function createEmpty(string $encoding = "UTF-8"): HTMLDocument {}
2042
2043        public static function createFromFile(string $path, int $options = 0, ?string $overrideEncoding = null): HTMLDocument {}
2044
2045        public static function createFromString(string $source, int $options = 0, ?string $overrideEncoding = null): HTMLDocument {}
2046
2047        /** @implementation-alias Dom\XMLDocument::saveXml */
2048        public function saveXml(?Node $node = null, int $options = 0): string|false {}
2049
2050        /** @implementation-alias DOMDocument::save */
2051        public function saveXmlFile(string $filename, int $options = 0): int|false {}
2052
2053        public function saveHtml(?Node $node = null): string {}
2054
2055        public function saveHtmlFile(string $filename): int|false {}
2056
2057#if ZEND_DEBUG
2058        public function debugGetTemplateCount(): int {}
2059#endif
2060    }
2061
2062    final class XMLDocument extends Document
2063    {
2064        public static function createEmpty(string $version = "1.0", string $encoding = "UTF-8"): XMLDocument {}
2065
2066        public static function createFromFile(string $path, int $options = 0, ?string $overrideEncoding = null): XMLDocument {}
2067
2068        public static function createFromString(string $source, int $options = 0, ?string $overrideEncoding = null): XMLDocument {}
2069
2070        /**
2071         * @readonly
2072         * @virtual
2073         */
2074        public string $xmlEncoding;
2075
2076        /** @virtual */
2077        public bool $xmlStandalone;
2078
2079        /** @virtual */
2080        public string $xmlVersion;
2081
2082        /** @virtual */
2083        public bool $formatOutput;
2084
2085        /** @implementation-alias DOMDocument::createEntityReference */
2086        public function createEntityReference(string $name): EntityReference {}
2087
2088        /** @implementation-alias DOMDocument::validate */
2089        public function validate(): bool {}
2090
2091        public function xinclude(int $options = 0): int {}
2092
2093        public function saveXml(?Node $node = null, int $options = 0): string|false {}
2094
2095        /** @implementation-alias DOMDocument::save */
2096        public function saveXmlFile(string $filename, int $options = 0): int|false {}
2097    }
2098
2099    /**
2100     * @not-serializable
2101     * @strict-properties
2102     */
2103    final class TokenList implements IteratorAggregate, Countable
2104    {
2105        /** @implementation-alias Dom\Node::__construct */
2106        private function __construct() {}
2107
2108        /**
2109         * @readonly
2110         * @virtual
2111         */
2112        public int $length;
2113        public function item(int $index): ?string {}
2114        public function contains(string $token): bool {}
2115        public function add(string ...$tokens): void {}
2116        public function remove(string ...$tokens): void {}
2117        public function toggle(string $token, ?bool $force = null): bool {}
2118        public function replace(string $token, string $newToken): bool {}
2119        public function supports(string $token): bool {}
2120        /** @virtual */
2121        public string $value;
2122
2123        public function count(): int {}
2124
2125        public function getIterator(): \Iterator {}
2126    }
2127
2128    /**
2129     * @not-serializable
2130     * @strict-properties
2131     */
2132    readonly final class NamespaceInfo
2133    {
2134        public ?string $prefix;
2135        public ?string $namespaceURI;
2136        public Element $element;
2137
2138        /** @implementation-alias Dom\Node::__construct */
2139        private function __construct() {}
2140    }
2141
2142#ifdef LIBXML_XPATH_ENABLED
2143    /** @not-serializable */
2144    final class XPath
2145    {
2146        /**
2147         * @readonly
2148         * @virtual
2149         */
2150        public Document $document;
2151
2152        /** @virtual */
2153        public bool $registerNodeNamespaces;
2154
2155        public function __construct(Document $document, bool $registerNodeNS = true) {}
2156
2157        public function evaluate(string $expression, ?Node $contextNode = null, bool $registerNodeNS = true): null|bool|float|string|NodeList {}
2158
2159        public function query(string $expression, ?Node $contextNode = null, bool $registerNodeNS = true): NodeList {}
2160
2161        /** @implementation-alias DOMXPath::registerNamespace */
2162        public function registerNamespace(string $prefix, string $namespace): bool {}
2163
2164        /** @implementation-alias DOMXPath::registerPhpFunctions */
2165        public function registerPhpFunctions(string|array|null $restrict = null): void {}
2166
2167        /** @implementation-alias DOMXPath::registerPhpFunctionNS */
2168        public function registerPhpFunctionNS(string $namespaceURI, string $name, callable $callable): void {}
2169
2170        /** @implementation-alias DOMXPath::quote */
2171        public static function quote(string $str): string {}
2172    }
2173#endif
2174
2175    function import_simplexml(object $node): Attr|Element {}
2176}
2177