Problem/Motivation
t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead.
Remove uses of t() in assertions has been done in the issue https://www.drupal.org/project/drupal/issues/3133726.
Remove all calls to t() wrapped in calls to drupalPostForm() will be done in the issue https://www.drupal.org/project/drupal/issues/3145005.
Steps to reproduce
Proposed resolution
Remaining tasks
Replace all remaning occurance of t() calls with $this->t() in classes.