Problem/Motivation
FILE: /var/www/html/drupal9/web/modules/contrib/likeit/src/Entity/LikeIt.php
-------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------
160 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
-------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------
FILE: /var/www/html/drupal9/web/modules/contrib/likeit/src/Controller/LikeItController.php
------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------
18 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
195 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/drupal9/web/modules/contrib/likeit/src/Form/LikeItSettingsForm.php
----------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------------
18 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
173 | ERROR | [x] Use null coalesce operator instead of ternary operator.
----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/drupal9/web/modules/contrib/likeit/likeit.info.yml
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
-------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/drupal9/web/modules/contrib/likeit/likeit.module
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
432 | ERROR | The $_COOKIE super global must not be accessed directly; inject the request_stack service and use $stack->getCurrentRequest()->cookies->get('likeit_session') instead
442 | ERROR | The $_COOKIE super global must not be accessed directly; inject the request_stack service and use $stack->getCurrentRequest()->cookies->get('likeit_session') instead
442 | 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: 597ms; Memory: 14MB
Steps to reproduce
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig web/modules/contrib/likeit/
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 3345426-11.patch | 4.65 KB | imustakim |
| #8 | likeit-phpcsfix-3345426.patch | 4.61 KB | imustakim |
Issue fork likeit-3345426
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:
- 3345426-codingstandards
changes, plain diff MR !3
Comments
Comment #2
indrapatil commentedI am working on it.
Comment #4
indrapatil commentedHi,
Still we have this errors to work
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig likeit-3345426/
FILE: /var/www/html/drupal9/likeit-3345426/likeit.module
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
432 | ERROR | The $_COOKIE super global must not be accessed directly; inject the request_stack service and use $stack->getCurrentRequest()->cookies->get('likeit_session') instead
442 | ERROR | The $_COOKIE super global must not be accessed directly; inject the request_stack service and use $stack->getCurrentRequest()->cookies->get('likeit_session') instead
442 | 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: 572ms; Memory: 14MB
Comment #5
avpadernoComment #6
avpadernoComment #7
imustakim commentedworking on this.
Comment #8
imustakim commentedAdded a patch for fixes.
Please review.
Comment #9
andrew_tspkh@imustakim, please have a look on this code:
Can't use method return value in write context.
Comment #10
imustakim commentedUpdating the patch.
Comment #11
imustakim commentedPatch updated.
Please review.
Comment #12
imustakim commentedComment #13
andrew_tspkhHas no sense, because here we need to set cookie. And in code above you just assign session Id to variable that never be used.
I think that good code is:
Also please check functions/variables doc parts where you put new parameters:
should be:
Comment #14
imustakim commentedComment #16
andrew_tspkh