diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php index 03fe097538..3fa6f54dd4 100644 --- a/src/wp-admin/includes/class-wp-list-table.php +++ b/src/wp-admin/includes/class-wp-list-table.php @@ -186,7 +186,8 @@ class WP_List_Table { 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 @@ -209,7 +210,8 @@ class WP_List_Table { 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 @@ -230,7 +232,8 @@ class WP_List_Table { 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 @@ -252,7 +255,8 @@ class WP_List_Table { 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 diff --git a/tests/phpunit/tests/admin/wpListTable.php b/tests/phpunit/tests/admin/wpListTable.php index 4a220bb083..65a9a714c7 100644 --- a/tests/phpunit/tests/admin/wpListTable.php +++ b/tests/phpunit/tests/admin/wpListTable.php @@ -389,6 +389,7 @@ class Tests_Admin_WpListTable extends WP_UnitTestCase { public function test_should_throw_deprecation_when_getting_dynamic_property() { $this->expectDeprecation(); $this->expectDeprecationMessage( + 'WP_List_Table::__get(): ' . 'The property `undeclared_property` is not declared. Getting a dynamic property is ' . 'deprecated since version 6.4.0! Instead, declare the property on the class.' ); @@ -418,6 +419,7 @@ class Tests_Admin_WpListTable extends WP_UnitTestCase { public function test_should_throw_deprecation_when_setting_dynamic_property() { $this->expectDeprecation(); $this->expectDeprecationMessage( + 'WP_List_Table::__set(): ' . 'The property `undeclared_property` is not declared. Setting a dynamic property is ' . 'deprecated since version 6.4.0! Instead, declare the property on the class.' ); @@ -450,6 +452,7 @@ class Tests_Admin_WpListTable extends WP_UnitTestCase { public function test_should_throw_deprecation_when_isset_of_dynamic_property() { $this->expectDeprecation(); $this->expectDeprecationMessage( + 'WP_List_Table::__isset(): ' . 'The property `undeclared_property` is not declared. Checking `isset()` on a dynamic property ' . 'is deprecated since version 6.4.0! Instead, declare the property on the class.' ); @@ -477,6 +480,7 @@ class Tests_Admin_WpListTable extends WP_UnitTestCase { public function test_should_throw_deprecation_when_unset_of_dynamic_property() { $this->expectDeprecation(); $this->expectDeprecationMessage( + 'WP_List_Table::__unset(): ' . 'A property `undeclared_property` is not declared. Unsetting a dynamic property is ' . 'deprecated since version 6.4.0! Instead, declare the property on the class.' );