Testing on drupal.org and locally shows a new coding standard message:

t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead

This is due to an enhancement introduced in /coder_sniffer/DrupalPractice/Sniffs/Objects/GlobalFunctionSniff.php in version Coder 3.4 which was released to Core on 28th May #3041983-27: Fix unused imports and update Coder to 8.3.4

This will require a fix to 13 test files and 4 action files. The countdown.inc file has now been removed #3059382: scheduler_handler_field_scheduler_countdown.inc is no longer needed

Comments

jonathan1055 created an issue. See original summary.

jonathan1055’s picture

jonathan1055’s picture

Status: Active » Needs review
StatusFileSize
new1.42 KB

Locally it seems like StringTranslationTrait is already added to RulesActionBase. The tests probably do not cover this anyway, but locally I tested it manually.

Try one change, but setting 'sniff-all-files: true' in drupalci.yml to see what effect this has.

jonathan1055’s picture

Issue summary: View changes
StatusFileSize
new31.79 KB

Tests are always run in English for the UI to save processing resources, hence we do not need to translate the text on the buttons, just simply remove the call to t() for those.

  • jonathan1055 committed 5adc418 on 8.x-1.x
    Issue #3059164 by jonathan1055: Replace t() in classes with $this->t()
    
jonathan1055’s picture

Status: Needs review » Fixed

We are back to clean coding standards again.

jonathan1055’s picture

The core issue which upgraded Coder to 8.x-3.4 is #3041983: Fix unused imports and update Coder to 8.3.4 and the commit to Core was 28th May.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

jonathan1055’s picture