Avoid \Drupal calls in classes, use dependency injection instead and fix Drupal standard issues.
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3199800. --> Reported by: [ankithashetty](https://www.drupal.org/user/3602225) >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <pre>$ phpcs --standard=Drupal,DrupalPractice .<br><br>FILE: /menu_link_attributes/src/Form/ConfigForm.php<br>---------------------------------------------------------------------------------------------------<br>FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES<br>---------------------------------------------------------------------------------------------------<br> 42 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead<br> 50 | ERROR&nbsp;&nbsp; | [x] Short array syntax must be used to define arrays<br> 60 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead<br>---------------------------------------------------------------------------------------------------</pre><h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Fix the errors IS as per Drupal's best practices and coding standards.</p> <h3 id="summary-ui-changes">User interface changes</h3> <p>NONE</p> <h3 id="summary-api-changes">API changes</h3> <p>NONE</p> <h3 id="summary-data-model-changes">Data model changes</h3> <p>NONE</p>
issue