Repository navigation
Commit 658bcc5
committed
Docs: Move the
In r62719 an inline `@var` was added after the `apply_filters()` call in `get_oembed_response_data()`, narrowing the filtered widths for `clamp()`. A type declared below the assignment it describes is confusing to read, but it could not go above, since the filter's docblock must immediately precede `apply_filters()` or the hook is reported as undocumented. The shape is now declared once, as a `@phpstan-param` in the filter docblock next to the `@param` hash it refines.
The `min` and `max` keys are also marked `Required.` in the hash. Since r65217 that marker makes a key required, where the keys of a `@param` hash are otherwise read as optional because a caller may pass a subset of them. That does not fit a filtered value: core always passes both keys, and a callback must return both, since they are read unconditionally. The documented defaults therefore describe the values core supplies, not a fallback for an omitted key. The `@phpstan-param` is kept regardless, because the hash only says `int`, while the shape narrows the widths to `positive-int`.
Developed in WordPress#15264.
Follow-up to r62719, r65217.
Props westonruter, dmsnell.
See #65817.
git-svn-id: https://develop.svn.wordpress.org/trunk@65247 602fd350-edb4-49c9-b593-d223f7449a82oembed_min_max_width shape to its docblock.1 parent 16a1d52 commit 658bcc5
1 file changed
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
582 | 582 | | |
583 | 583 | | |
584 | 584 | | |
585 | | - | |
586 | | - | |
| 585 | + | |
| 586 | + | |
587 | 587 | | |
| 588 | + | |
| 589 | + | |
588 | 590 | | |
589 | 591 | | |
590 | 592 | | |
| |||
594 | 596 | | |
595 | 597 | | |
596 | 598 | | |
597 | | - | |
598 | 599 | | |
599 | 600 | | |
600 | 601 | | |
| |||
0 commit comments