Fix the issues reported by phpcs

Created on 21 March 2023, over 1 year ago
Updated 22 March 2023, over 1 year ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/likeit/src/Form/LikeItSettingsForm.php
-----------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------
102 | WARNING | [x] A comma should follow the last multiline array item. Found: )
-----------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/likeit/src/LikeitHelper.php
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
427 | ERROR | The $_COOKIE super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->cookies->get('likeit_session') instead
437 | ERROR | The $_COOKIE super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->cookies->get('likeit_session') instead
437 | ERROR | The $_COOKIE super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->cookies->get('likeit_session') instead
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Time: 2.01 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/likeit/

Proposed resolution

Above error/warnings need to be fixed.

📌 Task
Status

RTBC

Version

3.1

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.71.5 2024