diff --git a/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php b/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php index 30560030f368282f34fcb2da4f885d5401d54224..4da9955f0b0a55ffa8030e304e45c02f765b9e32 100644 --- a/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php @@ -75,10 +75,7 @@ class FunctionTSniff extends FunctionCall return; } - if ($tokens[$argument['start']]['code'] !== T_CONSTANT_ENCAPSED_STRING - && $tokens[$argument['start']]['code'] !== T_STRING - && $tokens[$argument['start']]['code'] !== T_SELF - ) { + if ($tokens[$argument['start']]['code'] !== T_CONSTANT_ENCAPSED_STRING) { // Not a translatable string literal. $warning = 'Only string literals should be passed to t() where possible'; $phpcsFile->addWarning($warning, $argument['start'], 'NotLiteralString'); diff --git a/tests/Drupal/Semantics/FunctionTUnitTest.inc b/tests/Drupal/Semantics/FunctionTUnitTest.inc index 02aff86c8d3e06279e2e4846f2b78273b0dbc96c..0945ef06f86b27fb5b76e8c273474c163e90e6bb 100644 --- a/tests/Drupal/Semantics/FunctionTUnitTest.inc +++ b/tests/Drupal/Semantics/FunctionTUnitTest.inc @@ -34,14 +34,4 @@ class Test { return new TranslationWrapper(' Do not start with a space'); } - public function testConstants() { - // Using constants in t() should be allowed. - $x = t(self::FOO); - } - } - -// Using constants in t() should be allowed. -const FOO2 = 'bar2'; -$x = t(FOO2); -$x = t(Test::FOO);