Skip to content

Commit c76910c

Browse files
committed
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.
1 parent 0286dec commit c76910c

18 files changed

+28
-29
lines changed

ext/dom/php_dom.stub.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ public function cloneNode(bool $deep = false) {}
5656
/** @return int */
5757
public function getLineNo() {}
5858

59-
/** @return string|null
60-
*/
59+
/** @return string|null */
6160
public function getNodePath() {}
6261

6362
/** @return bool */
@@ -211,7 +210,7 @@ public function removeAttributeNode(string $qualifiedName) {}
211210
/** @return DOMAttr|bool */
212211
public function setAttribute(string $qualifiedName, string $value) {}
213212

214-
/** @return null|false */
213+
/** @return bool|null */
215214
public function setAttributeNS(?string $namespace, string $qualifiedName, string $value) {}
216215

217216
/** @return DOMAttr|null|false */

ext/dom/php_dom_arginfo.h

Lines changed: 1 addition & 1 deletion
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: 6d25769eb3f8686042dccc55d8d8bd5e3852676f */
2+
* Stub hash: 8ac9356f9b19b84e98d335bc9d091b022a0f549d */
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)

ext/imap/php_imap.stub.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function imap_headerinfo($stream_id, int $msg_no, int $from_length = 0, int $sub
3535
*/
3636
function imap_header($stream_id, int $msg_no, int $from_length = 0, int $subject_length = 0, string $default_host = UNKNOWN): stdClass|false {}
3737

38-
function imap_rfc822_parse_headers(string $headers, string $default_host = 'UNKNOWN'): \stdClass {}
38+
function imap_rfc822_parse_headers(string $headers, string $default_host = 'UNKNOWN'): stdClass {}
3939

4040
function imap_rfc822_write_address(string $mailbox, string $host, string $personal): string|false {}
4141

@@ -52,7 +52,7 @@ function imap_fetchtext($stream_id, int $msg_no, int $options = 0): string|false
5252

5353
/**
5454
* @param resource $stream_id
55-
* @return \stdClass|false
55+
* @return stdClass|false
5656
*/
5757
function imap_bodystruct($stream_id, int $msg_no, string $section) {}
5858

@@ -166,12 +166,12 @@ function imap_utf8(string $mime_encoded_text): string {}
166166

167167
/**
168168
* @param resource $stream_id
169-
* @return \stdClass|false
169+
* @return stdClass|false
170170
*/
171171
function imap_status($stream_id, string $mailbox, int $options) {}
172172

173173
/** @param resource $stream_id */
174-
function imap_mailboxmsginfo($stream_id): \stdClass {}
174+
function imap_mailboxmsginfo($stream_id): stdClass {}
175175

176176
/** @param resource $stream_id */
177177
function imap_setflag_full($stream_id, string $sequence, string $flag, int $options = 0): bool {}
@@ -222,7 +222,7 @@ function imap_errors(): array|false {}
222222
function imap_last_error(): string|false {}
223223

224224
/** @param resource $stream_id */
225-
function imap_search($stream_id, string $criteria, int $options = \SE_FREE, string $charset = ''): array|false {}
225+
function imap_search($stream_id, string $criteria, int $options = SE_FREE, string $charset = ''): array|false {}
226226

227227
function imap_utf7_decode(string $buf): string|false {}
228228

@@ -237,7 +237,7 @@ function imap_mutf7_to_utf8(string $in): string|false {}
237237
function imap_mime_header_decode(string $str): array|false {}
238238

239239
/** @param resource $stream_id */
240-
function imap_thread($stream_id, int $options = \SE_FREE): array|false {}
240+
function imap_thread($stream_id, int $options = SE_FREE): array|false {}
241241

242242
function imap_timeout(int $timeout_type, int $timeout = -1): int|bool {}
243243

ext/imap/php_imap_arginfo.h

Lines changed: 1 addition & 1 deletion
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: 449bab2357a8a83cbe4f630a87776ebb5e0d65f6 */
2+
* Stub hash: 2c859e2e8d8de83dc517a245b5b34a6dd74e5dab */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_open, 0, 0, 3)
55
ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)

ext/intl/php_intl.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* calendar */
66

77
/** @param IntlTimeZone|DateTimeZone|string|null $timeZone */
8-
function intlcal_create_instance($timeZone = null, ?string $locale = null): IntlCalendar|null {}
8+
function intlcal_create_instance($timeZone = null, ?string $locale = null): ?IntlCalendar {}
99

1010
function intlcal_get_keyword_values_for_locale(string $key, string $locale, bool $commonlyUsed): IntlIterator|false {}
1111

ext/intl/php_intl_arginfo.h

Lines changed: 1 addition & 1 deletion
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: 324b7ae3eaab4777117c1c6963bc841088e6b998 */
2+
* Stub hash: 943baf02eee2f720a45106e379534b3d4adc3072 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intlcal_create_instance, 0, 0, IntlCalendar, 1)
55
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, timeZone, "null")

ext/oci8/oci8.stub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,14 +320,14 @@ function ocifreecursor($statement_resource): bool {}
320320
/**
321321
* @param resource $connection_resource
322322
*/
323-
function oci_close($connection_resource): bool|null {}
323+
function oci_close($connection_resource): ?bool {}
324324

325325
/**
326326
* @param resource $connection_resource
327327
* @alias oci_close
328328
* @deprecated
329329
*/
330-
function ocilogoff($connection_resource): bool|null {}
330+
function ocilogoff($connection_resource): ?bool {}
331331

332332
/**
333333
* @return resource|false

ext/oci8/oci8_arginfo.h

Lines changed: 1 addition & 1 deletion
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: 6cdc7c967ce80c39eaef1c860ba8f8aa2cb3c979 */
2+
* Stub hash: 9c680329bc6159aae027df94230c6d2342021271 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_define_by_name, 0, 3, _IS_BOOL, 0)
55
ZEND_ARG_INFO(0, statement_resource)

ext/pdo/pdo_stmt.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function closeCursor() {}
1919
/** @return int|false */
2020
public function columnCount() {}
2121

22-
/** @return false|null */
22+
/** @return bool|null */
2323
public function debugDumpParams() {}
2424

2525
/** @return string|false|null */

ext/pdo/pdo_stmt_arginfo.h

Lines changed: 1 addition & 1 deletion
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: 18f2af62bebcbbbf0e298f781860c251cfa07930 */
2+
* Stub hash: a35e66ccff5e569f07ae8372e661e005943dfbc7 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_bindColumn, 0, 0, 2)
55
ZEND_ARG_TYPE_MASK(0, column, MAY_BE_STRING|MAY_BE_LONG, NULL)

ext/sockets/sockets.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function socket_setopt(Socket $socket, int $level, int $optname, $optval): bool
7878

7979
#ifdef HAVE_SOCKETPAIR
8080
/** @param array $fd */
81-
function socket_create_pair(int $domain, int $type, int $protocol, &$fd): bool|null {}
81+
function socket_create_pair(int $domain, int $type, int $protocol, &$fd): ?bool {}
8282
#endif
8383

8484
#ifdef HAVE_SHUTDOWN

ext/sockets/sockets_arginfo.h

Lines changed: 1 addition & 1 deletion
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: f2d1b412bf2e07c3e607aa6ebad25b19d882b98e */
2+
* Stub hash: f35790f5f703b37c45230e97e8f0ee736727b4bd */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_select, 0, 4, MAY_BE_LONG|MAY_BE_FALSE)
55
ZEND_ARG_TYPE_INFO(1, read_fds, IS_ARRAY, 1)

ext/spl/spl_directory.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public function fgetcsv(string $delimiter = ",", string $enclosure = '"', string
211211
/** @return int|false */
212212
public function fputcsv(array $fields, string $delimiter = ',', string $enclosure = '"', string $escape = "\\") {}
213213

214-
/** @return null|false */
214+
/** @return bool|null */
215215
public function setCsvControl(string $delimiter = ",", string $enclosure = "\"", string $escape = "\\") {}
216216

217217
/** @return array */

ext/spl/spl_directory_arginfo.h

Lines changed: 1 addition & 1 deletion
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: 9127cb70a84f3e75ed16a17b15940b8a6b5f3937 */
2+
* Stub hash: fc41da9a307965e501bcc7e912470cf650a3d70d */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFileInfo___construct, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, file_name, IS_STRING, 0)

ext/standard/basic_functions.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ function exec(string $command, &$output = null, &$result_code = null): string|fa
745745
function system(string $command, &$result_code = null): string|false {}
746746

747747
/** @param int $result_code */
748-
function passthru(string $command, &$result_code = null): bool|null {}
748+
function passthru(string $command, &$result_code = null): ?bool {}
749749

750750
function escapeshellcmd(string $command): string {}
751751

ext/standard/basic_functions_arginfo.h

Lines changed: 1 addition & 1 deletion
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: 0224dc521c4a8bd49fbcfd26cddb01a2e571cf74 */
2+
* Stub hash: 7cb3c95b61a57e5b88a37638dd90ff314cc89dd4 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
55
ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)

ext/zip/php_zip.stub.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,17 @@ public function setArchiveComment(string $comment) {}
111111
/** @return string|false */
112112
public function getArchiveComment(int $flags = 0) {}
113113

114-
/** @return null|false */
114+
/** @return bool|null */
115115
public function setCommentIndex(int $index, string $comment) {}
116116

117-
/** @return null|false */
117+
/** @return bool|null */
118118
public function setCommentName(string $name, string $comment) {}
119119

120120
#ifdef HAVE_SET_MTIME
121-
/** @return null|false */
121+
/** @return bool|null */
122122
public function setMtimeIndex(int $index, int $timestamp, int $flags = 0) {}
123123

124-
/** @return null|false */
124+
/** @return bool|null */
125125
public function setMtimeName(string $name, int $timestamp, int $flags = 0) {}
126126
#endif
127127

ext/zip/php_zip_arginfo.h

Lines changed: 1 addition & 1 deletion
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: 49f168c537e48f8a3998d67812a5e2e6a2463533 */
2+
* Stub hash: d6e87c137cf1b372619b3890d04285d94d486c82 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_open, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)

0 commit comments

Comments
 (0)