Fix the issues reported by phpcs

Created on 20 April 2023, about 1 year ago
Updated 15 February 2024, 5 months ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/azure_ad_login/azure_ad_login.module
------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
------------------------------------------------------------------------
13 | WARNING | [x] Unused use statement
14 | WARNING | [x] Unused use statement
15 | WARNING | [x] Unused use statement
25 | ERROR | [x] Short array syntax must be used to define arrays
------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/azure_ad_login/README.md
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
10 | ERROR | [x] Expected 1 newline at end of file; 2 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/azure_ad_login/azure_ad_login.info.yml
--------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------------------------------
7 | WARNING | [ ] All dependencies must be prefixed with the project name, for example "drupal:"
9 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/azure_ad_login/src/Form/AzureADSettingsForm.php
-----------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
-----------------------------------------------------------------------------------------------------------
111 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
116 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 10
118 | WARNING | [ ] Avoid backslash escaping in translatable strings when possible, use "" quotes instead
130 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
-----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/azure_ad_login/src/Controller/CallbackController.php
----------------------------------------------------------------------------------------
FOUND 6 ERRORS AND 1 WARNING AFFECTING 7 LINES
----------------------------------------------------------------------------------------
15 | WARNING | [x] Unused use statement
57 | ERROR | [ ] Missing member variable doc comment
59 | ERROR | [ ] Missing member variable doc comment
62 | ERROR | [ ] More than 2 empty lines are not allowed
68 | ERROR | [x] Expected 1 blank line before function; 3 found
141 | ERROR | [x] There should be no white space before a closing ")"
166 | ERROR | [x] Use null coalesce operator instead of ternary operator.
----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/azure_ad_login/src/AzureAD.php
--------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------------------------
201 | ERROR | [x] Comma not allowed after last value in single-line array declaration
201 | ERROR | [x] Expected one space after the comma, 0 found
214 | ERROR | [ ] Public method name "AzureAD::DrupalRoles" is not in lowerCamel format
297 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------

Time: 1.09 secs; Memory: 6MB

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/azure_ad_login/

Proposed resolution

Above error/warnings need to be fixed.

📌 Task
Status

Needs review

Version

1.0

Component

Code

Created by

🇮🇳India samit.310@gmail.com

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024