Properly deprecate both constructors in `WP_User_Search`.

- `__construct()` gets the new `_deprecated_class()` function
- `WP_User_Search` PHP4 style constructor is changed from `_deprecated_function()` to `_deprecated_constructor()`

Adds a test to confirm `WP_User_Search` class is testable as deprecated.

Props jrf, DrewAPicture.
Fixes #41125.

Built from https://develop.svn.wordpress.org/trunk@56469


git-svn-id: http://core.svn.wordpress.org/trunk@55981 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Drew Jaynes 2023-08-25 03:37:12 +00:00
parent 55d1c71d56
commit d2b2957bcb
2 changed files with 3 additions and 2 deletions

View File

@ -493,7 +493,7 @@ class WP_User_Search {
* @return WP_User_Search * @return WP_User_Search
*/ */
function __construct( $search_term = '', $page = '', $role = '' ) { function __construct( $search_term = '', $page = '', $role = '' ) {
_deprecated_function( __FUNCTION__, '3.1.0', 'WP_User_Query' ); _deprecated_class( 'WP_User_Search', '3.1.0', 'WP_User_Query' );
$this->search_term = wp_unslash( $search_term ); $this->search_term = wp_unslash( $search_term );
$this->raw_page = ( '' == $page ) ? false : (int) $page; $this->raw_page = ( '' == $page ) ? false : (int) $page;
@ -516,6 +516,7 @@ class WP_User_Search {
* @return WP_User_Search * @return WP_User_Search
*/ */
public function WP_User_Search( $search_term = '', $page = '', $role = '' ) { public function WP_User_Search( $search_term = '', $page = '', $role = '' ) {
_deprecated_constructor( 'WP_User_Search', '3.1.0', get_class( $this ) );
self::__construct( $search_term, $page, $role ); self::__construct( $search_term, $page, $role );
} }

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.4-alpha-56468'; $wp_version = '6.4-alpha-56469';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.