Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
coder-3433266
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
coder-3433266
Commits
a0b76c6c
Unverified
Commit
a0b76c6c
authored
1 year ago
by
Klaus Purer
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php
+1
-4
1 addition, 4 deletions
coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php
tests/Drupal/Semantics/FunctionTUnitTest.inc
+0
-10
0 additions, 10 deletions
tests/Drupal/Semantics/FunctionTUnitTest.inc
with
1 addition
and
14 deletions
coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php
+
1
−
4
View file @
a0b76c6c
...
...
@@ -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'
);
...
...
This diff is collapsed.
Click to expand it.
tests/Drupal/Semantics/FunctionTUnitTest.inc
+
0
−
10
View file @
a0b76c6c
...
...
@@ -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
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment