Repository navigation
Commit 96af501
Docs: Narrow the get_post_time() return type by date format.
For each format character whose output has a fixed range, such as `w` for
`'0'` through `'6'` or `m` for `'01'` through `'12'`, the conditional return
type now gives that range, mirroring what PHPStan infers for
`DateTimeInterface::format()`. Formats with an open-ended numeric output give
`numeric-string`. Formats that `wp_date()` translates (`D`, `l`, `M`, `F`, `a`,
and `A`) and the PHP 8.2+ `X` and `x` remain `string`.
With `w` narrowed, the weekday number passed to `WP_Locale::get_weekday()` in
the_weekday() and the_weekday_date() already satisfies `int<0, 6>` after an
int cast, so the `clamp()` calls are no longer needed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent 0181606 commit 96af501
1 file changed
Lines changed: 17 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3181 | 3181 | | |
3182 | 3182 | | |
3183 | 3183 | | |
3184 | | - | |
| 3184 | + | |
| 3185 | + | |
| 3186 | + | |
| 3187 | + | |
| 3188 | + | |
| 3189 | + | |
| 3190 | + | |
| 3191 | + | |
| 3192 | + | |
| 3193 | + | |
| 3194 | + | |
| 3195 | + | |
| 3196 | + | |
| 3197 | + | |
| 3198 | + | |
3185 | 3199 | | |
3186 | 3200 | | |
3187 | 3201 | | |
| |||
3442 | 3456 | | |
3443 | 3457 | | |
3444 | 3458 | | |
3445 | | - | |
| 3459 | + | |
3446 | 3460 | | |
3447 | 3461 | | |
3448 | 3462 | | |
| |||
3483 | 3497 | | |
3484 | 3498 | | |
3485 | 3499 | | |
3486 | | - | |
| 3500 | + | |
3487 | 3501 | | |
3488 | 3502 | | |
3489 | 3503 | | |
| |||
0 commit comments