Skip to content

Commit 2101ab9

Browse files
committed
Declare true return types
1 parent 0ae6a67 commit 2101ab9

File tree

4 files changed

+36
-47
lines changed

4 files changed

+36
-47
lines changed

Zend/zend_builtin_functions.stub.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,12 @@ function user_error(string $message, int $error_level = E_USER_NOTICE): bool {}
102102
/** @return callable|null */
103103
function set_error_handler(?callable $callback, int $error_levels = E_ALL) {}
104104

105-
/** @return true */
106-
function restore_error_handler(): bool {}
105+
function restore_error_handler(): true {}
107106

108107
/** @return callable|null */
109108
function set_exception_handler(?callable $callback) {}
110109

111-
/** @return true */
112-
function restore_exception_handler(): bool {}
110+
function restore_exception_handler(): true {}
113111

114112
/**
115113
* @return array<int, string>

Zend/zend_builtin_functions_arginfo.h

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/standard/basic_functions.stub.php

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,9 @@ function stream_wrapper_restore(string $protocol): bool {}
8282

8383
function array_push(array &$array, mixed ...$values): int {}
8484

85-
/** @return true */
86-
function krsort(array &$array, int $flags = SORT_REGULAR): bool {}
85+
function krsort(array &$array, int $flags = SORT_REGULAR): true {}
8786

88-
/** @return true */
89-
function ksort(array &$array, int $flags = SORT_REGULAR): bool {}
87+
function ksort(array &$array, int $flags = SORT_REGULAR): true {}
9088

9189
/** @compile-time-eval */
9290
function count(Countable|array $value, int $mode = COUNT_NORMAL): int {}
@@ -98,25 +96,19 @@ function natsort(array &$array): bool {}
9896

9997
function natcasesort(array &$array): bool {}
10098

101-
/** @return true */
102-
function asort(array &$array, int $flags = SORT_REGULAR): bool {}
99+
function asort(array &$array, int $flags = SORT_REGULAR): true {}
103100

104-
/** @return true */
105-
function arsort(array &$array, int $flags = SORT_REGULAR): bool {}
101+
function arsort(array &$array, int $flags = SORT_REGULAR): true {}
106102

107-
/** @return true */
108-
function sort(array &$array, int $flags = SORT_REGULAR): bool {}
103+
function sort(array &$array, int $flags = SORT_REGULAR): true {}
109104

110105
function rsort(array &$array, int $flags = SORT_REGULAR): bool {}
111106

112-
/** @return true */
113-
function usort(array &$array, callable $callback): bool {}
107+
function usort(array &$array, callable $callback): true {}
114108

115-
/** @return true */
116-
function uasort(array &$array, callable $callback): bool {}
109+
function uasort(array &$array, callable $callback): true {}
117110

118-
/** @return true */
119-
function uksort(array &$array, callable $callback): bool {}
111+
function uksort(array &$array, callable $callback): true {}
120112

121113
function end(array|object &$array): mixed {}
122114

@@ -139,11 +131,9 @@ function min(mixed $value, mixed ...$values): mixed {}
139131
/** @compile-time-eval */
140132
function max(mixed $value, mixed ...$values): mixed {}
141133

142-
/** @return true */
143-
function array_walk(array|object &$array, callable $callback, mixed $arg = UNKNOWN): bool {}
134+
function array_walk(array|object &$array, callable $callback, mixed $arg = UNKNOWN): true {}
144135

145-
/** @return true */
146-
function array_walk_recursive(array|object &$array, callable $callback, mixed $arg = UNKNOWN): bool {}
136+
function array_walk_recursive(array|object &$array, callable $callback, mixed $arg = UNKNOWN): true {}
147137

148138
/**
149139
* @compile-time-eval
@@ -178,8 +168,7 @@ function array_fill_keys(array $keys, mixed $value): array {}
178168
*/
179169
function range($start, $end, int|float $step = 1): array {}
180170

181-
/** @return true */
182-
function shuffle(array &$array): bool {}
171+
function shuffle(array &$array): true {}
183172

184173
function array_pop(array &$array): mixed {}
185174

@@ -697,11 +686,9 @@ function sha1_file(string $filename, bool $binary = false): string|false {}
697686
#ifdef HAVE_SYSLOG_H
698687
function openlog(string $prefix, int $flags, int $facility): bool {}
699688

700-
/** @return true */
701-
function closelog(): bool {}
689+
function closelog(): true {}
702690

703-
/** @return true */
704-
function syslog(int $priority, string $message): bool {} // TODO make return type void
691+
function syslog(int $priority, string $message): true {} // TODO make return type void
705692
#endif
706693

707694
#ifdef HAVE_INET_NTOP
@@ -1424,17 +1411,15 @@ function getimagesizefromstring(string $string, &$image_info = null): array|fals
14241411

14251412
/* info.c */
14261413

1427-
/** @return true */
1428-
function phpinfo(int $flags = INFO_ALL): bool {} // make return type void
1414+
function phpinfo(int $flags = INFO_ALL): true {} // make return type void
14291415

14301416
/**
14311417
* @compile-time-eval
14321418
* @refcount 1
14331419
*/
14341420
function phpversion(?string $extension = null): string|false {}
14351421

1436-
/** @return true */
1437-
function phpcredits(int $flags = CREDITS_ALL): bool {}
1422+
function phpcredits(int $flags = CREDITS_ALL): true {}
14381423

14391424
/**
14401425
* @compile-time-eval

ext/standard/basic_functions_arginfo.h

Lines changed: 15 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)