Problem/Motivation
Getting following error/warnings
FILE: /app/modules/contrib/forward/forward.tokens.inc
----------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------
76 | WARNING | Only string literals should be passed to t() where possible
----------------------------------------------------------------------------
FILE: /app/modules/contrib/forward/src/Form/SettingsForm.php
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------
92 | ERROR | The array declaration extends to column 99 (the limit is 80). The array content should be split up over multiple lines
-------------------------------------------------------------------------------------------------------------------------------------
FILE: /app/modules/contrib/forward/src/Services/ForwardLinkGenerator.php
---------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------
99 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------
Time: 2.34 secs; Memory: 16MB
Steps to reproduce
Run following command
phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/forward/
Proposed resolution
Above error/warnings need to be fixed
API changes
I removed following line of code form src/Services/ForwardLinkGenerator.php
file. As these dependency injection arguments are provided from forward.services.yml
file.
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('link_generator'),
$container->get('renderer'),
$container->get('token'),
);
}