@@ -47,7 +47,7 @@ _n( 'I have %d cat.', 'I have %d cats.', $number, 'my-slug' ); // OK.
4747_n ( 'I have %d cat. ' , 'I have %d cats. ' , $ number , "illegal $ string " ); // Bad.
4848_n ( 'I have %d cat. ' , 'I have %d cats. ' , $ number , SOMETHING ); // Bad.
4949
50- _n_noop ( 'I have %d cat. ' , 'I have %d cats. ' ); // Bad, no text domain.
50+ _N_NOOP ( 'I have %d cat. ' , 'I have %d cats. ' ); // Bad, no text domain.
5151_n_noop ( 'I have %d cat. ' , 'I have %d cats. ' , 'my-slug ' ); // OK.
5252_n_noop ( 'I have %d cat. ' , 'I have %d cats. ' , "illegal $ string " ); // Bad.
5353_n_noop ( 'I have %d cat. ' , 'I have %d cats. ' , SOMETHING ); // Bad.
@@ -75,7 +75,7 @@ __( 'foo', 'my-slug', 'too-many-args' ); // Bad.
7575_x ( 'string ' , 'context ' , 'my-slug ' , 'too-many-args ' ); // Bad.
7676_n ( 'I have %d cat. ' , 'I have %d cats. ' , $ number , 'my-slug ' , 'too-many-args ' ); // Bad.
7777_n_noop ( 'I have %d cat. ' , 'I have %d cats. ' , 'my-slug ' , 'too-many-args ' ); // Bad.
78- _nx_noop ( 'I have %d cat. ' , 'I have %d cats. ' , 'Not really. ' , 'my-slug ' , 'too-many-args ' ); // Bad.
78+ \_Nx_Noop ( 'I have %d cat. ' , 'I have %d cats. ' , 'Not really. ' , 'my-slug ' , 'too-many-args ' ); // Bad.
7979
8080// Make sure that multi-line string literals are accepted.
8181_nx ( 'I have
@@ -317,4 +317,15 @@ esc_html_e( 'foo', '' ); // Bad: text-domain can not be empty.
317317// PHP 8.0+: safeguard handling of newly introduced placeholders.
318318__ ( 'There are %1$h monkeys in the %H ' , 'my-slug ' ); // Bad: multiple arguments should be numbered.
319319
320+ /*
321+ * Safeguard correct handling of all types of namespaced function calls.
322+ */
323+ \_ ( 'foo ' , 'my-slug ' ); // Bad.
324+ \translate ( 'foo ' , 'my-slug ' ); // Bad.
325+ \translate_with_gettext_context ( 'foo ' , 'bar ' , 'my-slug ' ); // Bad.
326+ MyNamespace \__ ( 'foo ' , 'my-slug ' ); // Ok.
327+ \MyNamespace \_e ( 'foo ' , 'my-slug ' ); // Ok.
328+ namespace \esc_html_e ( 'foo ' , '' ); // The sniff should start flagging this once it can resolve relative namespaces.
329+ namespace \Sub \translate ( 'foo ' , 'my-slug ' ); // Ok.
330+
320331// phpcs:enable WordPress.WP.I18n.MissingTranslatorsComment
0 commit comments