Skip to content

Commit 34920c7

Browse files
committed
Update default minimum_supported_version to WP 4.8
The minimum version should be three versions behind the latest WP release, so what with 5.1 being out, it should now be 4.8. Includes updating the list of deprecated functions. Input for this based on @JDGrimes's WP deprecated code scanner.
1 parent 79287e3 commit 34920c7

File tree

7 files changed

+48
-29
lines changed

7 files changed

+48
-29
lines changed

WordPress/Sniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ abstract class Sniff implements PHPCS_Sniff {
8282
*
8383
* @var string WordPress version.
8484
*/
85-
public $minimum_supported_version = '4.7';
85+
public $minimum_supported_version = '4.8';
8686

8787
/**
8888
* Custom list of classes which test classes can extend.

WordPress/Sniffs/WP/DeprecatedFunctionsSniff.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,11 @@ class DeprecatedFunctionsSniff extends AbstractFunctionRestrictionsSniff {
579579
'alt' => 'wp_die()',
580580
'version' => '3.0.0',
581581
),
582+
// Verified version & alternative.
583+
'install_blog_defaults' => array(
584+
'alt' => 'wp_install_defaults',
585+
'version' => '3.0.0',
586+
),
582587
'is_main_blog' => array(
583588
'alt' => 'is_main_site()',
584589
'version' => '3.0.0',
@@ -1330,6 +1335,16 @@ class DeprecatedFunctionsSniff extends AbstractFunctionRestrictionsSniff {
13301335
'alt' => '',
13311336
'version' => '4.9.0',
13321337
),
1338+
1339+
// WP 5.1.0.
1340+
'insert_blog' => array(
1341+
'alt' => 'wp_insert_site()',
1342+
'version' => '5.1.0',
1343+
),
1344+
'install_blog' => array(
1345+
'alt' => '',
1346+
'version' => '5.1.0',
1347+
),
13331348
);
13341349

13351350
/**

WordPress/Tests/WP/DeprecatedFunctionsUnitTest.inc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ get_user_details();
143143
get_usermeta();
144144
get_usernumposts();
145145
graceful_fail();
146+
install_blog_defaults();
146147
is_main_blog();
147148
is_site_admin();
148149
is_taxonomy();
@@ -319,21 +320,24 @@ use function popuplinks as something_else; // Related to issue #1306.
319320
post_form_autocomplete_off();
320321
wp_embed_handler_googlevideo();
321322
wp_get_sites();
322-
323-
/*
324-
* Warning.
325-
*/
326323
/* ============ WP 4.7 ============ */
327324
_sort_nav_menu_items();
328325
_usort_terms_by_ID();
329326
_usort_terms_by_name();
330327
get_paged_template();
331328
wp_get_network();
332329
wp_kses_js_entities();
330+
331+
/*
332+
* Warning.
333+
*/
333334
/* ============ WP 4.8 ============ */
334335
wp_dashboard_plugins_output();
335336
/* ============ WP 4.9 ============ */
336337
get_shortcut_link();
337338
is_user_option_local();
338339
wp_ajax_press_this_add_category();
339340
wp_ajax_press_this_save_post();
341+
/* ============ WP 5.1 ============ */
342+
insert_blog();
343+
install_blog();

WordPress/Tests/WP/DeprecatedFunctionsUnitTest.php

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class DeprecatedFunctionsUnitTest extends AbstractSniffUnitTest {
2828
*/
2929
public function getErrorList() {
3030

31-
$errors = array_fill( 8, 314, 1 );
31+
$errors = array_fill( 8, 322, 1 );
3232

3333
// Unset the lines related to version comments.
3434
unset(
@@ -45,22 +45,23 @@ public function getErrorList() {
4545
$errors[80],
4646
$errors[118],
4747
$errors[125],
48-
$errors[161],
49-
$errors[174],
50-
$errors[178],
51-
$errors[210],
52-
$errors[233],
53-
$errors[251],
54-
$errors[255],
55-
$errors[262],
56-
$errors[274],
57-
$errors[281],
58-
$errors[285],
59-
$errors[290],
60-
$errors[295],
61-
$errors[303],
62-
$errors[310],
63-
$errors[318]
48+
$errors[162],
49+
$errors[175],
50+
$errors[179],
51+
$errors[211],
52+
$errors[234],
53+
$errors[252],
54+
$errors[256],
55+
$errors[263],
56+
$errors[275],
57+
$errors[282],
58+
$errors[286],
59+
$errors[291],
60+
$errors[296],
61+
$errors[304],
62+
$errors[311],
63+
$errors[319],
64+
$errors[323]
6465
);
6566

6667
return $errors;
@@ -73,10 +74,10 @@ public function getErrorList() {
7374
*/
7475
public function getWarningList() {
7576

76-
$warnings = array_fill( 326, 14, 1 );
77+
$warnings = array_fill( 335, 9, 1 );
7778

7879
// Unset the lines related to version comments.
79-
unset( $warnings[326], $warnings[333], $warnings[335] );
80+
unset( $warnings[336], $warnings[341] );
8081

8182
return $warnings;
8283
}

WordPress/Tests/WP/DeprecatedParametersUnitTest.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ the_author( 'deprecated', 'deprecated' );
4848
the_author_posts_link( 'deprecated' );
4949
trackback_rdf( 'deprecated' );
5050
trackback_url( 'deprecated' );
51+
unregister_setting( '', '', '', 'deprecated' );
5152
update_blog_option( '', '', '', 'deprecated' );
5253
update_user_status( '', '', '', 'deprecated' );
5354
wp_get_http_headers( '', 'deprecated' );
@@ -60,7 +61,6 @@ wp_title_rss( 'deprecated' );
6061
wp_upload_bits( '', 'deprecated' );
6162
xfn_check( '', '', 'deprecated' );
6263

63-
// All will give an WARNING as they have been deprecated after WP 4.7.
64+
// All will give an WARNING as they have been deprecated after WP 4.8.
6465

6566
get_category_parents( '', '', '', '', array( 'deprecated') );
66-
unregister_setting( '', '', '', 'deprecated' );

WordPress/Tests/WP/DeprecatedParametersUnitTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class DeprecatedParametersUnitTest extends AbstractSniffUnitTest {
2727
* @return array <int line number> => <int number of errors>
2828
*/
2929
public function getErrorList() {
30-
$errors = array_fill( 28, 34, 1 );
30+
$errors = array_fill( 28, 35, 1 );
3131

3232
$errors[22] = 1;
3333
$errors[23] = 1;
@@ -47,7 +47,6 @@ public function getErrorList() {
4747
*/
4848
public function getWarningList() {
4949
return array(
50-
65 => 1,
5150
66 => 1,
5251
);
5352
}

phpcs.xml.dist.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
the wiki:
7171
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties
7272
-->
73-
<config name="minimum_supported_wp_version" value="4.7"/>
73+
<config name="minimum_supported_wp_version" value="4.8"/>
7474

7575
<rule ref="WordPress.WP.I18n">
7676
<properties>

0 commit comments

Comments
 (0)