Fix the issues reported by PHPCS

Created on 7 March 2023, over 1 year ago
Updated 9 August 2024, 3 months ago

Problem/Motivation

Getting the following error/warnings

FILE: /micro_sso/micro_sso.module
----------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
----------------------------------------------------------------------------------------------------------------
76 | WARNING | [x] '@TODO only https later.' should match the format '@todo Fix problem X here.'
95 | ERROR | [x] Expected "string|null" but found "string|NULL" for function return type
104 | WARNING | [x] '@TODO check user access to site too.' should match the format '@todo Fix problem X here.'
----------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------

FILE: /micro_sso/micro_sso.routing.yml
------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------
6 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
14 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
------------------------------------------------------------------------------------------------------------------

FILE: /micro_sso/micro_sso.permissions.yml
-------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------
4 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------

FILE: /micro_sso/src/Controller/MicroSsoController.php
-------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 3 WARNINGS AFFECTING 5 LINES
-------------------------------------------------------------------------------------------------
69 | WARNING | [ ] Line exceeds 80 characters; contains 84 characters
86 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
163 | WARNING | [ ] Line exceeds 80 characters; contains 83 characters
184 | ERROR | [x] Expected "bool|null" but found "bool|NULL" for parameter type
194 | ERROR | [ ] Type hint "array" missing for $login
-------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------

Steps to reproduce

Run the following command:
phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml micro_sso

šŸ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India omkar_yewale Mumbai

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Hi, reviewed the patch #3, applied cleanly and fixes all the phpcs errors mentioned.

  • Status changed to Needs work 4 months ago
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi @omkar_yewale,

    I applied MR!1, it was applied smoothly and fixed most of the phpcs issues.

    These are the remaining issues I encountered after I ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml.

    āžœ  micro_sso git:(8.x-1.0-beta4) curl https://git.drupalcode.org/project/micro_sso/-/merge_requests/1.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  4911    0  4911    0     0  13257      0 --:--:-- --:--:-- --:--:-- 13272
    patching file micro_sso.module
    patching file micro_sso.permissions.yml
    patching file micro_sso.routing.yml
    patching file src/Controller/MicroSsoController.php
    āžœ  micro_sso git:(8.x-1.0-beta4) āœ— ..
    āžœ  contrib phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml micro_sso
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/micro_sso/src/MicroSsoHelper.php
    ---------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Url.
    ---------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/micro_sso/src/Controller/MicroSsoController.php
    ----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------------------
     12 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Symfony\Component\HttpFoundation\JsonResponse.
    ----------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/micro_sso/src/EventSubscriber/MicroSsoSubscriber.php
    ----------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Symfony\Component\EventDispatcher\EventSubscriberInterface.
    ----------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 201ms; Memory: 10MB
    
    āžœ  contrib

    Thank you.

  • Status changed to Needs review 3 months ago
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi,

    Please review MR!1. Thank you.

  • Pipeline finished with Failed
    2 months ago
    Total: 140s
    #282129
Production build 0.71.5 2024