Skip to content

Commit 8533856

Browse files
committed
Narrow bool return types to true when possible
1 parent f6e296d commit 8533856

14 files changed

+69
-69
lines changed

ext/intl/calendar/calendar.stub.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public function after(IntlCalendar $other): bool {}
244244
public function before(IntlCalendar $other): bool {}
245245

246246
/**
247-
* @return bool
247+
* @return true
248248
* @alias intlcal_clear
249249
*/
250250
public function clear(?int $field = null) {} // TODO make return type void
@@ -341,7 +341,7 @@ public function getMaximum(int $field): int|false {}
341341
public function getMinimalDaysInFirstWeek(): int|false {}
342342

343343
/**
344-
* @return bool
344+
* @return true
345345
* @alias intlcal_set_minimal_days_in_first_week
346346
*/
347347
public function setMinimalDaysInFirstWeek(int $days) {} // TODO make return void
@@ -432,31 +432,31 @@ public function roll(int $field, $value): bool {}
432432
public function isSet(int $field): bool {}
433433

434434
/**
435-
* @return bool
435+
* @return true
436436
* @alias intlcal_set
437437
*/
438438
public function set(int $year, int $month, int $dayOfMonth = UNKNOWN, int $hour = UNKNOWN, int $minute = UNKNOWN, int $second = UNKNOWN) {} // TODO make return type void
439439

440440
/**
441-
* @return bool
441+
* @return true
442442
* @alias intlcal_set_first_day_of_week
443443
*/
444444
public function setFirstDayOfWeek(int $dayOfWeek) {} // TODO make return type void
445445

446446
/**
447-
* @return bool
447+
* @return true
448448
* @alias intlcal_set_lenient
449449
*/
450450
public function setLenient(bool $lenient) {} // TODO make return type void
451451

452452
/**
453-
* @return bool
453+
* @return true
454454
* @alias intlcal_set_repeated_wall_time_option
455455
*/
456456
public function setRepeatedWallTimeOption(int $option) {} // TODO make return type void
457457

458458
/**
459-
* @return bool
459+
* @return true
460460
* @alias intlcal_set_skipped_wall_time_option
461461
*/
462462
public function setSkippedWallTimeOption(int $option) {} // TODO make return type void

ext/intl/calendar/calendar_arginfo.h

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/intl/php_intl.stub.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,12 @@ function intlcal_after(IntlCalendar $calendar, IntlCalendar $other): bool {}
201201

202202
function intlcal_before(IntlCalendar $calendar, IntlCalendar $other): bool {}
203203

204-
function intlcal_set(IntlCalendar $calendar, int $year, int $month, int $dayOfMonth = UNKNOWN, int $hour = UNKNOWN, int $minute = UNKNOWN, int $second = UNKNOWN): bool {}
204+
function intlcal_set(IntlCalendar $calendar, int $year, int $month, int $dayOfMonth = UNKNOWN, int $hour = UNKNOWN, int $minute = UNKNOWN, int $second = UNKNOWN): true {}
205205

206206
/** @param int|bool $value */
207207
function intlcal_roll(IntlCalendar $calendar, int $field, $value): bool {}
208208

209-
function intlcal_clear(IntlCalendar $calendar, ?int $field = null): bool {}
209+
function intlcal_clear(IntlCalendar $calendar, ?int $field = null): true {}
210210

211211
function intlcal_field_difference(IntlCalendar $calendar, float $timestamp, int $field): int|false {}
212212

@@ -228,7 +228,7 @@ function intlcal_get_maximum(IntlCalendar $calendar, int $field): int|false {}
228228

229229
function intlcal_get_minimal_days_in_first_week(IntlCalendar $calendar): int|false {}
230230

231-
function intlcal_set_minimal_days_in_first_week(IntlCalendar $calendar, int $days): bool {}
231+
function intlcal_set_minimal_days_in_first_week(IntlCalendar $calendar, int $days): true {}
232232

233233
function intlcal_get_minimum(IntlCalendar $calendar, int $field): int|false {}
234234

@@ -248,19 +248,19 @@ function intlcal_is_equivalent_to(IntlCalendar $calendar, IntlCalendar $other):
248248

249249
function intlcal_is_weekend(IntlCalendar $calendar, ?float $timestamp = null): bool {}
250250

251-
function intlcal_set_first_day_of_week(IntlCalendar $calendar, int $dayOfWeek): bool {}
251+
function intlcal_set_first_day_of_week(IntlCalendar $calendar, int $dayOfWeek): true {}
252252

253-
function intlcal_set_lenient(IntlCalendar $calendar, bool $lenient): bool {}
253+
function intlcal_set_lenient(IntlCalendar $calendar, bool $lenient): true {}
254254

255255
function intlcal_get_repeated_wall_time_option(IntlCalendar $calendar): int {}
256256

257257
function intlcal_equals(IntlCalendar $calendar, IntlCalendar $other): bool {}
258258

259259
function intlcal_get_skipped_wall_time_option(IntlCalendar $calendar): int {}
260260

261-
function intlcal_set_repeated_wall_time_option(IntlCalendar $calendar, int $option): bool {}
261+
function intlcal_set_repeated_wall_time_option(IntlCalendar $calendar, int $option): true {}
262262

263-
function intlcal_set_skipped_wall_time_option(IntlCalendar $calendar, int $option): bool {}
263+
function intlcal_set_skipped_wall_time_option(IntlCalendar $calendar, int $option): true {}
264264

265265
function intlcal_from_date_time(DateTime|string $datetime, ?string $locale = null): ?IntlCalendar {}
266266

ext/intl/php_intl_arginfo.h

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/pgsql/pgsql.stub.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ function pg_pconnect(string $connection_string, int $flags = 0): PgSql\Connectio
469469

470470
function pg_connect_poll(PgSql\Connection $connection): int {}
471471

472-
function pg_close(?PgSql\Connection $connection = null): bool {}
472+
function pg_close(?PgSql\Connection $connection = null): true {}
473473

474474
/** @refcount 1 */
475475
function pg_dbname(?PgSql\Connection $connection = null): string {}
@@ -691,7 +691,7 @@ function pg_getlastoid(PgSql\Result $result): string|int|false {}
691691

692692
function pg_trace(string $filename, string $mode = "w", ?PgSql\Connection $connection = null, int $trace_mode = 0): bool {}
693693

694-
function pg_untrace(?PgSql\Connection $connection = null): bool {}
694+
function pg_untrace(?PgSql\Connection $connection = null): true {}
695695

696696
/**
697697
* @param PgSql\Connection $connection

ext/pgsql/pgsql_arginfo.h

+6-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/snmp/snmp.stub.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ function snmpset(string $hostname, string $community, array|string $object_id, a
125125

126126
function snmp_get_quick_print(): bool {}
127127

128-
function snmp_set_quick_print(bool $enable): bool {}
128+
function snmp_set_quick_print(bool $enable): true {}
129129

130-
function snmp_set_enum_print(bool $enable): bool {}
130+
function snmp_set_enum_print(bool $enable): true {}
131131

132-
function snmp_set_oid_output_format(int $format): bool {}
132+
function snmp_set_oid_output_format(int $format): true {}
133133

134134
/** @alias snmp_set_oid_output_format */
135135
function snmp_set_oid_numeric_print(int $format): bool {}
@@ -175,7 +175,7 @@ function snmp3_set(
175175
array|string $object_id, array|string $type, array|string $value,
176176
int $timeout = -1, int $retries = -1): bool {}
177177

178-
function snmp_set_valueretrieval(int $method): bool {}
178+
function snmp_set_valueretrieval(int $method): true {}
179179

180180
function snmp_get_valueretrieval(): int {}
181181

ext/snmp/snmp_arginfo.h

+7-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/spl/spl_array.stub.php

+12-12
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,22 @@ public function getFlags(): int {}
4545
public function setFlags(int $flags): void {}
4646

4747
/** @tentative-return-type */
48-
public function asort(int $flags = SORT_REGULAR): bool {}
48+
public function asort(int $flags = SORT_REGULAR): true {}
4949

5050
/** @tentative-return-type */
51-
public function ksort(int $flags = SORT_REGULAR): bool {}
51+
public function ksort(int $flags = SORT_REGULAR): true {}
5252

5353
/** @tentative-return-type */
54-
public function uasort(callable $callback): bool {}
54+
public function uasort(callable $callback): true {}
5555

5656
/** @tentative-return-type */
57-
public function uksort(callable $callback): bool {}
57+
public function uksort(callable $callback): true {}
5858

5959
/** @tentative-return-type */
60-
public function natsort(): bool {}
60+
public function natsort(): true {}
6161

6262
/** @tentative-return-type */
63-
public function natcasesort(): bool {}
63+
public function natcasesort(): true {}
6464

6565
/** @tentative-return-type */
6666
public function unserialize(string $data): void {}
@@ -163,37 +163,37 @@ public function setFlags(int $flags): void {}
163163
* @tentative-return-type
164164
* @implementation-alias ArrayObject::asort
165165
*/
166-
public function asort(int $flags = SORT_REGULAR): bool {}
166+
public function asort(int $flags = SORT_REGULAR): true {}
167167

168168
/**
169169
* @tentative-return-type
170170
* @implementation-alias ArrayObject::ksort
171171
*/
172-
public function ksort(int $flags = SORT_REGULAR): bool {}
172+
public function ksort(int $flags = SORT_REGULAR): true {}
173173

174174
/**
175175
* @tentative-return-type
176176
* @implementation-alias ArrayObject::uasort
177177
*/
178-
public function uasort(callable $callback): bool {}
178+
public function uasort(callable $callback): true {}
179179

180180
/**
181181
* @tentative-return-type
182182
* @implementation-alias ArrayObject::uksort
183183
*/
184-
public function uksort(callable $callback): bool {}
184+
public function uksort(callable $callback): true {}
185185

186186
/**
187187
* @tentative-return-type
188188
* @implementation-alias ArrayObject::natsort
189189
*/
190-
public function natsort(): bool {}
190+
public function natsort(): true {}
191191

192192
/**
193193
* @tentative-return-type
194194
* @implementation-alias ArrayObject::natcasesort
195195
*/
196-
public function natcasesort(): bool {}
196+
public function natcasesort(): true {}
197197

198198
/**
199199
* @tentative-return-type

0 commit comments

Comments
 (0)