Skip to content

Commit cad6144

Browse files
committed
Add minimial tentative types to dom
Just for implementations of Countable. These (no longer) suffer from an overly broad return type.
1 parent 4cf0269 commit cad6144

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

ext/dom/php_dom.stub.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,7 @@ class DOMNodeList implements IteratorAggregate, Countable
225225
/** @readonly */
226226
public int $length;
227227

228-
/** @return int */
229-
public function count() {}
228+
public function count(): int {}
230229

231230
public function getIterator(): Iterator {}
232231

@@ -602,8 +601,7 @@ public function getNamedItemNS(?string $namespace, string $localName) {}
602601
/** @return DOMNode|null */
603602
public function item(int $index) {}
604603

605-
/** @return int */
606-
public function count() {}
604+
public function count(): int {}
607605

608606
public function getIterator(): Iterator {}
609607
}

ext/dom/php_dom_arginfo.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 98af31a563c0e793308c583a80a1be77c4965e82 */
2+
* Stub hash: 8fe764fbc22387ea36d36d3e5bec3c003d742c8c */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_dom_import_simplexml, 0, 1, DOMElement, 1)
55
ZEND_ARG_TYPE_INFO(0, node, IS_OBJECT, 0)
@@ -119,7 +119,8 @@ ZEND_END_ARG_INFO()
119119

120120
#define arginfo_class_DOMDocumentFragment_prepend arginfo_class_DOMParentNode_append
121121

122-
#define arginfo_class_DOMNodeList_count arginfo_class_DOMNode_getLineNo
122+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_DOMNodeList_count, 0, 0, IS_LONG, 0)
123+
ZEND_END_ARG_INFO()
123124

124125
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_DOMNodeList_getIterator, 0, 0, Iterator, 0)
125126
ZEND_END_ARG_INFO()
@@ -400,7 +401,7 @@ ZEND_END_ARG_INFO()
400401

401402
#define arginfo_class_DOMNamedNodeMap_item arginfo_class_DOMNodeList_item
402403

403-
#define arginfo_class_DOMNamedNodeMap_count arginfo_class_DOMNode_getLineNo
404+
#define arginfo_class_DOMNamedNodeMap_count arginfo_class_DOMNodeList_count
404405

405406
#define arginfo_class_DOMNamedNodeMap_getIterator arginfo_class_DOMNodeList_getIterator
406407

0 commit comments

Comments
 (0)