Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WP/DeprecatedClasses: update the class list based on WP 6.3-RC1 #2318

Merged
merged 1 commit into from
Jul 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions WordPress/Sniffs/WP/DeprecatedClassesSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ final class DeprecatedClassesSniff extends AbstractClassRestrictionsSniff {
*
* Version numbers should be fully qualified.
*
* Last update: July 2023 for WP 6.3 at https://github.com/WordPress/wordpress-develop/commit/6281ce432c50345a57768bf53854d9b65b6cdd52
*
* @var array
*/
private $deprecated_classes = array(
Expand All @@ -53,22 +55,39 @@ final class DeprecatedClassesSniff extends AbstractClassRestrictionsSniff {
'version' => '3.1.0',
),

// WP 3.7.0.
'WP_HTTP_Fsockopen' => array(
'alt' => 'WP_HTTP::request()',
'version' => '3.7.0',
),

// WP 4.9.0.
'Customize_New_Menu_Section' => array(
'WP_Customize_New_Menu_Section' => array(
'version' => '4.9.0',
),
'WP_Customize_New_Menu_Control' => array(
'version' => '4.9.0',
),

// WP 5.3.0.
'WP_Privacy_Data_Export_Requests_Table' => array(
'alt' => 'WP_Privacy_Data_Export_Requests_List_Table',
'version' => '5.3.0',
),
'WP_Privacy_Data_Removal_Requests_Table' => array(
'alt' => 'WP_Privacy_Data_Removal_Requests_List_Table',
'version' => '5.3.0',
),
'Services_JSON' => array(
'alt' => 'The PHP native JSON extension',
'version' => '5.3.0',
),
'Services_JSON_Error' => array(
'alt' => 'The PHP native JSON extension',
'version' => '5.3.0',
),
);


/**
* Groups of classes to restrict.
*
Expand Down
7 changes: 6 additions & 1 deletion WordPress/Tests/WP/DeprecatedClassesUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ echo \WP_User_Search::prepare_query();
class My_User_Search extends WP_User_Search {}
class Our_User_Search implements WP_User_Search {}
$a = (new WP_User_Search())->query();
/* ============ WP 3.7 ============ */
$anon = new class extends WP_HTTP_Fsockopen {};
/* ============ WP 4.9 ============ */
class Prefix_Menu_section extends Customize_New_Menu_Section {}
class Prefix_Menu_section extends WP_Customize_New_Menu_Section {}
WP_Customize_New_Menu_Control::foo();
/* ============ WP 5.3 ============ */
$json = new Services_JSON;
$json = new Services_JSON_Error;
class Prefix_Menu_section extends WP_Privacy_Data_Export_Requests_Table {}
WP_Privacy_Data_Removal_Requests_Table::foo();
4 changes: 2 additions & 2 deletions WordPress/Tests/WP/DeprecatedClassesUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ final class DeprecatedClassesUnitTest extends AbstractSniffUnitTest {
*/
public function getErrorList() {
$start_line = 9;
$end_line = 20;
$end_line = 25;
$errors = array_fill( $start_line, ( ( $end_line - $start_line ) + 1 ), 1 );

// Unset the lines related to version comments.
unset( $errors[16], $errors[19] );
unset( $errors[16], $errors[18], $errors[21] );

return $errors;
}
Expand Down