Skip to content
Snippets Groups Projects
Unverified Commit a0b76c6c authored by Klaus Purer's avatar Klaus Purer Committed by GitHub
Browse files

Revert "feat(FunctionT): Allow passing constants to t() (#3326197 by Murz)"

parent e79554be
No related branches found
No related tags found
No related merge requests found
......@@ -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');
......
......@@ -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);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment