Repository navigation
Commit f390433
committed
Docs: Correct the type of the
The `$output_format` array maps a source mime type to a destination mime type, so its keys are mime type strings. Since r51221 it has been documented as `string[]` (which typically means an integer-keyed array of strings) expanded by a hash-notation block whose `@type string ...$0` is the notation core uses for numerically indexed members. Both halves therefore described a list, and nothing in the documentation conveyed that the key is the source mime type, which is the entire point of the array.
Replace both with `array<string, string>`, which states the key and value types directly and needs no nested block. The `@return` of `wp_get_image_editor_output_format()` gets the same correction, having inherited `string[]` when r58849 moved the canonical docblock into `wp-includes/media.php`.
This mismatch was surfaced by the PHPStan extensions under development for this ticket, which read hook docblocks in order to type the return of `apply_filters()`, and which are committed separately.
Developed as subset of WordPress#12022.
Follow-up to r50943, r51221, r58849.
See #65376, #64896.
git-svn-id: https://develop.svn.wordpress.org/trunk@62935 602fd350-edb4-49c9-b593-d223f7449a82image_editor_output_format map.1 parent 42fcdc8 commit f390433
1 file changed
Lines changed: 5 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6534 | 6534 | | |
6535 | 6535 | | |
6536 | 6536 | | |
6537 | | - | |
| 6537 | + | |
6538 | 6538 | | |
6539 | 6539 | | |
6540 | 6540 | | |
| |||
6556 | 6556 | | |
6557 | 6557 | | |
6558 | 6558 | | |
6559 | | - | |
6560 | | - | |
6561 | | - | |
6562 | | - | |
6563 | | - | |
6564 | | - | |
6565 | | - | |
6566 | | - | |
| 6559 | + | |
| 6560 | + | |
| 6561 | + | |
| 6562 | + | |
6567 | 6563 | | |
6568 | 6564 | | |
6569 | 6565 | | |
| |||
0 commit comments