Display types in stubs more uniformly

In preparation for generating method signatures for the manual.

This change gets rid of bogus false|null return types, a few unnecessary trailing backslashes, and settles on using ? when possible for nullable types.
This commit is contained in:
Máté Kocsis 2020-09-16 21:19:36 +02:00
parent 0286decdb4
commit c76910cd96
No known key found for this signature in database
GPG Key ID: FD055E41728BF310
18 changed files with 28 additions and 29 deletions

View File

@ -56,8 +56,7 @@ class DOMNode
/** @return int */
public function getLineNo() {}
/** @return string|null
*/
/** @return string|null */
public function getNodePath() {}
/** @return bool */
@ -211,7 +210,7 @@ class DOMElement implements DOMParentNode, DOMChildNode
/** @return DOMAttr|bool */
public function setAttribute(string $qualifiedName, string $value) {}
/** @return null|false */
/** @return bool|null */
public function setAttributeNS(?string $namespace, string $qualifiedName, string $value) {}
/** @return DOMAttr|null|false */

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 6d25769eb3f8686042dccc55d8d8bd5e3852676f */
* Stub hash: 8ac9356f9b19b84e98d335bc9d091b022a0f549d */
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)

View File

@ -35,7 +35,7 @@ function imap_headerinfo($stream_id, int $msg_no, int $from_length = 0, int $sub
*/
function imap_header($stream_id, int $msg_no, int $from_length = 0, int $subject_length = 0, string $default_host = UNKNOWN): stdClass|false {}
function imap_rfc822_parse_headers(string $headers, string $default_host = 'UNKNOWN'): \stdClass {}
function imap_rfc822_parse_headers(string $headers, string $default_host = 'UNKNOWN'): stdClass {}
function imap_rfc822_write_address(string $mailbox, string $host, string $personal): string|false {}
@ -52,7 +52,7 @@ function imap_fetchtext($stream_id, int $msg_no, int $options = 0): string|false
/**
* @param resource $stream_id
* @return \stdClass|false
* @return stdClass|false
*/
function imap_bodystruct($stream_id, int $msg_no, string $section) {}
@ -166,12 +166,12 @@ function imap_utf8(string $mime_encoded_text): string {}
/**
* @param resource $stream_id
* @return \stdClass|false
* @return stdClass|false
*/
function imap_status($stream_id, string $mailbox, int $options) {}
/** @param resource $stream_id */
function imap_mailboxmsginfo($stream_id): \stdClass {}
function imap_mailboxmsginfo($stream_id): stdClass {}
/** @param resource $stream_id */
function imap_setflag_full($stream_id, string $sequence, string $flag, int $options = 0): bool {}
@ -222,7 +222,7 @@ function imap_errors(): array|false {}
function imap_last_error(): string|false {}
/** @param resource $stream_id */
function imap_search($stream_id, string $criteria, int $options = \SE_FREE, string $charset = ''): array|false {}
function imap_search($stream_id, string $criteria, int $options = SE_FREE, string $charset = ''): array|false {}
function imap_utf7_decode(string $buf): string|false {}
@ -237,7 +237,7 @@ function imap_mutf7_to_utf8(string $in): string|false {}
function imap_mime_header_decode(string $str): array|false {}
/** @param resource $stream_id */
function imap_thread($stream_id, int $options = \SE_FREE): array|false {}
function imap_thread($stream_id, int $options = SE_FREE): array|false {}
function imap_timeout(int $timeout_type, int $timeout = -1): int|bool {}

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 449bab2357a8a83cbe4f630a87776ebb5e0d65f6 */
* Stub hash: 2c859e2e8d8de83dc517a245b5b34a6dd74e5dab */
ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_open, 0, 0, 3)
ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)

View File

@ -5,7 +5,7 @@
/* calendar */
/** @param IntlTimeZone|DateTimeZone|string|null $timeZone */
function intlcal_create_instance($timeZone = null, ?string $locale = null): IntlCalendar|null {}
function intlcal_create_instance($timeZone = null, ?string $locale = null): ?IntlCalendar {}
function intlcal_get_keyword_values_for_locale(string $key, string $locale, bool $commonlyUsed): IntlIterator|false {}

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 324b7ae3eaab4777117c1c6963bc841088e6b998 */
* Stub hash: 943baf02eee2f720a45106e379534b3d4adc3072 */
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intlcal_create_instance, 0, 0, IntlCalendar, 1)
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, timeZone, "null")

View File

@ -320,14 +320,14 @@ function ocifreecursor($statement_resource): bool {}
/**
* @param resource $connection_resource
*/
function oci_close($connection_resource): bool|null {}
function oci_close($connection_resource): ?bool {}
/**
* @param resource $connection_resource
* @alias oci_close
* @deprecated
*/
function ocilogoff($connection_resource): bool|null {}
function ocilogoff($connection_resource): ?bool {}
/**
* @return resource|false

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 6cdc7c967ce80c39eaef1c860ba8f8aa2cb3c979 */
* Stub hash: 9c680329bc6159aae027df94230c6d2342021271 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_define_by_name, 0, 3, _IS_BOOL, 0)
ZEND_ARG_INFO(0, statement_resource)

View File

@ -19,7 +19,7 @@ class PDOStatement implements IteratorAggregate
/** @return int|false */
public function columnCount() {}
/** @return false|null */
/** @return bool|null */
public function debugDumpParams() {}
/** @return string|false|null */

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 18f2af62bebcbbbf0e298f781860c251cfa07930 */
* Stub hash: a35e66ccff5e569f07ae8372e661e005943dfbc7 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_bindColumn, 0, 0, 2)
ZEND_ARG_TYPE_MASK(0, column, MAY_BE_STRING|MAY_BE_LONG, NULL)

View File

@ -78,7 +78,7 @@ function socket_setopt(Socket $socket, int $level, int $optname, $optval): bool
#ifdef HAVE_SOCKETPAIR
/** @param array $fd */
function socket_create_pair(int $domain, int $type, int $protocol, &$fd): bool|null {}
function socket_create_pair(int $domain, int $type, int $protocol, &$fd): ?bool {}
#endif
#ifdef HAVE_SHUTDOWN

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: f2d1b412bf2e07c3e607aa6ebad25b19d882b98e */
* Stub hash: f35790f5f703b37c45230e97e8f0ee736727b4bd */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_select, 0, 4, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(1, read_fds, IS_ARRAY, 1)

View File

@ -211,7 +211,7 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt
/** @return int|false */
public function fputcsv(array $fields, string $delimiter = ',', string $enclosure = '"', string $escape = "\\") {}
/** @return null|false */
/** @return bool|null */
public function setCsvControl(string $delimiter = ",", string $enclosure = "\"", string $escape = "\\") {}
/** @return array */

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 9127cb70a84f3e75ed16a17b15940b8a6b5f3937 */
* Stub hash: fc41da9a307965e501bcc7e912470cf650a3d70d */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFileInfo___construct, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, file_name, IS_STRING, 0)

View File

@ -745,7 +745,7 @@ function exec(string $command, &$output = null, &$result_code = null): string|fa
function system(string $command, &$result_code = null): string|false {}
/** @param int $result_code */
function passthru(string $command, &$result_code = null): bool|null {}
function passthru(string $command, &$result_code = null): ?bool {}
function escapeshellcmd(string $command): string {}

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 0224dc521c4a8bd49fbcfd26cddb01a2e571cf74 */
* Stub hash: 7cb3c95b61a57e5b88a37638dd90ff314cc89dd4 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)

View File

@ -111,17 +111,17 @@ class ZipArchive
/** @return string|false */
public function getArchiveComment(int $flags = 0) {}
/** @return null|false */
/** @return bool|null */
public function setCommentIndex(int $index, string $comment) {}
/** @return null|false */
/** @return bool|null */
public function setCommentName(string $name, string $comment) {}
#ifdef HAVE_SET_MTIME
/** @return null|false */
/** @return bool|null */
public function setMtimeIndex(int $index, int $timestamp, int $flags = 0) {}
/** @return null|false */
/** @return bool|null */
public function setMtimeName(string $name, int $timestamp, int $flags = 0) {}
#endif

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 49f168c537e48f8a3998d67812a5e2e6a2463533 */
* Stub hash: d6e87c137cf1b372619b3890d04285d94d486c82 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_open, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)