xref: /PHP-8.4/ext/dom/php_dom.stub.php (revision 41af9335)
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
1636        /**
1637         * @readonly
1638         * @virtual
1639         */
1640        public ?Element $firstElementChild;
1641        /**
1642         * @readonly
1643         * @virtual
1644         */
1645        public ?Element $lastElementChild;
1646        /**
1647         * @readonly
1648         * @virtual
1649         */
1650        public int $childElementCount;
1651        /**
1652         * @readonly
1653         * @virtual
1654         */
1655        public ?Element $previousElementSibling;
1656        /**
1657         * @readonly
1658         * @virtual
1659         */
1660        public ?Element $nextElementSibling;
1661
1662        /** @implementation-alias DOMElement::setIdAttribute */
1663        public function setIdAttribute(string $qualifiedName, bool $isId): void {}
1664        /** @implementation-alias DOMElement::setIdAttributeNS */
1665        public function setIdAttributeNS(?string $namespace, string $qualifiedName, bool $isId): void {}
1666        public function setIdAttributeNode(Attr $attr, bool $isId): void {}
1667
1668        /** @implementation-alias DOMElement::remove */
1669        public function remove(): void {}
1670        /** @implementation-alias DOMElement::before */
1671        public function before(Node|string ...$nodes): void {}
1672        /** @implementation-alias DOMElement::after */
1673        public function after(Node|string ...$nodes): void {}
1674        /** @implementation-alias DOMElement::replaceWith */
1675        public function replaceWith(Node|string ...$nodes): void {}
1676        /** @implementation-alias DOMElement::append */
1677        public function append(Node|string ...$nodes): void {}
1678        /** @implementation-alias DOMElement::prepend */
1679        public function prepend(Node|string ...$nodes): void {}
1680        /** @implementation-alias DOMElement::replaceChildren */
1681        public function replaceChildren(Node|string ...$nodes): void {}
1682
1683        public function querySelector(string $selectors): ?Element {}
1684        public function querySelectorAll(string $selectors): NodeList {}
1685        public function closest(string $selectors): ?Element {}
1686        public function matches(string $selectors): bool {}
1687
1688        /** @virtual */
1689        public string $innerHTML;
1690
1691        /** @virtual */
1692        public string $substitutedNodeValue;
1693
1694        /** @return list<NamespaceInfo> */
1695        public function getInScopeNamespaces(): array {}
1696
1697        /** @return list<NamespaceInfo> */
1698        public function getDescendantNamespaces(): array {}
1699
1700        public function rename(?string $namespaceURI, string $qualifiedName): void {}
1701    }
1702
1703    class HTMLElement extends Element
1704    {
1705    }
1706
1707    class Attr extends Node
1708    {
1709        /**
1710         * @readonly
1711         * @virtual
1712         */
1713        public ?string $namespaceURI;
1714        /**
1715         * @readonly
1716         * @virtual
1717         */
1718        public ?string $prefix;
1719        /**
1720         * @readonly
1721         * @virtual
1722         */
1723        public string $localName;
1724        /**
1725         * @readonly
1726         * @virtual
1727         */
1728        public string $name;
1729        /** @virtual */
1730        public string $value;
1731
1732        /**
1733         * @readonly
1734         * @virtual
1735         */
1736        public ?Element $ownerElement;
1737
1738        /**
1739         * @readonly
1740         * @virtual
1741         */
1742        public bool $specified;
1743
1744        /** @implementation-alias DOMAttr::isId */
1745        public function isId(): bool {}
1746
1747        /** @implementation-alias Dom\Element::rename */
1748        public function rename(?string $namespaceURI, string $qualifiedName): void {}
1749    }
1750
1751    class CharacterData extends Node implements ChildNode
1752    {
1753        /**
1754         * @readonly
1755         * @virtual
1756         */
1757        public ?Element $previousElementSibling;
1758        /**
1759         * @readonly
1760         * @virtual
1761         */
1762        public ?Element $nextElementSibling;
1763
1764        /** @virtual */
1765        public string $data;
1766        /**
1767         * @readonly
1768         * @virtual
1769         */
1770        public int $length;
1771        /** @implementation-alias DOMCharacterData::substringData */
1772        public function substringData(int $offset, int $count): string {}
1773        public function appendData(string $data): void {}
1774        public function insertData(int $offset, string $data): void {}
1775        public function deleteData(int $offset, int $count): void {}
1776        public function replaceData(int $offset, int $count, string $data): void {}
1777
1778        /** @implementation-alias DOMElement::remove */
1779        public function remove(): void {}
1780        /** @implementation-alias DOMElement::before */
1781        public function before(Node|string ...$nodes): void {}
1782        /** @implementation-alias DOMElement::after */
1783        public function after(Node|string ...$nodes): void {}
1784        /** @implementation-alias DOMElement::replaceWith */
1785        public function replaceWith(Node|string ...$nodes): void {}
1786    }
1787
1788    class Text extends CharacterData
1789    {
1790        /* No constructor because Node has a final private constructor, so PHP does not allow overriding that. */
1791
1792        /** @implementation-alias DOMText::splitText */
1793        public function splitText(int $offset): Text {}
1794        /**
1795         * @readonly
1796         * @virtual
1797         */
1798        public string $wholeText;
1799    }
1800
1801    class CDATASection extends Text {}
1802
1803    class ProcessingInstruction extends CharacterData
1804    {
1805        /**
1806         * @readonly
1807         * @virtual
1808         */
1809        public string $target;
1810    }
1811
1812    class Comment extends CharacterData
1813    {
1814        /* No constructor because Node has a final private constructor, so PHP does not allow overriding that. */
1815    }
1816
1817    class DocumentType extends Node implements ChildNode
1818    {
1819        /**
1820         * @readonly
1821         * @virtual
1822         */
1823        public string $name;
1824        /**
1825         * @readonly
1826         * @virtual
1827         */
1828        public DtdNamedNodeMap $entities;
1829        /**
1830         * @readonly
1831         * @virtual
1832         */
1833        public DtdNamedNodeMap $notations;
1834        /**
1835         * @readonly
1836         * @virtual
1837         */
1838        public string $publicId;
1839        /**
1840         * @readonly
1841         * @virtual
1842         */
1843        public string $systemId;
1844        /**
1845         * @readonly
1846         * @virtual
1847         */
1848        public ?string $internalSubset;
1849
1850        /** @implementation-alias DOMElement::remove */
1851        public function remove(): void {}
1852        /** @implementation-alias DOMElement::before */
1853        public function before(Node|string ...$nodes): void {}
1854        /** @implementation-alias DOMElement::after */
1855        public function after(Node|string ...$nodes): void {}
1856        /** @implementation-alias DOMElement::replaceWith */
1857        public function replaceWith(Node|string ...$nodes): void {}
1858    }
1859
1860    class DocumentFragment extends Node implements ParentNode
1861    {
1862        /**
1863         * @readonly
1864         * @virtual
1865         */
1866        public ?Element $firstElementChild;
1867        /**
1868         * @readonly
1869         * @virtual
1870         */
1871        public ?Element $lastElementChild;
1872        /**
1873         * @readonly
1874         * @virtual
1875         */
1876        public int $childElementCount;
1877
1878        /** @implementation-alias DOMDocumentFragment::appendXML */
1879        public function appendXml(string $data): bool {}
1880        /** @implementation-alias DOMElement::append */
1881        public function append(Node|string ...$nodes): void {}
1882        /** @implementation-alias DOMElement::prepend */
1883        public function prepend(Node|string ...$nodes): void {}
1884        /** @implementation-alias DOMElement::replaceChildren */
1885        public function replaceChildren(Node|string ...$nodes): void {}
1886
1887        /** @implementation-alias Dom\Element::querySelector */
1888        public function querySelector(string $selectors): ?Element {}
1889        /** @implementation-alias Dom\Element::querySelectorAll */
1890        public function querySelectorAll(string $selectors): NodeList {}
1891    }
1892
1893    class Entity extends Node
1894    {
1895        /**
1896         * @readonly
1897         * @virtual
1898         */
1899        public ?string $publicId;
1900        /**
1901         * @readonly
1902         * @virtual
1903         */
1904        public ?string $systemId;
1905        /**
1906         * @readonly
1907         * @virtual
1908         */
1909        public ?string $notationName;
1910    }
1911
1912    class EntityReference extends Node {}
1913
1914    class Notation extends Node
1915    {
1916        /**
1917         * @readonly
1918         * @virtual
1919         */
1920        public string $publicId;
1921        /**
1922         * @readonly
1923         * @virtual
1924         */
1925        public string $systemId;
1926    }
1927
1928    abstract class Document extends Node implements ParentNode
1929    {
1930        /** @readonly */
1931        public Implementation $implementation;
1932        /** @virtual */
1933        public string $URL;
1934        /** @virtual */
1935        public string $documentURI;
1936        /** @virtual */
1937        public string $characterSet;
1938        /** @virtual */
1939        public string $charset;
1940        /** @virtual */
1941        public string $inputEncoding;
1942
1943        /**
1944         * @readonly
1945         * @virtual
1946         */
1947        public ?DocumentType $doctype;
1948        /**
1949         * @readonly
1950         * @virtual
1951         */
1952        public ?Element $documentElement;
1953        /** @implementation-alias Dom\Element::getElementsByTagName */
1954        public function getElementsByTagName(string $qualifiedName): HTMLCollection {}
1955        /** @implementation-alias Dom\Element::getElementsByTagNameNS */
1956        public function getElementsByTagNameNS(?string $namespace, string $localName): HTMLCollection {}
1957
1958        public function createElement(string $localName): Element {}
1959        public function createElementNS(?string $namespace, string $qualifiedName): Element {}
1960        /** @implementation-alias DOMDocument::createDocumentFragment */
1961        public function createDocumentFragment(): DocumentFragment {}
1962        /** @implementation-alias DOMDocument::createTextNode */
1963        public function createTextNode(string $data): Text {}
1964        /** @implementation-alias DOMDocument::createCDATASection */
1965        public function createCDATASection(string $data): CDATASection {}
1966        /** @implementation-alias DOMDocument::createComment */
1967        public function createComment(string $data): Comment {}
1968        public function createProcessingInstruction(string $target, string $data): ProcessingInstruction {}
1969
1970        public function importNode(?Node $node, bool $deep = false): Node {}
1971        public function adoptNode(Node $node): Node {}
1972
1973        /** @implementation-alias DOMDocument::createAttribute */
1974        public function createAttribute(string $localName): Attr {}
1975        /** @implementation-alias DOMDocument::createAttributeNS */
1976        public function createAttributeNS(?string $namespace, string $qualifiedName): Attr {}
1977
1978        /**
1979         * @readonly
1980         * @virtual
1981         */
1982        public ?Element $firstElementChild;
1983        /**
1984         * @readonly
1985         * @virtual
1986         */
1987        public ?Element $lastElementChild;
1988        /**
1989         * @readonly
1990         * @virtual
1991         */
1992        public int $childElementCount;
1993
1994        /** @implementation-alias DOMDocument::getElementById */
1995        public function getElementById(string $elementId): ?Element {}
1996
1997        public function registerNodeClass(string $baseClass, ?string $extendedClass): void {}
1998
1999#ifdef LIBXML_SCHEMAS_ENABLED
2000        /** @implementation-alias DOMDocument::schemaValidate */
2001        public function schemaValidate(string $filename, int $flags = 0): bool {}
2002        /** @implementation-alias DOMDocument::schemaValidateSource */
2003        public function schemaValidateSource(string $source, int $flags = 0): bool {}
2004        /** @implementation-alias DOMDocument::relaxNGValidate */
2005        public function relaxNgValidate(string $filename): bool {}
2006        /** @implementation-alias DOMDocument::relaxNGValidateSource */
2007        public function relaxNgValidateSource(string $source): bool {}
2008#endif
2009
2010        /** @implementation-alias DOMElement::append */
2011        public function append(Node|string ...$nodes): void {}
2012        /** @implementation-alias DOMElement::prepend */
2013        public function prepend(Node|string ...$nodes): void {}
2014        /** @implementation-alias DOMDocument::replaceChildren */
2015        public function replaceChildren(Node|string ...$nodes): void {}
2016
2017        public function importLegacyNode(\DOMNode $node, bool $deep = false): Node {}
2018
2019        /** @implementation-alias Dom\Element::querySelector */
2020        public function querySelector(string $selectors): ?Element {}
2021        /** @implementation-alias Dom\Element::querySelectorAll */
2022        public function querySelectorAll(string $selectors): NodeList {}
2023
2024        /** @virtual */
2025        public ?HTMLElement $body;
2026        /**
2027         * @readonly
2028         * @virtual
2029         */
2030        public ?HTMLElement $head;
2031        /** @virtual */
2032        public string $title;
2033    }
2034
2035    final class HTMLDocument extends Document
2036    {
2037        public static function createEmpty(string $encoding = "UTF-8"): HTMLDocument {}
2038
2039        public static function createFromFile(string $path, int $options = 0, ?string $overrideEncoding = null): HTMLDocument {}
2040
2041        public static function createFromString(string $source, int $options = 0, ?string $overrideEncoding = null): HTMLDocument {}
2042
2043        /** @implementation-alias Dom\XMLDocument::saveXml */
2044        public function saveXml(?Node $node = null, int $options = 0): string|false {}
2045
2046        /** @implementation-alias DOMDocument::save */
2047        public function saveXmlFile(string $filename, int $options = 0): int|false {}
2048
2049        public function saveHtml(?Node $node = null): string {}
2050
2051        public function saveHtmlFile(string $filename): int|false {}
2052
2053#if ZEND_DEBUG
2054        public function debugGetTemplateCount(): int {}
2055#endif
2056    }
2057
2058    final class XMLDocument extends Document
2059    {
2060        public static function createEmpty(string $version = "1.0", string $encoding = "UTF-8"): XMLDocument {}
2061
2062        public static function createFromFile(string $path, int $options = 0, ?string $overrideEncoding = null): XMLDocument {}
2063
2064        public static function createFromString(string $source, int $options = 0, ?string $overrideEncoding = null): XMLDocument {}
2065
2066        /**
2067         * @readonly
2068         * @virtual
2069         */
2070        public string $xmlEncoding;
2071
2072        /** @virtual */
2073        public bool $xmlStandalone;
2074
2075        /** @virtual */
2076        public string $xmlVersion;
2077
2078        /** @virtual */
2079        public bool $formatOutput;
2080
2081        /** @implementation-alias DOMDocument::createEntityReference */
2082        public function createEntityReference(string $name): EntityReference {}
2083
2084        /** @implementation-alias DOMDocument::validate */
2085        public function validate(): bool {}
2086
2087        public function xinclude(int $options = 0): int {}
2088
2089        public function saveXml(?Node $node = null, int $options = 0): string|false {}
2090
2091        /** @implementation-alias DOMDocument::save */
2092        public function saveXmlFile(string $filename, int $options = 0): int|false {}
2093    }
2094
2095    /**
2096     * @not-serializable
2097     * @strict-properties
2098     */
2099    final class TokenList implements IteratorAggregate, Countable
2100    {
2101        /** @implementation-alias Dom\Node::__construct */
2102        private function __construct() {}
2103
2104        /**
2105         * @readonly
2106         * @virtual
2107         */
2108        public int $length;
2109        public function item(int $index): ?string {}
2110        public function contains(string $token): bool {}
2111        public function add(string ...$tokens): void {}
2112        public function remove(string ...$tokens): void {}
2113        public function toggle(string $token, ?bool $force = null): bool {}
2114        public function replace(string $token, string $newToken): bool {}
2115        public function supports(string $token): bool {}
2116        /** @virtual */
2117        public string $value;
2118
2119        public function count(): int {}
2120
2121        public function getIterator(): \Iterator {}
2122    }
2123
2124    /**
2125     * @not-serializable
2126     * @strict-properties
2127     */
2128    readonly final class NamespaceInfo
2129    {
2130        public ?string $prefix;
2131        public ?string $namespaceURI;
2132        public Element $element;
2133
2134        /** @implementation-alias Dom\Node::__construct */
2135        private function __construct() {}
2136    }
2137
2138#ifdef LIBXML_XPATH_ENABLED
2139    /** @not-serializable */
2140    final class XPath
2141    {
2142        /**
2143         * @readonly
2144         * @virtual
2145         */
2146        public Document $document;
2147
2148        /** @virtual */
2149        public bool $registerNodeNamespaces;
2150
2151        public function __construct(Document $document, bool $registerNodeNS = true) {}
2152
2153        public function evaluate(string $expression, ?Node $contextNode = null, bool $registerNodeNS = true): null|bool|float|string|NodeList {}
2154
2155        public function query(string $expression, ?Node $contextNode = null, bool $registerNodeNS = true): NodeList {}
2156
2157        /** @implementation-alias DOMXPath::registerNamespace */
2158        public function registerNamespace(string $prefix, string $namespace): bool {}
2159
2160        /** @implementation-alias DOMXPath::registerPhpFunctions */
2161        public function registerPhpFunctions(string|array|null $restrict = null): void {}
2162
2163        /** @implementation-alias DOMXPath::registerPhpFunctionNS */
2164        public function registerPhpFunctionNS(string $namespaceURI, string $name, callable $callable): void {}
2165
2166        /** @implementation-alias DOMXPath::quote */
2167        public static function quote(string $str): string {}
2168    }
2169#endif
2170
2171    function import_simplexml(object $node): Attr|Element {}
2172}
2173