Problems/Motivation:

FILE: ...eb/modules/contrib/domain_language-3370924/src/Form/DomainLanguageForm.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 10 WARNINGS AFFECTING 10 LINES
--------------------------------------------------------------------------------
36 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
39 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
42 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
46 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
50 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
84 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
128 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
148 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
160 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
175 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
--------------------------------------------------------------------------------

FILE: ...eb/modules/contrib/domain_language-3370924/src/DomainLanguageOverrider.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
--------------------------------------------------------------------------------
82 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
91 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
104 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
166 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
167 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency
| | injection instead
--------------------------------------------------------------------------------

Steps to Reproduce:

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig domain_language/

Remaining Tasks:

Needs dependency injections to be injected in code.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

arti_parmar created an issue. See original summary.

urvashi_vora’s picture

Assigned: arti_parmar » Unassigned

Unassigning, as its been 2 weeks and no work is done.

As per Issue Etiquette #8 of Dont's (https://www.drupal.org/docs/develop/issues/issue-procedures-and-etiquett...), do not assign yourself to an issue unless you intend to work on it in a fairly short timeframe.

urvashi_vora’s picture

Also, as per issue summary, it is not clear, which command has been executed to reproduce this issue.

urvashi_vora’s picture

Issue summary: View changes
urvashi_vora’s picture

I have updated the issue summary.

urvashi_vora’s picture

Assigned: Unassigned » urvashi_vora

I will provide a solution shortly.

urvashi_vora’s picture

Assigned: urvashi_vora » Unassigned
Status: Active » Needs review

Please review.

Thanks

thakurnishant_06’s picture

Status: Needs review » Reviewed & tested by the community

Hello @urvashi_vora
I have tested MR10, and the changes made have resolved all the errors and warnings.
Thank you for the support

  • urvashi_vora authored 37acc411 on 2.0.x
    Issue #3370924: \Drupal calls should be avoided in classes, use...
jeroent’s picture

Status: Reviewed & tested by the community » Fixed

Merged to 8.x-1.x. Thanks!

jeroent’s picture

cslevy’s picture

Hello,

This merge generates a fatal error.

Fatal error: Uncaught TypeError: Drupal\domain_language\DomainLanguageOverrider::__construct(): Argument #1 ($current_user) must be of type Drupal\Core\Session\AccountProxyInterface, Drupal\Core\Config\CachedStorage given, called in .../web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 and defined in .../web/modules/contrib/domain_language/src/DomainLanguageOverrider.php:81

This class is defined in the services in the following way:

  domain_language.overrider:
    class: Drupal\domain_language\DomainLanguageOverrider
    tags:
      - { name: config.factory.override, priority: -140 }
    arguments: ['@config.storage']

And also the create method was introduced.

/**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('current_user'),
      $container->get('domain.negotiator'),
      $container->get('config.factory'),
      $container->get('domain_config.overrider')
    );
  }

We don't need both. I think the dependencies should be defined in the services.yml, and this create method removed.

Status: Fixed » Closed (fixed)

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

bburg’s picture

This issue is closed, so I created #3388388: DomainLanguageOverrider service arguments to address the error cslevy mentions.