-
Notifications
You must be signed in to change notification settings - Fork 162
Closed
Labels
enhancementImprovements to existing rulesImprovements to existing rulesneed to discussRule requires discussionRule requires discussion
Description
Description
ConstantUsageSniff (Magento2.Translation.ConstantUsage) should be deleted because it encourage code duplication (what is bad practice) by message: Constants are not allowed as the first argument of translation function, use string literal instead
.
Expected behavior
Don't inspect if constants used as first argument of translation function.
Benefits
Less code duplicates - less bugs.
Additional information
Seems that this Sniff and code recomendation exists because magento command bin/magento i18n:collect-phrases
in current implementation couldn't extract strings from constants.
Some ideas how to fix it:
- implement constant resolving in
i18n:collect-phrases
(maybe by nikic/PHP-Parser) - the most obvious but difficult for implementation way; - extract constants used in translation function that would be inspected manually by developers (with pointing to file and line) by command line option - the most easy for implementation way;
- extract all strings from files or just strings that not used in translation function by command line option;
- extract all constant strings by command line option;
Nolwennig and krzysztof-wolowski
Metadata
Metadata
Assignees
Labels
enhancementImprovements to existing rulesImprovements to existing rulesneed to discussRule requires discussionRule requires discussion