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