Skip to content

Commit c3fbb13

Browse files
committed
Add test to ensure that AbstractFunctionParameterSniff::is_targetted_token() handles function calls with variable unpacking correctly
1 parent bc445b0 commit c3fbb13

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

WordPress/Tests/Utils/I18nTextDomainFixerUnitTest.4.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,10 @@ esc_html_x(
256256
use function __;
257257
use function __ as my_function;
258258
add_action('my_action', __(...));
259+
// The test below ensures that the AbstractFunctionParameterSniff does not incorrectly ignore
260+
// function calls with variable unpacking. But it is a false positive in the context of the
261+
// I18nTextDomainFixer sniff and will be addressed in a future update.
262+
__(...$args);
259263

260264
// phpcs:set WordPress.Utils.I18nTextDomainFixer old_text_domain[]
261265
// phpcs:set WordPress.Utils.I18nTextDomainFixer new_text_domain false

WordPress/Tests/Utils/I18nTextDomainFixerUnitTest.4.inc.fixed

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,10 @@ esc_html_x(
261261
use function __;
262262
use function __ as my_function;
263263
add_action('my_action', __(...));
264+
// The test below ensures that the AbstractFunctionParameterSniff does not incorrectly ignore
265+
// function calls with variable unpacking. But it is a false positive in the context of the
266+
// I18nTextDomainFixer sniff and will be addressed in a future update.
267+
__(...$args, 'something-else');
264268

265269
// phpcs:set WordPress.Utils.I18nTextDomainFixer old_text_domain[]
266270
// phpcs:set WordPress.Utils.I18nTextDomainFixer new_text_domain false

WordPress/Tests/Utils/I18nTextDomainFixerUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ public function getErrorList( $testFile = '' ) {
148148
241 => 1,
149149
242 => 1,
150150
245 => 1,
151+
262 => 1,
151152
);
152153

153154
default:

0 commit comments

Comments
 (0)