Don't pass config through t()
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3534931. --> Reported by: [andyf](https://www.drupal.org/user/220112) Related to !5 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>Hey, I noticed that PHPCS is warning us...</p> <pre>FILE: src/Hook/FormHooks.php<br>------------------------------------------------------------------------------------------------------------------------<br>FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE<br>------------------------------------------------------------------------------------------------------------------------<br> 90 | WARNING | Only string literals should be passed to t() where possible<br>&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | (Drupal.Semantics.FunctionT.NotLiteralString)</pre><p>This comes from</p> <pre>$this-&gt;messenger-&gt;addWarning($this-&gt;t($config-&gt;get('warning_message')));</pre><p><code>config_warning.settings:warning_message</code> is already translatable per its schema, so I think you should be fine just displaying it directly.</p> <p>Thanks!</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <h3 id="summary-ui-changes">User interface changes</h3> <h3 id="summary-api-changes">API changes</h3> <h3 id="summary-data-model-changes">Data model changes</h3>
issue