Problem/Motivation

Getting following error/warnings

FILE: /app/modules/contrib/lang_dropdown/lang_dropdown.module
-------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 17 WARNINGS AFFECTING 17 LINES
-------------------------------------------------------------------------------------
12 | WARNING | Global constants should not be used, move it to a class or interface
13 | WARNING | Global constants should not be used, move it to a class or interface
14 | WARNING | Global constants should not be used, move it to a class or interface
15 | WARNING | Global constants should not be used, move it to a class or interface
16 | WARNING | Global constants should not be used, move it to a class or interface
19 | WARNING | Global constants should not be used, move it to a class or interface
20 | WARNING | Global constants should not be used, move it to a class or interface
21 | WARNING | Global constants should not be used, move it to a class or interface
22 | WARNING | Global constants should not be used, move it to a class or interface
25 | WARNING | Global constants should not be used, move it to a class or interface
26 | WARNING | Global constants should not be used, move it to a class or interface
27 | WARNING | Global constants should not be used, move it to a class or interface
28 | WARNING | Global constants should not be used, move it to a class or interface
31 | WARNING | Global constants should not be used, move it to a class or interface
32 | WARNING | Global constants should not be used, move it to a class or interface
35 | WARNING | Global constants should not be used, move it to a class or interface
36 | WARNING | Global constants should not be used, move it to a class or interface
-------------------------------------------------------------------------------------

FILE: /app/modules/contrib/lang_dropdown/src/Form/LanguageDropdownForm.php
--------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 3 WARNINGS AFFECTING 7 LINES
--------------------------------------------------------------------------------------------------
26 | ERROR | [ ] Missing member variable doc comment
27 | ERROR | [ ] Missing member variable doc comment
28 | ERROR | [ ] Missing member variable doc comment
93 | ERROR | [x] Parameter comment must end with a full stop
162 | WARNING | [ ] Only string literals should be passed to t() where possible
176 | WARNING | [ ] Only string literals should be passed to t() where possible
214 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------

FILE: /app/modules/contrib/lang_dropdown/src/Plugin/Block/LanguageDropdownBlock.php
---------------------------------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AND 1 WARNING AFFECTING 7 LINES
---------------------------------------------------------------------------------------------------------------------------------------------
305 | ERROR | [ ] The array declaration extends to column 91 (the limit is 80). The array content should be split up over multiple lines
334 | ERROR | [ ] The array declaration extends to column 327 (the limit is 80). The array content should be split up over multiple lines
437 | ERROR | [ ] The array declaration extends to column 295 (the limit is 80). The array content should be split up over multiple lines
720 | ERROR | [x] list(...) is forbidden, use [...] instead.
725 | ERROR | [x] list(...) is forbidden, use [...] instead.
769 | ERROR | [x] list(...) is forbidden, use [...] instead.
799 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------

FILE: /app/modules/contrib/lang_dropdown/tests/src/Functional/LanguageSwitchingTest.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
54 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
62 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------

Time: 1.91 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/lang_dropdown/

Proposed resolution

bove error/warnings need to be fixed

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

samit.310@gmail.com created an issue. See original summary.

samitk’s picture

Assigned: samitk » Unassigned
Status: Needs work » Needs review
StatusFileSize
new29.12 KB

Issue fixed.

sourabhjain’s picture

Assigned: Unassigned » sourabhjain

I will review the patch.

sourabhjain’s picture

Assigned: sourabhjain » Unassigned
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.66 MB
new443.6 KB

I have reviewed patch #2 and its working fine. Moving it to RTBC.

Charchil Khandelwal made their first commit to this issue’s fork.

charchil khandelwal’s picture

Issue tags: -, -

Created MR for same.
Please review.

Thank You.