Fix the issues reported by phpcs

Created on 18 July 2024, 5 months ago
Updated 19 July 2024, 5 months ago

Problem/Motivation

There is a file that needs to be fixed with coding standards.
Here is the command: -

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml .

FILE: D:\wamp64\www\demo8\modules\contrib\youtube_gallery\src\Controller\playVideo.php
----------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------------------------------------------------------------
  6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Path\CurrentPathStack.
 17 | ERROR | [ ] Class name doesn't match filename; expected "class playVideo"
 19 | ERROR | [ ] Missing member variable doc comment
 20 | ERROR | [ ] Missing member variable doc comment
----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------


FILE: D:\wamp64\www\demo8\modules\contrib\youtube_gallery\src\Controller\UploadVideo.php
--------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 6 LINES
--------------------------------------------------------------------------------------------------------------------------------------------------------------
 14 | ERROR | Missing member variable doc comment
 15 | ERROR | Missing member variable doc comment
 16 | ERROR | Missing member variable doc comment
 49 | ERROR | The $_GET super global must not be accessed directly; inject the request_stack service and use $stack->getCurrentRequest()->query->get('code')
    |       | instead
 51 | ERROR | The $_GET super global must not be accessed directly; inject the request_stack service and use $stack->getCurrentRequest()->query->get('state')
    |       | instead
 56 | ERROR | The $_GET super global must not be accessed directly; inject the request_stack service and use $stack->getCurrentRequest()->query->get('code')
    |       | instead
--------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: D:\wamp64\www\demo8\modules\contrib\youtube_gallery\src\Controller\youtubeConfig.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------
  6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Serialization\Json.
 11 | ERROR | [ ] Class name doesn't match filename; expected "class youtubeConfig"
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------


FILE: D:\wamp64\www\demo8\modules\contrib\youtube_gallery\src\Controller\youtubeGallery.php
-------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------
 16 | ERROR | Class name doesn't match filename; expected "class youtubeGallery"
 18 | ERROR | Missing member variable doc comment
-------------------------------------------------------------------------------------------


FILE: D:\wamp64\www\demo8\modules\contrib\youtube_gallery\src\Form\UploadVideoForm.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 32 WARNINGS AFFECTING 35 LINES
-------------------------------------------------------------------------------------------------------------------------------------------
   8 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\youtube_gallery\Controller\UploadVideo.
  16 | ERROR   | [ ] Missing member variable doc comment
  17 | ERROR   | [ ] Missing member variable doc comment
 100 | WARNING | [ ] #options values usually have to run through t() for translation
 101 | WARNING | [ ] #options values usually have to run through t() for translation
 102 | WARNING | [ ] #options values usually have to run through t() for translation
 103 | WARNING | [ ] #options values usually have to run through t() for translation
 104 | WARNING | [ ] #options values usually have to run through t() for translation
 105 | WARNING | [ ] #options values usually have to run through t() for translation
 106 | WARNING | [ ] #options values usually have to run through t() for translation
 107 | WARNING | [ ] #options values usually have to run through t() for translation
 108 | WARNING | [ ] #options values usually have to run through t() for translation
 109 | WARNING | [ ] #options values usually have to run through t() for translation
 110 | WARNING | [ ] #options values usually have to run through t() for translation
 111 | WARNING | [ ] #options values usually have to run through t() for translation
 112 | WARNING | [ ] #options values usually have to run through t() for translation
 113 | WARNING | [ ] #options values usually have to run through t() for translation
 114 | WARNING | [ ] #options values usually have to run through t() for translation
 115 | WARNING | [ ] #options values usually have to run through t() for translation
 116 | WARNING | [ ] #options values usually have to run through t() for translation
 117 | WARNING | [ ] #options values usually have to run through t() for translation
 118 | WARNING | [ ] #options values usually have to run through t() for translation
 119 | WARNING | [ ] #options values usually have to run through t() for translation
 120 | WARNING | [ ] #options values usually have to run through t() for translation
 121 | WARNING | [ ] #options values usually have to run through t() for translation
 122 | WARNING | [ ] #options values usually have to run through t() for translation
 123 | WARNING | [ ] #options values usually have to run through t() for translation
 124 | WARNING | [ ] #options values usually have to run through t() for translation
 125 | WARNING | [ ] #options values usually have to run through t() for translation
 126 | WARNING | [ ] #options values usually have to run through t() for translation
 127 | WARNING | [ ] #options values usually have to run through t() for translation
 128 | WARNING | [ ] #options values usually have to run through t() for translation
 129 | WARNING | [ ] #options values usually have to run through t() for translation
 130 | WARNING | [ ] #options values usually have to run through t() for translation
 131 | WARNING | [ ] #options values usually have to run through t() for translation
-------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------


FILE: D:\wamp64\www\demo8\modules\contrib\youtube_gallery\src\Plugin\Block\YoutubeVideoGallery.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------
 13 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\youtube_gallery\Controller\youtubeConfig.
 26 | ERROR | [ ] Missing member variable doc comment
------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------


FILE: D:\wamp64\www\demo8\modules\contrib\youtube_gallery\youtube_gallery.info.yml
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 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
 1 | WARNING | "core_version_requirement" property is missing in the info.yml file
-------------------------------------------------------------------------------------------------------------

Time: 1.24 secs; Memory: 12MB

Steps to reproduce

Run PHPCS on this module.

Proposed resolution

Fix the coding standards.

Remaining tasks

Submit the MR.

๐Ÿ“Œ Task
Status

RTBC

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia amanbtr72

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

Production build 0.71.5 2024