From 65995002f0f4caea14a78afc29ed1dd19a8e5e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Tue, 25 May 2021 19:15:18 +0200 Subject: [PATCH] Declare tentative return types for ext/xmlwriter Relates to GH-6995 --- ext/xmlwriter/php_xmlwriter.stub.php | 168 +++++++++++++------------- ext/xmlwriter/php_xmlwriter_arginfo.h | 46 +++---- 2 files changed, 107 insertions(+), 107 deletions(-) diff --git a/ext/xmlwriter/php_xmlwriter.stub.php b/ext/xmlwriter/php_xmlwriter.stub.php index ee90003399b..7f3ff5be103 100644 --- a/ext/xmlwriter/php_xmlwriter.stub.php +++ b/ext/xmlwriter/php_xmlwriter.stub.php @@ -89,256 +89,256 @@ function xmlwriter_flush(XMLWriter $writer, bool $empty = true): string|int {} class XMLWriter { /** - * @return bool + * @tentative-return-type * @alias xmlwriter_open_uri * @no-verify Behaviour differs from the aliased function */ - public function openUri(string $uri) {} + public function openUri(string $uri): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_open_memory * @no-verify Behaviour differs from the aliased function */ - public function openMemory() {} + public function openMemory(): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_set_indent */ - public function setIndent(bool $enable) {} + public function setIndent(bool $enable): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_set_indent_string */ - public function setIndentString(string $indentation) {} + public function setIndentString(string $indentation): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_start_comment */ - public function startComment() {} + public function startComment(): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_end_comment */ - public function endComment() {} + public function endComment(): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_start_attribute */ - public function startAttribute(string $name) {} + public function startAttribute(string $name): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_end_attribute */ - public function endAttribute() {} + public function endAttribute(): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_write_attribute */ - public function writeAttribute(string $name, string $value) {} + public function writeAttribute(string $name, string $value): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_start_attribute_ns */ - public function startAttributeNs(?string $prefix, string $name, ?string $namespace) {} + public function startAttributeNs(?string $prefix, string $name, ?string $namespace): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_write_attribute_ns */ - public function writeAttributeNs(?string $prefix, string $name, ?string $namespace, string $value) {} + public function writeAttributeNs(?string $prefix, string $name, ?string $namespace, string $value): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_start_element */ - public function startElement(string $name) {} + public function startElement(string $name): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_end_element */ - public function endElement() {} + public function endElement(): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_full_end_element */ - public function fullEndElement() {} + public function fullEndElement(): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_start_element_ns */ - public function startElementNs(?string $prefix, string $name, ?string $namespace) {} + public function startElementNs(?string $prefix, string $name, ?string $namespace): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_write_element */ - public function writeElement(string $name, ?string $content = null) {} + public function writeElement(string $name, ?string $content = null): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_write_element_ns */ - public function writeElementNs(?string $prefix, string $name, ?string $namespace, ?string $content = null) {} + public function writeElementNs(?string $prefix, string $name, ?string $namespace, ?string $content = null): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_start_pi */ - public function startPi(string $target) {} + public function startPi(string $target): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_end_pi */ - public function endPi() {} + public function endPi(): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_write_pi */ - public function writePi(string $target, string $content) {} + public function writePi(string $target, string $content): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_start_cdata */ - public function startCdata() {} + public function startCdata(): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_end_cdata * */ - public function endCdata() {} + public function endCdata(): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_write_cdata */ - public function writeCdata(string $content) {} + public function writeCdata(string $content): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_text */ - public function text(string $content) {} + public function text(string $content): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_write_raw */ - public function writeRaw(string $content) {} + public function writeRaw(string $content): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_start_document */ - public function startDocument(?string $version = "1.0", ?string $encoding = null, ?string $standalone = null) {} + public function startDocument(?string $version = "1.0", ?string $encoding = null, ?string $standalone = null): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_end_document */ - public function endDocument() {} + public function endDocument(): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_write_comment */ - public function writeComment(string $content) {} + public function writeComment(string $content): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_start_dtd */ - public function startDtd(string $qualifiedName, ?string $publicId = null, ?string $systemId = null) {} + public function startDtd(string $qualifiedName, ?string $publicId = null, ?string $systemId = null): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_end_dtd */ - public function endDtd() {} + public function endDtd(): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_write_dtd */ - public function writeDtd(string $name, ?string $publicId = null, ?string $systemId = null, ?string $content = null) {} + public function writeDtd(string $name, ?string $publicId = null, ?string $systemId = null, ?string $content = null): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_start_dtd_element */ - public function startDtdElement(string $qualifiedName) {} + public function startDtdElement(string $qualifiedName): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_end_dtd_element */ - public function endDtdElement() {} + public function endDtdElement(): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_write_dtd_element */ - public function writeDtdElement(string $name, string $content) {} + public function writeDtdElement(string $name, string $content): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_start_dtd_attlist */ - public function startDtdAttlist(string $name) {} + public function startDtdAttlist(string $name): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_end_dtd_attlist */ - public function endDtdAttlist() {} + public function endDtdAttlist(): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_write_dtd_attlist */ - public function writeDtdAttlist(string $name, string $content) {} + public function writeDtdAttlist(string $name, string $content): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_start_dtd_entity */ - public function startDtdEntity(string $name, bool $isParam) {} + public function startDtdEntity(string $name, bool $isParam): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_end_dtd_entity */ - public function endDtdEntity() {} + public function endDtdEntity(): bool {} /** - * @return bool + * @tentative-return-type * @alias xmlwriter_write_dtd_entity */ - public function writeDtdEntity(string $name, string $content, bool $isParam = false, ?string $publicId = null, ?string $systemId = null, ?string $notationData = null) {} + public function writeDtdEntity(string $name, string $content, bool $isParam = false, ?string $publicId = null, ?string $systemId = null, ?string $notationData = null): bool {} /** - * @return string + * @tentative-return-type * @alias xmlwriter_output_memory */ - public function outputMemory(bool $flush = true) {} + public function outputMemory(bool $flush = true): string {} /** - * @return string|int + * @tentative-return-type * @alias xmlwriter_flush */ - public function flush(bool $empty = true) {} + public function flush(bool $empty = true): string|int {} } diff --git a/ext/xmlwriter/php_xmlwriter_arginfo.h b/ext/xmlwriter/php_xmlwriter_arginfo.h index 7547479b3bf..8c83c9497d1 100644 --- a/ext/xmlwriter/php_xmlwriter_arginfo.h +++ b/ext/xmlwriter/php_xmlwriter_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ce5cf4f922e47833033729b2a8941c36fa2b4d6d */ + * Stub hash: 820ad2d68166b189b9163c2c3dfcc76806d41b7d */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_xmlwriter_open_uri, 0, 1, XMLWriter, MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 0) @@ -175,18 +175,18 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_xmlwriter_flush, 0, 1, MAY_BE_ST ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, empty, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_openUri, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_openUri, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_openMemory, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_openMemory, 0, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_setIndent, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_setIndent, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, enable, _IS_BOOL, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_setIndentString, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_setIndentString, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, indentation, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -194,24 +194,24 @@ ZEND_END_ARG_INFO() #define arginfo_class_XMLWriter_endComment arginfo_class_XMLWriter_openMemory -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_startAttribute, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startAttribute, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ZEND_END_ARG_INFO() #define arginfo_class_XMLWriter_endAttribute arginfo_class_XMLWriter_openMemory -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_writeAttribute, 0, 0, 2) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeAttribute, 0, 2, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_startAttributeNs, 0, 0, 3) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startAttributeNs, 0, 3, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 1) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 1) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_writeAttributeNs, 0, 0, 4) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeAttributeNs, 0, 4, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 1) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 1) @@ -226,25 +226,25 @@ ZEND_END_ARG_INFO() #define arginfo_class_XMLWriter_startElementNs arginfo_class_XMLWriter_startAttributeNs -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_writeElement, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeElement, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, content, IS_STRING, 1, "null") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_writeElementNs, 0, 0, 3) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeElementNs, 0, 3, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 1) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 1) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, content, IS_STRING, 1, "null") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_startPi, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startPi, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, target, IS_STRING, 0) ZEND_END_ARG_INFO() #define arginfo_class_XMLWriter_endPi arginfo_class_XMLWriter_openMemory -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_writePi, 0, 0, 2) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writePi, 0, 2, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, target, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -253,7 +253,7 @@ ZEND_END_ARG_INFO() #define arginfo_class_XMLWriter_endCdata arginfo_class_XMLWriter_openMemory -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_writeCdata, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeCdata, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -261,7 +261,7 @@ ZEND_END_ARG_INFO() #define arginfo_class_XMLWriter_writeRaw arginfo_class_XMLWriter_writeCdata -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_startDocument, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startDocument, 0, 0, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, version, IS_STRING, 1, "\"1.0\"") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, standalone, IS_STRING, 1, "null") @@ -271,7 +271,7 @@ ZEND_END_ARG_INFO() #define arginfo_class_XMLWriter_writeComment arginfo_class_XMLWriter_writeCdata -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_startDtd, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startDtd, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, qualifiedName, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, publicId, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, systemId, IS_STRING, 1, "null") @@ -279,20 +279,20 @@ ZEND_END_ARG_INFO() #define arginfo_class_XMLWriter_endDtd arginfo_class_XMLWriter_openMemory -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_writeDtd, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeDtd, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, publicId, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, systemId, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, content, IS_STRING, 1, "null") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_startDtdElement, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startDtdElement, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, qualifiedName, IS_STRING, 0) ZEND_END_ARG_INFO() #define arginfo_class_XMLWriter_endDtdElement arginfo_class_XMLWriter_openMemory -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_writeDtdElement, 0, 0, 2) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeDtdElement, 0, 2, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -303,14 +303,14 @@ ZEND_END_ARG_INFO() #define arginfo_class_XMLWriter_writeDtdAttlist arginfo_class_XMLWriter_writeDtdElement -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_startDtdEntity, 0, 0, 2) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startDtdEntity, 0, 2, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, isParam, _IS_BOOL, 0) ZEND_END_ARG_INFO() #define arginfo_class_XMLWriter_endDtdEntity arginfo_class_XMLWriter_openMemory -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_writeDtdEntity, 0, 0, 2) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeDtdEntity, 0, 2, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, isParam, _IS_BOOL, 0, "false") @@ -319,11 +319,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_writeDtdEntity, 0, 0, 2) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, notationData, IS_STRING, 1, "null") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_outputMemory, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_outputMemory, 0, 0, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flush, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLWriter_flush, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_XMLWriter_flush, 0, 0, MAY_BE_STRING|MAY_BE_LONG) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, empty, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO()