Skip to content

Commit e0614f8

Browse files
committed
WP/DeprecatedParameterValues: update the functions list based on WP 6.8.1
Based on a scan of WP Core at commit WordPress/wordpress-develop@c5d3e24 using a preliminary sniff created for issue 1803. Includes tests.
1 parent ab80001 commit e0614f8

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

WordPress/Sniffs/WP/DeprecatedParameterValuesSniff.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ final class DeprecatedParameterValuesSniff extends AbstractFunctionParameterSnif
4242
* The list of deprecated parameter values can be found by
4343
* looking for `_deprecated_argument()`.
4444
* The list is sorted alphabetically by function name.
45-
* Last updated for WordPress 4.9.6.
45+
*
46+
* {@internal To be updated after every major release. Last updated for WordPress 6.8.1.}
4647
*
4748
* @since 1.0.0
4849
* @since 3.0.0 The format of the value has changed to support function calls
@@ -207,6 +208,21 @@ final class DeprecatedParameterValuesSniff extends AbstractFunctionParameterSnif
207208
),
208209
),
209210
),
211+
'wp_get_typography_font_size_value' => array(
212+
2 => array(
213+
'name' => 'settings',
214+
'values' => array(
215+
'true' => array(
216+
'alt' => 'an array',
217+
'version' => '6.6.0',
218+
),
219+
'false' => array(
220+
'alt' => 'an array',
221+
'version' => '6.6.0',
222+
),
223+
),
224+
),
225+
),
210226
);
211227

212228
/**

WordPress/Tests/WP/DeprecatedParameterValuesUnitTest.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,10 @@ update_option('blacklist_keys', $value);
5050
update_option('comment_whitelist', $value);
5151
update_option(autoload: true, value: $value, option: 'blacklist_keys');
5252

53+
// Passing boolean $settings is deprecated since WP 6.6.0.
54+
wp_get_typography_font_size_value( $preset, array() ); // OK.
55+
wp_get_typography_font_size_value( $preset, true ); // Error.
56+
wp_get_typography_font_size_value( $preset, false ); // Error.
57+
5358
// Live coding/parse error.
5459
get_bloginfo( show: /*to do*/, );

WordPress/Tests/WP/DeprecatedParameterValuesUnitTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ public function getErrorList() {
6161
* @return array<int, int> Key is the line number, value is the number of expected warnings.
6262
*/
6363
public function getWarningList() {
64-
return array();
64+
return array(
65+
55 => 1,
66+
56 => 1,
67+
);
6568
}
6669
}

0 commit comments

Comments
 (0)