Skip to content

Commit a9665a7

Browse files
authored
Remove return type extension for wp_dropdown_languages (#250)
Whether `wp_dropdown_languages()` return string or void does not depend on `$args['echo']` but on `$args['id']` and `$args['name']`. See lines [1678-1680](https://github.com/WordPress/WordPress/blob/e25ffd14269ad6461aba63e3119ac5603502bf06/wp-includes/l10n.php#L1678-L1680) and [1780-1784](https://github.com/WordPress/WordPress/blob/e25ffd14269ad6461aba63e3119ac5603502bf06/wp-includes/l10n.php#L1780-L1784) in wp-includes/l10n.php.
1 parent dc37e3b commit a9665a7

File tree

2 files changed

+0
-16
lines changed

2 files changed

+0
-16
lines changed

src/EchoKeyDynamicFunctionReturnTypeExtension.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class EchoKeyDynamicFunctionReturnTypeExtension implements \PHPStan\Type\Dynamic
2929
private const FUNCTIONS = [
3030
'get_search_form' => 0,
3131
'the_title_attribute' => 0,
32-
'wp_dropdown_languages' => 0,
3332
'wp_get_archives' => 0,
3433
'wp_list_authors' => 0,
3534
'wp_list_bookmarks' => 0,
@@ -54,7 +53,6 @@ class EchoKeyDynamicFunctionReturnTypeExtension implements \PHPStan\Type\Dynamic
5453
*/
5554
private const ALWAYS_VOID = [
5655
'the_title_attribute',
57-
'wp_dropdown_languages',
5856
'wp_get_archives',
5957
'wp_list_comments',
6058
];
@@ -85,7 +83,6 @@ public function isFunctionSupported(FunctionReflection $functionReflection): boo
8583
/**
8684
* @see https://developer.wordpress.org/reference/functions/get_search_form/
8785
* @see https://developer.wordpress.org/reference/functions/the_title_attribute/
88-
* @see https://developer.wordpress.org/reference/functions/wp_dropdown_languages/
8986
* @see https://developer.wordpress.org/reference/functions/wp_get_archives/
9087
* @see https://developer.wordpress.org/reference/functions/wp_list_authors/
9188
* @see https://developer.wordpress.org/reference/functions/wp_list_bookmarks/

tests/data/echo_key.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// Default value of true
1010
assertType('void', get_search_form());
1111
assertType('void', the_title_attribute());
12-
assertType('void', wp_dropdown_languages());
1312
assertType('void', wp_get_archives());
1413
assertType('void', wp_list_authors());
1514
assertType('void', wp_list_bookmarks());
@@ -24,7 +23,6 @@
2423
$args = ['echo' => true];
2524
assertType('void', get_search_form($args));
2625
assertType('void', the_title_attribute($args));
27-
assertType('void', wp_dropdown_languages($args));
2826
assertType('void', wp_get_archives($args));
2927
assertType('void', wp_list_authors($args));
3028
assertType('void', wp_list_bookmarks($args));
@@ -37,7 +35,6 @@
3735

3836
// Explicit array key value of 1
3937
$args = ['echo' => 1];
40-
assertType('void', wp_dropdown_languages($args));
4138
assertType('void', wp_get_archives($args));
4239
assertType('void', wp_list_bookmarks($args));
4340
assertType('void|false', wp_list_categories($args));
@@ -46,7 +43,6 @@
4643
$args = ['echo' => false];
4744
assertType('string', get_search_form($args));
4845
assertType('string|void', the_title_attribute($args));
49-
assertType('string|void', wp_dropdown_languages($args));
5046
assertType('string|void', wp_get_archives($args));
5147
assertType('string', wp_list_authors($args));
5248
assertType('string', wp_list_bookmarks($args));
@@ -59,7 +55,6 @@
5955

6056
// Explicit array key value of 0
6157
$args = ['echo' => 0];
62-
assertType('string|void', wp_dropdown_languages($args));
6358
assertType('string|void', wp_get_archives($args));
6459
assertType('string', wp_list_bookmarks($args));
6560
assertType('string|false', wp_list_categories($args));
@@ -68,7 +63,6 @@
6863
$args = ['echo' => $_GET['foo']];
6964
assertType('string|void', get_search_form($args));
7065
assertType('string|void', the_title_attribute($args));
71-
assertType('string|void', wp_dropdown_languages($args));
7266
assertType('string|void', wp_get_archives($args));
7367
assertType('string|void', wp_list_authors($args));
7468
assertType('string|void', wp_list_bookmarks($args));
@@ -82,7 +76,6 @@
8276
// Explicit no query string value
8377
$args = 'akey=avalue';
8478
assertType('void', the_title_attribute($args));
85-
assertType('void', wp_dropdown_languages($args));
8679
assertType('void', wp_get_archives($args));
8780
assertType('void', wp_list_authors($args));
8881
assertType('void', wp_list_bookmarks($args));
@@ -95,7 +88,6 @@
9588
// Explicit non empty non numeric query string value (includes 'true' & 'false')
9689
$args = 'echo=nonemptynonnumeric&akey=avalue';
9790
assertType('void', the_title_attribute($args));
98-
assertType('void', wp_dropdown_languages($args));
9991
assertType('void', wp_get_archives($args));
10092
assertType('void', wp_list_authors($args));
10193
assertType('void', wp_list_bookmarks($args));
@@ -108,7 +100,6 @@
108100
// Explicit non zero numeric query string value
109101
$args = 'echo=1&akey=avalue';
110102
assertType('void', the_title_attribute($args));
111-
assertType('void', wp_dropdown_languages($args));
112103
assertType('void', wp_get_archives($args));
113104
assertType('void', wp_list_authors($args));
114105
assertType('void', wp_list_bookmarks($args));
@@ -121,7 +112,6 @@
121112
// Explicit query string value of 0
122113
$args = 'echo=0&akey=avalue';
123114
assertType('string|void', the_title_attribute($args));
124-
assertType('string|void', wp_dropdown_languages($args));
125115
assertType('string|void', wp_get_archives($args));
126116
assertType('string', wp_list_authors($args));
127117
assertType('string', wp_list_bookmarks($args));
@@ -134,7 +124,6 @@
134124
// Explicit empty query string value
135125
$args = 'echo=&akey=avalue';
136126
assertType('string|void', the_title_attribute($args));
137-
assertType('string|void', wp_dropdown_languages($args));
138127
assertType('string|void', wp_get_archives($args));
139128
assertType('string', wp_list_authors($args));
140129
assertType('string', wp_list_bookmarks($args));
@@ -148,7 +137,6 @@
148137
$args = $_GET['foo'];
149138
assertType('string|void', get_search_form($args));
150139
assertType('string|void', the_title_attribute($args));
151-
assertType('string|void', wp_dropdown_languages($args));
152140
assertType('string|void', wp_get_archives($args));
153141
assertType('string|void', wp_list_authors($args));
154142
assertType('string|void', wp_list_bookmarks($args));
@@ -164,7 +152,6 @@
164152
$args = '';
165153
assertType('string|void', get_search_form($args));
166154
assertType('string|void', the_title_attribute($args));
167-
assertType('string|void', wp_dropdown_languages($args));
168155
assertType('string|void', wp_get_archives($args));
169156
assertType('string|void', wp_list_authors($args));
170157
assertType('string|void', wp_list_bookmarks($args));

0 commit comments

Comments
 (0)