Skip to content

Commit 0da6a56

Browse files
committed
Change the placement of the namespaced name tests as suggested during PR review
1 parent d476988 commit 0da6a56

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

WordPress/Tests/WP/DeprecatedParametersUnitTest.inc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ wp_install( user_name: '', deprecated: '', user_email: '', blog_title: '', is_pu
3737
// Error: Parameter is passed with incorrect default, unconventional order.
3838
wp_install( is_public: '', user_name: '', user_email: '', deprecated: 'should be empty', blog_title: '' );
3939

40+
/*
41+
* Safeguard correct handling of all types of namespaced function calls.
42+
*/
43+
\add_option( '', '', [] ); // Bad.
44+
MyNamespace\get_blog_list( $foo, $bar, 'deprecated' ); // Ok.
45+
\MyNamespace\get_wp_title_rss( 'deprecated' ); // Ok.
46+
namespace\the_author( 'deprecated', 'deprecated' ); // The sniff should start flagging this once it can resolve relative namespaces.
47+
namespace\Sub\wp_title_rss( 'deprecated' ); // Ok.
48+
4049
// All will give an ERROR. The functions are ordered alphabetically.
4150

4251
_future_post_hook( 10, $post );
@@ -100,12 +109,3 @@ inject_ignored_hooked_blocks_metadata_attributes('', 'deprecated');
100109
// All will give an WARNING as they have been deprecated after WP 6.6.
101110
wp_render_elements_support_styles('deprecated');
102111
_wp_can_use_pcre_u('deprecated');
103-
104-
/*
105-
* Safeguard correct handling of all types of namespaced function calls.
106-
*/
107-
\add_option( '', '', [] ); // Bad.
108-
MyNamespace\get_blog_list( $foo, $bar, 'deprecated' ); // Ok.
109-
\MyNamespace\get_wp_title_rss( 'deprecated' ); // Ok.
110-
namespace\the_author( 'deprecated', 'deprecated' ); // The sniff should start flagging this once it can resolve relative namespaces.
111-
namespace\Sub\wp_title_rss( 'deprecated' ); // Ok.

WordPress/Tests/WP/DeprecatedParametersUnitTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ final class DeprecatedParametersUnitTest extends AbstractSniffUnitTest {
2727
* @return array<int, int> Key is the line number, value is the number of expected errors.
2828
*/
2929
public function getErrorList() {
30-
$start_line = 42;
31-
$end_line = 98;
30+
$start_line = 51;
31+
$end_line = 107;
3232
$errors = array_fill( $start_line, ( ( $end_line - $start_line ) + 1 ), 1 );
3333

3434
$errors[22] = 1;
@@ -38,12 +38,12 @@ public function getErrorList() {
3838
// Named param.
3939
$errors[38] = 1;
4040

41-
// Override number of errors.
42-
$errors[50] = 2;
43-
$errors[76] = 2;
44-
4541
// Fully qualified function call.
46-
$errors[107] = 1;
42+
$errors[43] = 1;
43+
44+
// Override number of errors.
45+
$errors[59] = 2;
46+
$errors[85] = 2;
4747

4848
return $errors;
4949
}
@@ -55,8 +55,8 @@ public function getErrorList() {
5555
*/
5656
public function getWarningList() {
5757
return array(
58-
101 => 1,
59-
102 => 1,
58+
110 => 1,
59+
111 => 1,
6060
);
6161
}
6262
}

0 commit comments

Comments
 (0)