From 7ceb1e6d9f68ce8754a4f2d883e11f32f403175e Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 1 Sep 2026 12:35:10 +0200 Subject: [PATCH 1/2] Fix PHPCS errors in Behat test files --- features/audit.feature | 2 +- features/makepot.feature | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/features/audit.feature b/features/audit.feature index d2459a11..27985ecb 100644 --- a/features/audit.feature +++ b/features/audit.feature @@ -107,7 +107,7 @@ Feature: Audit strings in a WordPress project * Text Domain: foo-plugin */ - __( 'Hello %s %s', 'foo-plugin' ); + __( 'Hello %1$s %2$s', 'foo-plugin' ); """ When I try `wp i18n audit foo-plugin` diff --git a/features/makepot.feature b/features/makepot.feature index 59d9aeb4..d298ec20 100644 --- a/features/makepot.feature +++ b/features/makepot.feature @@ -893,8 +893,8 @@ Feature: Generate a POT file of a WordPress project */ sprintf( - _n( 'One Comment', '%s Comments', $number, 'foo-plugin' ), - $number + _n( 'One Comment', '%s Comments', $number, 'foo-plugin' ), + $number ); """ @@ -920,9 +920,9 @@ Feature: Generate a POT file of a WordPress project */ sprintf( - _n( '%1$s Comment (%2$d)', '%2$s Comments (%1$s)', $number, 'foo-plugin' ), - $number, - $another_variable + _n( '%1$s Comment (%2$d)', '%2$s Comments (%1$s)', $number, 'foo-plugin' ), + $number, + $another_variable ); """ @@ -948,9 +948,9 @@ Feature: Generate a POT file of a WordPress project */ sprintf( - __( 'Hello %s %s', 'foo-plugin' ), - $a_variable, - $another_variable + __( 'Hello %1$s %2$s', 'foo-plugin' ), + $a_variable, + $another_variable ); """ From 5c29d21ccb3f2f31b166faa05ded5e8cfdc24b72 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 1 Sep 2026 11:07:09 +0000 Subject: [PATCH 2/2] Keep the unordered placeholders the tests are about Two scenarios exist to check that an unordered set of placeholders is reported: "Detects multiple unordered placeholders" in the audit feature, and "Prints a warning for multiple unordered placeholders" in the makepot one. Both feed `__( 'Hello %s %s', 'foo-plugin' )` to the command and expect "Multiple placeholders should be ordered." back. WordPress.WP.I18n.UnorderedPlaceholdersText is fixable, so the fixer ordered the placeholders for them, and with nothing left to report the two scenarios failed. The strings go back to what they were, with the sniff silenced on the line so that the next run of the fixer leaves them alone. The annotation sits at the end of the line rather than above it, as both scenarios assert the line the warning is reported against. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01SeC6Day9YHEaDh4NZZtDSS --- features/audit.feature | 2 +- features/makepot.feature | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/features/audit.feature b/features/audit.feature index 27985ecb..3e6596bb 100644 --- a/features/audit.feature +++ b/features/audit.feature @@ -107,7 +107,7 @@ Feature: Audit strings in a WordPress project * Text Domain: foo-plugin */ - __( 'Hello %1$s %2$s', 'foo-plugin' ); + __( 'Hello %s %s', 'foo-plugin' ); // phpcs:ignore WordPress.WP.I18n.UnorderedPlaceholdersText -- Unordered on purpose, this is what the audit is expected to flag. """ When I try `wp i18n audit foo-plugin` diff --git a/features/makepot.feature b/features/makepot.feature index d298ec20..2d210d39 100644 --- a/features/makepot.feature +++ b/features/makepot.feature @@ -948,7 +948,7 @@ Feature: Generate a POT file of a WordPress project */ sprintf( - __( 'Hello %1$s %2$s', 'foo-plugin' ), + __( 'Hello %s %s', 'foo-plugin' ), // phpcs:ignore WordPress.WP.I18n.UnorderedPlaceholdersText -- Unordered on purpose, this is what make-pot is expected to warn about. $a_variable, $another_variable );