xref: /PHP-8.0/ext/dom/php_dom.stub.php (revision ee11a606)
1<?php
2
3/** @generate-function-entries */
4
5class DOMDocumentType extends DOMNode
6{
7}
8
9class DOMCdataSection extends DOMText
10{
11    public function __construct(string $data) {}
12}
13
14class DOMComment extends DOMCharacterData
15{
16    public function __construct(string $data = "") {}
17}
18
19interface DOMParentNode
20{
21    /** @param DOMNode|string $nodes */
22    public function append(...$nodes): void;
23
24    /** @param DOMNode|string $nodes */
25    public function prepend(...$nodes): void;
26}
27
28interface DOMChildNode
29{
30    public function remove(): void;
31
32    /** @param DOMNode|string $nodes */
33    public function before(... $nodes): void;
34
35    /** @param DOMNode|string $nodes */
36    public function after(...$nodes): void;
37
38    /** @param DOMNode|string $nodes */
39    public function replaceWith(...$nodes): void;
40}
41
42class DOMNode
43{
44    /** @return DOMNode|false */
45    public function appendChild(DOMNode $node) {}
46
47    /** @return string|false */
48    public function C14N(bool $exclusive = false, bool $withComments = false, ?array $xpath = null, ?array $nsPrefixes = null) {}
49
50    /** @return int|false */
51    public function C14NFile(string $uri, bool $exclusive = false, bool $withComments = false, ?array $xpath = null, ?array $nsPrefixes = null) {}
52
53    /** @return DOMNode|false */
54    public function cloneNode(bool $deep = false) {}
55
56    /** @return int */
57    public function getLineNo() {}
58
59    /** @return string|null */
60    public function getNodePath() {}
61
62    /** @return bool */
63    public function hasAttributes() {}
64
65    /** @return bool */
66    public function hasChildNodes() {}
67
68    /** @return DOMNode|false */
69    public function insertBefore(DOMNode $node, ?DOMNode $child = null) {}
70
71    /** @return bool */
72    public function isDefaultNamespace(string $namespace) {}
73
74    /** @return bool */
75    public function isSameNode(DOMNode $otherNode) {}
76
77    /** @return bool */
78    public function isSupported(string $feature, string $version) {}
79
80    /** @return string|null */
81    public function lookupNamespaceURI(?string $prefix) {}
82
83    /** @return string|null */
84    public function lookupPrefix(string $namespace) {}
85
86    /** @return void */
87    public function normalize() {}
88
89    /** @return DOMNode|false */
90    public function removeChild(DOMNode $child) {}
91
92    /** @return DOMNode|false */
93    public function replaceChild(DOMNode $node, DOMNode $child) {}
94}
95
96class DOMNameSpaceNode
97{
98}
99
100class DOMImplementation
101{
102    /** @return void */
103    public function getFeature(string $feature, string $version) {}
104
105    /** @return bool */
106    public function hasFeature(string $feature, string $version) {}
107
108    /** @return DOMDocumentType|false */
109    public function createDocumentType(string $qualifiedName, string $publicId = "", string $systemId = "") {}
110
111    /** @return DOMDocument|false */
112    public function createDocument(?string $namespace = null, string $qualifiedName = "", ?DOMDocumentType $doctype = null) {}
113}
114
115class DOMDocumentFragment extends DOMNode implements DOMParentNode
116{
117    public function __construct() {}
118
119    /** @return bool */
120    public function appendXML(string $data) {}
121
122    /** @param DOMNode|string $nodes */
123    public function append(...$nodes): void {}
124
125    /** @param DOMNode|string $nodes */
126    public function prepend(...$nodes): void {}
127}
128
129class DOMNodeList implements IteratorAggregate, Countable
130{
131    /** @return int|false */
132    public function count() {}
133
134    public function getIterator(): Iterator {}
135
136    /** @return DOMNode|null */
137    public function item(int $index) {}
138}
139
140class DOMCharacterData extends DOMNode implements DOMChildNode
141{
142    /** @return bool */
143    public function appendData(string $data) {}
144
145    /** @return string|false */
146    public function substringData(int $offset, int $count) {}
147
148    /** @return bool */
149    public function insertData(int $offset, string $data) {}
150
151    /** @return bool */
152    public function deleteData(int $offset, int $count) {}
153
154    /** @return bool */
155    public function replaceData(int $offset, int $count, string $data) {}
156
157    /** @param DOMNode|string $nodes */
158    public function replaceWith(...$nodes): void {}
159
160    public function remove(): void {}
161
162    /** @param DOMNode|string $nodes */
163    public function before(... $nodes): void {}
164
165    /** @param DOMNode|string $nodes */
166    public function after(...$nodes): void {}
167}
168
169class DOMAttr extends DOMNode
170{
171    public function __construct(string $name, string $value = "") {}
172
173    /** @return bool */
174    public function isId() {}
175}
176
177class DOMElement extends DOMNode implements DOMParentNode, DOMChildNode
178{
179    public function __construct(string $qualifiedName, ?string $value = null, string $namespace = "") {}
180
181    /** @return string */
182    public function getAttribute(string $qualifiedName) {}
183
184    /** @return string */
185    public function getAttributeNS(?string $namespace, string $localName) {}
186
187    /** @return DOMAttr|DOMNameSpaceNode|false */
188    public function getAttributeNode(string $qualifiedName) {}
189
190    /** @return DOMAttr|DOMNameSpaceNode|null */
191    public function getAttributeNodeNS(?string $namespace, string $localName) {}
192
193    /** @return DOMNodeList */
194    public function getElementsByTagName(string $qualifiedName) {}
195
196    /** @return DOMNodeList */
197    public function getElementsByTagNameNS(?string $namespace, string $localName) {}
198
199    /** @return bool */
200    public function hasAttribute(string $qualifiedName) {}
201
202    /** @return bool */
203    public function hasAttributeNS(?string $namespace, string $localName) {}
204
205    /** @return bool */
206    public function removeAttribute(string $qualifiedName) {}
207
208    /** @return void */
209    public function removeAttributeNS(?string $namespace, string $localName) {}
210
211    /** @return DOMAttr|false */
212    public function removeAttributeNode(DOMAttr $attr) {}
213
214    /** @return DOMAttr|bool */
215    public function setAttribute(string $qualifiedName, string $value) {}
216
217    /** @return void */
218    public function setAttributeNS(?string $namespace, string $qualifiedName, string $value) {}
219
220    /** @return DOMAttr|null|false */
221    public function setAttributeNode(DOMAttr $attr) {}
222
223    /** @return DOMAttr|null|false */
224    public function setAttributeNodeNS(DOMAttr $attr) {}
225
226    /** @return void */
227    public function setIdAttribute(string $qualifiedName, bool $isId) {}
228
229    /** @return void */
230    public function setIdAttributeNS(string $namespace, string $qualifiedName, bool $isId) {}
231
232    /** @return void */
233    public function setIdAttributeNode(DOMAttr $attr, bool $isId) {}
234
235    public function remove(): void {}
236
237    /** @param DOMNode|string $nodes */
238    public function before(... $nodes): void {}
239
240    /** @param DOMNode|string $nodes */
241    public function after(...$nodes): void {}
242
243    /** @param DOMNode|string $nodes */
244    public function replaceWith(...$nodes): void {}
245
246    /** @param DOMNode|string $nodes */
247    public function append(...$nodes): void {}
248
249    /** @param DOMNode|string $nodes */
250    public function prepend(...$nodes): void {}
251}
252
253class DOMDocument extends DOMNode implements DOMParentNode
254{
255    public function __construct(string $version = "1.0", string $encoding = "") {}
256
257    /** @return DOMAttr|false */
258    public function createAttribute(string $localName) {}
259
260    /** @return DOMAttr|false */
261    public function createAttributeNS(?string $namespace, string $qualifiedName) {}
262
263    /** @return DOMCdataSection|false */
264    public function createCDATASection(string $data) {}
265
266    /** @return DOMComment|false */
267    public function createComment(string $data) {}
268
269    /** @return DOMDocumentFragment|false */
270    public function createDocumentFragment() {}
271
272    /** @return DOMElement|false */
273    public function createElement(string $localName, string $value = "") {}
274
275    /** @return DOMElement|false */
276    public function createElementNS(?string $namespace, string $qualifiedName, string $value = "") {}
277
278    /** @return DOMEntityReference|false */
279    public function createEntityReference(string $name) {}
280
281    /** @return DOMProcessingInstruction|false */
282    public function createProcessingInstruction(string $target, string $data = "") {}
283
284    /** @return DOMText|false */
285    public function createTextNode(string $data) {}
286
287    /** @return DOMElement|null */
288    public function getElementById(string $elementId) {}
289
290    /** @return DOMNodeList */
291    public function getElementsByTagName(string $qualifiedName) {}
292
293    /** @return DOMNodeList */
294    public function getElementsByTagNameNS(?string $namespace, string $localName) {}
295
296    /** @return DOMNode|false */
297    public function importNode(DOMNode $node, bool $deep = false) {}
298
299    /** @return DOMDocument|bool */
300    public function load(string $filename, int $options = 0) {}
301
302    /** @return DOMDocument|bool */
303    public function loadXML(string $source, int $options = 0) {}
304
305    /** @return void */
306    public function normalizeDocument() {}
307
308    /** @return bool */
309    public function registerNodeClass(string $baseClass, ?string $extendedClass) {}
310
311    /** @return int|false */
312    public function save(string $filename, int $options = 0) {}
313
314#ifdef LIBXML_HTML_ENABLED
315    /** @return DOMDocument|bool */
316    public function loadHTML(string $source, int $options = 0) {}
317
318    /** @return DOMDocument|bool */
319    public function loadHTMLFile(string $filename, int $options = 0) {}
320
321    /** @return string|false */
322    public function saveHTML(?DOMNode $node = null) {}
323
324    /** @return int|false */
325    public function saveHTMLFile(string $filename) {}
326#endif
327
328    /** @return string|false */
329    public function saveXML(?DOMNode $node = null, int $options = 0) {}
330
331#ifdef LIBXML_SCHEMAS_ENABLED
332    /** @return bool */
333    public function schemaValidate(string $filename, int $flags = 0) {}
334
335    /** @return bool */
336    public function schemaValidateSource(string $source, int $flags = 0) {}
337
338    /** @return bool */
339    public function relaxNGValidate(string $filename) {}
340
341    /** @return bool */
342    public function relaxNGValidateSource(string $source) {}
343#endif
344
345    /** @return bool */
346    public function validate() {}
347
348    /** @return int|false */
349    public function xinclude(int $options = 0) {}
350
351    /** @return DOMNode|false */
352    public function adoptNode(DOMNode $node) {}
353
354    /** @param DOMNode|string $nodes */
355    public function append(...$nodes): void {}
356
357    /** @param DOMNode|string $nodes */
358    public function prepend(...$nodes): void {}
359}
360
361final class DOMException extends Exception
362{
363}
364
365class DOMText extends DOMCharacterData
366{
367    public function __construct(string $data = "") {}
368
369    /** @return bool */
370    public function isWhitespaceInElementContent() {}
371
372    /**
373     * @return bool
374     * @alias DOMText::isWhitespaceInElementContent
375     */
376    public function isElementContentWhitespace() {}
377
378    /** @return DOMText|false */
379    public function splitText(int $offset) {}
380}
381
382class DOMNamedNodeMap implements IteratorAggregate, Countable
383{
384    /** @return DOMNode|null */
385    public function getNamedItem(string $qualifiedName) {}
386
387    /** @return DOMNode|null */
388    public function getNamedItemNS(?string $namespace, string $localName) {}
389
390    /** @return DOMNode|null */
391    public function item(int $index) {}
392
393    /** @return int|false */
394    public function count() {}
395
396    public function getIterator(): Iterator {}
397}
398
399class DOMEntity extends DOMNode
400{
401}
402
403class DOMEntityReference extends DOMNode
404{
405    public function __construct(string $name) {}
406}
407
408class DOMNotation extends DOMNode
409{
410}
411
412class DOMProcessingInstruction extends DOMNode
413{
414    public function __construct(string $name, string $value = "") {}
415}
416
417#ifdef LIBXML_XPATH_ENABLED
418class DOMXPath
419{
420    public function __construct(DOMDocument $document, bool $registerNodeNS = true) {}
421
422    /** @return mixed */
423    public function evaluate(string $expression, ?DOMNode $contextNode = null, bool $registerNodeNS = true) {}
424
425    /** @return mixed */
426    public function query(string $expression, ?DOMNode $contextNode = null, bool $registerNodeNS = true) {}
427
428    /** @return bool */
429    public function registerNamespace(string $prefix, string $namespace) {}
430
431    /** @return void */
432    public function registerPhpFunctions(string|array|null $restrict = null) {}
433}
434#endif
435
436function dom_import_simplexml(object $node): DOMElement {}
437