Code Modernization: Use wp_trigger_error() in WP_User_Query magic methods.

Replaces `trigger_error()` with `wp_trigger_error()` in each of the `WP_User_Query` magic methods.

[56353] added the dynamic properties deprecation messages to the `__get()`, `__set()`, `__isset()`, `__unset()` magic methods. Since that commit, `wp_trigger_error()` was introduced (see [56530]) as a wrapper for `trigger_error()`.

Follow-up to [56353], [56530].

See #58897, #57686.

git-svn-id: https://develop.svn.wordpress.org/trunk@56543 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Tonya Mork 2023-09-07 20:43:48 +00:00
parent dc76011874
commit a5eddeab2d
2 changed files with 12 additions and 4 deletions

View File

@ -1122,7 +1122,8 @@ class WP_User_Query {
return $this->$name;
}
trigger_error(
wp_trigger_error(
__METHOD__,
"The property `{$name}` is not declared. Getting a dynamic property is " .
'deprecated since version 6.4.0! Instead, declare the property on the class.',
E_USER_DEPRECATED
@ -1145,7 +1146,8 @@ class WP_User_Query {
return;
}
trigger_error(
wp_trigger_error(
__METHOD__,
"The property `{$name}` is not declared. Setting a dynamic property is " .
'deprecated since version 6.4.0! Instead, declare the property on the class.',
E_USER_DEPRECATED
@ -1166,7 +1168,8 @@ class WP_User_Query {
return isset( $this->$name );
}
trigger_error(
wp_trigger_error(
__METHOD__,
"The property `{$name}` is not declared. Checking `isset()` on a dynamic property " .
'is deprecated since version 6.4.0! Instead, declare the property on the class.',
E_USER_DEPRECATED
@ -1188,7 +1191,8 @@ class WP_User_Query {
return;
}
trigger_error(
wp_trigger_error(
__METHOD__,
"A property `{$name}` is not declared. Unsetting a dynamic property is " .
'deprecated since version 6.4.0! Instead, declare the property on the class.',
E_USER_DEPRECATED

View File

@ -2253,6 +2253,7 @@ class Tests_User_Query extends WP_UnitTestCase {
$this->expectDeprecation();
$this->expectDeprecationMessage(
'WP_User_Query::__get(): ' .
'The property `undefined_property` is not declared. Getting a dynamic property is ' .
'deprecated since version 6.4.0! Instead, declare the property on the class.'
);
@ -2285,6 +2286,7 @@ class Tests_User_Query extends WP_UnitTestCase {
$this->expectDeprecation();
$this->expectDeprecationMessage(
'WP_User_Query::__set(): ' .
'The property `undefined_property` is not declared. Setting a dynamic property is ' .
'deprecated since version 6.4.0! Instead, declare the property on the class.'
);
@ -2321,6 +2323,7 @@ class Tests_User_Query extends WP_UnitTestCase {
$this->expectDeprecation();
$this->expectDeprecationMessage(
'WP_User_Query::__isset(): ' .
'The property `undefined_property` is not declared. Checking `isset()` on a dynamic property ' .
'is deprecated since version 6.4.0! Instead, declare the property on the class.'
);
@ -2352,6 +2355,7 @@ class Tests_User_Query extends WP_UnitTestCase {
$this->expectDeprecation();
$this->expectDeprecationMessage(
'WP_User_Query::__unset(): ' .
'A property `undefined_property` is not declared. Unsetting a dynamic property is ' .
'deprecated since version 6.4.0! Instead, declare the property on the class.'
);