Commit 75c2837112 for wordpress.org
commit 75c283711228d00df10cb77a1b22dbdb35f3c583
Author: westonruter <westonruter@1a063a9b-81f0-0310-95a4-ce76da25c4cd>
Date: Tue Nov 3 18:04:02 2026 +0000
Docs: Move the `oembed_min_max_width` shape to its docblock.
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 https://github.com/WordPress/wordpress-develop/pull/15264.
Follow-up to r62719, r65217.
Props westonruter, dmsnell.
See #65817.
Built from https://develop.svn.wordpress.org/trunk@65247
git-svn-id: http://core.svn.wordpress.org/trunk@64396 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/embed.php b/wp-includes/embed.php
index 6a7501027a..c660d6c849 100644
--- a/wp-includes/embed.php
+++ b/wp-includes/embed.php
@@ -582,9 +582,11 @@ function get_oembed_response_data( $post, $width ) {
* @param array $min_max_width {
* Minimum and maximum widths for the oEmbed response.
*
- * @type int $min Minimum width. Default 200.
- * @type int $max Maximum width. Default 600.
+ * @type int $min Minimum width. Default 200. Required.
+ * @type int $max Maximum width. Default 600. Required.
* }
+ *
+ * @phpstan-param array{ min: positive-int, max: positive-int } $min_max_width
*/
$min_max_width = apply_filters(
'oembed_min_max_width',
@@ -594,7 +596,6 @@ function get_oembed_response_data( $post, $width ) {
)
);
- /** @var array{ min: positive-int, max: positive-int } $min_max_width */
$width = clamp( $width, $min_max_width['min'], $min_max_width['max'] );
$height = max( (int) ceil( $width / 16 * 9 ), 200 );
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 1d39a1414e..2f481f6575 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-beta4-65246';
+$wp_version = '7.2-beta4-65247';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.