Skip to content

Declare tentative return types for ext/xmlreader, ext/xmlwriter, and ext/xsl #6995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 45 additions & 45 deletions ext/xmlreader/php_xmlreader.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,77 +33,77 @@ class XMLReader
public string $xmlLang;

/** @return bool */
public function close() {}
public function close() {} // TODO make the return type void

/** @return string|null */
public function getAttribute(string $name) {}
/** @tentative-return-type */
public function getAttribute(string $name): ?string {}

/** @return string|null */
public function getAttributeNo(int $index) {}
/** @tentative-return-type */
public function getAttributeNo(int $index): ?string {}

/** @return string|null */
public function getAttributeNs(string $name, string $namespace) {}
/** @tentative-return-type */
public function getAttributeNs(string $name, string $namespace): ?string {}

/** @return bool */
public function getParserProperty(int $property) {}
/** @tentative-return-type */
public function getParserProperty(int $property): bool {}

/** @return bool */
public function isValid() {}
/** @tentative-return-type */
public function isValid(): bool {}

/** @return string|null */
public function lookupNamespace(string $prefix) {}
/** @tentative-return-type */
public function lookupNamespace(string $prefix): ?string {}

/** @return bool */
public function moveToAttribute(string $name) {}
/** @tentative-return-type */
public function moveToAttribute(string $name): bool {}

/** @return bool */
public function moveToAttributeNo(int $index) {}
/** @tentative-return-type */
public function moveToAttributeNo(int $index): bool {}

/** @return bool */
public function moveToAttributeNs(string $name, string $namespace) {}
/** @tentative-return-type */
public function moveToAttributeNs(string $name, string $namespace): bool {}

/** @return bool */
public function moveToElement() {}
/** @tentative-return-type */
public function moveToElement(): bool {}

/** @return bool */
public function moveToFirstAttribute() {}
/** @tentative-return-type */
public function moveToFirstAttribute(): bool {}

/** @return bool */
public function moveToNextAttribute() {}
/** @tentative-return-type */
public function moveToNextAttribute(): bool {}

/** @return bool */
public function read() {}
/** @tentative-return-type */
public function read(): bool {}

/** @return bool */
public function next(?string $name = null) {}
/** @tentative-return-type */
public function next(?string $name = null): bool {}

/** @return bool|XMLReader */
public static function open(string $uri, ?string $encoding = null, int $flags = 0) {}

/** @return string */
public function readInnerXml() {}
/** @tentative-return-type */
public function readInnerXml(): string {}

/** @return string */
public function readOuterXml() {}
/** @tentative-return-type */
public function readOuterXml(): string {}

/** @return string */
public function readString() {}
/** @tentative-return-type */
public function readString(): string {}

/** @return bool */
public function setSchema(?string $filename) {}
/** @tentative-return-type */
public function setSchema(?string $filename): bool {}

/** @return bool */
public function setParserProperty(int $property, bool $value) {}
/** @tentative-return-type */
public function setParserProperty(int $property, bool $value): bool {}

/** @return bool */
public function setRelaxNGSchema(?string $filename) {}
/** @tentative-return-type */
public function setRelaxNGSchema(?string $filename): bool {}

/** @return bool */
public function setRelaxNGSchemaSource(?string $source) {}
/** @tentative-return-type */
public function setRelaxNGSchemaSource(?string $source): bool {}

/** @return bool|XMLReader */
public static function XML(string $source, ?string $encoding = null, int $flags = 0) {}

/** @return DOMNode|false */
public function expand(?DOMNode $baseNode = null) {}
/** @tentative-return-type */
public function expand(?DOMNode $baseNode = null): DOMNode|false {}
}
53 changes: 31 additions & 22 deletions ext/xmlreader/php_xmlreader_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,47 +1,55 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 49adb3008ade3f92f9b764ead9366efc6681e46f */
* Stub hash: 0678d0de4ee5e1390055f588d1481eff8a530fc0 */

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_close, 0, 0, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_getAttribute, 0, 0, 1)
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLReader_getAttribute, 0, 1, IS_STRING, 1)
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_getAttributeNo, 0, 0, 1)
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLReader_getAttributeNo, 0, 1, IS_STRING, 1)
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_getAttributeNs, 0, 0, 2)
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLReader_getAttributeNs, 0, 2, IS_STRING, 1)
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_getParserProperty, 0, 0, 1)
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLReader_getParserProperty, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, property, IS_LONG, 0)
ZEND_END_ARG_INFO()

#define arginfo_class_XMLReader_isValid arginfo_class_XMLReader_close
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLReader_isValid, 0, 0, _IS_BOOL, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_lookupNamespace, 0, 0, 1)
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLReader_lookupNamespace, 0, 1, IS_STRING, 1)
ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
ZEND_END_ARG_INFO()

#define arginfo_class_XMLReader_moveToAttribute arginfo_class_XMLReader_getAttribute
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLReader_moveToAttribute, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
ZEND_END_ARG_INFO()

#define arginfo_class_XMLReader_moveToAttributeNo arginfo_class_XMLReader_getAttributeNo
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLReader_moveToAttributeNo, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
ZEND_END_ARG_INFO()

#define arginfo_class_XMLReader_moveToAttributeNs arginfo_class_XMLReader_getAttributeNs
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLReader_moveToAttributeNs, 0, 2, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0)
ZEND_END_ARG_INFO()

#define arginfo_class_XMLReader_moveToElement arginfo_class_XMLReader_close
#define arginfo_class_XMLReader_moveToElement arginfo_class_XMLReader_isValid

#define arginfo_class_XMLReader_moveToFirstAttribute arginfo_class_XMLReader_close
#define arginfo_class_XMLReader_moveToFirstAttribute arginfo_class_XMLReader_isValid

#define arginfo_class_XMLReader_moveToNextAttribute arginfo_class_XMLReader_close
#define arginfo_class_XMLReader_moveToNextAttribute arginfo_class_XMLReader_isValid

#define arginfo_class_XMLReader_read arginfo_class_XMLReader_close
#define arginfo_class_XMLReader_read arginfo_class_XMLReader_isValid

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_next, 0, 0, 0)
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLReader_next, 0, 0, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, name, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()

Expand All @@ -51,24 +59,25 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_open, 0, 0, 1)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()

#define arginfo_class_XMLReader_readInnerXml arginfo_class_XMLReader_close
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLReader_readInnerXml, 0, 0, IS_STRING, 0)
ZEND_END_ARG_INFO()

#define arginfo_class_XMLReader_readOuterXml arginfo_class_XMLReader_close
#define arginfo_class_XMLReader_readOuterXml arginfo_class_XMLReader_readInnerXml

#define arginfo_class_XMLReader_readString arginfo_class_XMLReader_close
#define arginfo_class_XMLReader_readString arginfo_class_XMLReader_readInnerXml

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_setSchema, 0, 0, 1)
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLReader_setSchema, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 1)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_setParserProperty, 0, 0, 2)
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLReader_setParserProperty, 0, 2, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, property, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, value, _IS_BOOL, 0)
ZEND_END_ARG_INFO()

#define arginfo_class_XMLReader_setRelaxNGSchema arginfo_class_XMLReader_setSchema

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_setRelaxNGSchemaSource, 0, 0, 1)
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLReader_setRelaxNGSchemaSource, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 1)
ZEND_END_ARG_INFO()

Expand All @@ -78,7 +87,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_XML, 0, 0, 1)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_expand, 0, 0, 0)
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_XMLReader_expand, 0, 0, DOMNode, MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, baseNode, DOMNode, 1, "null")
ZEND_END_ARG_INFO()

Expand Down
Loading