Skip to content

Commit

Permalink
Add minimial tentative types to dom
Browse files Browse the repository at this point in the history
Just for implementations of Countable. These (no longer) suffer
from an overly broad return type.
  • Loading branch information
nikic committed Jul 16, 2021
1 parent 4cf0269 commit cad6144
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 2 additions & 4 deletions ext/dom/php_dom.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ class DOMNodeList implements IteratorAggregate, Countable
/** @readonly */
public int $length;

/** @return int */
public function count() {}
public function count(): int {}

public function getIterator(): Iterator {}

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

/** @return int */
public function count() {}
public function count(): int {}

public function getIterator(): Iterator {}
}
Expand Down
7 changes: 4 additions & 3 deletions ext/dom/php_dom_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 98af31a563c0e793308c583a80a1be77c4965e82 */
* Stub hash: 8fe764fbc22387ea36d36d3e5bec3c003d742c8c */

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_dom_import_simplexml, 0, 1, DOMElement, 1)
ZEND_ARG_TYPE_INFO(0, node, IS_OBJECT, 0)
Expand Down Expand Up @@ -119,7 +119,8 @@ ZEND_END_ARG_INFO()

#define arginfo_class_DOMDocumentFragment_prepend arginfo_class_DOMParentNode_append

#define arginfo_class_DOMNodeList_count arginfo_class_DOMNode_getLineNo
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_DOMNodeList_count, 0, 0, IS_LONG, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_DOMNodeList_getIterator, 0, 0, Iterator, 0)
ZEND_END_ARG_INFO()
Expand Down Expand Up @@ -400,7 +401,7 @@ ZEND_END_ARG_INFO()

#define arginfo_class_DOMNamedNodeMap_item arginfo_class_DOMNodeList_item

#define arginfo_class_DOMNamedNodeMap_count arginfo_class_DOMNode_getLineNo
#define arginfo_class_DOMNamedNodeMap_count arginfo_class_DOMNodeList_count

#define arginfo_class_DOMNamedNodeMap_getIterator arginfo_class_DOMNodeList_getIterator

Expand Down

0 comments on commit cad6144

Please sign in to comment.