Fix the issues reported by phpcs

Created on 28 June 2022, over 2 years ago
Updated 30 May 2024, 6 months ago

Problem/Motivation

FILE: /home/system/Documents/contribution/layoutcomponents-3293054/src/LcLayoutsManager.php
---------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------
 541 | WARNING | Role::loadMultiple calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------------------


FILE: /home/system/Documents/contribution/layoutcomponents-3293054/src/LcTheme.php
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------
 257 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------


FILE: /home/system/Documents/contribution/layoutcomponents-3293054/src/LcLayoutRender.php
--------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 9 WARNINGS AFFECTING 9 LINES
--------------------------------------------------------------------------------------------------
 297 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 446 | WARNING | Media::load calls should be avoided in classes, use dependency injection instead
 450 | WARNING | File::load calls should be avoided in classes, use dependency injection instead
 485 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 566 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 589 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 714 | WARNING | Media::load calls should be avoided in classes, use dependency injection instead
 718 | WARNING | File::load calls should be avoided in classes, use dependency injection instead
 946 | WARNING | Unused variable $description.
--------------------------------------------------------------------------------------------------

Time: 1.05 secs; Memory: 22MB

Steps to reproduce

Execute the command:
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig layoutcomponents/

๐Ÿ“Œ Task
Status

Needs work

Version

3.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia Rakhi Soni

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.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    +/**
    + * @file
    + * Description.
    + */
    +

    That is not the correct short description for a module file.

        * @return \Drupal\layoutcomponents\LcLayoutRender
    +   *   Description for the return value.
        */
       public function getLayout() {

    That is not the return value description.

    -      //$build['layout_settings']['container']['section']['sub_section'] = $sub_section;
    -
    +      // $build['layout_settings']['container']['section']['sub_section'] =
    +      // $sub_section;

    The existing commented-out code is correct as it is. There is only a missing space after the comment delimiter.

       /**
        * Set the region content.
        *
    -   * @param $region
    +   * @param array $region

    Since that documentation comment is changed, the verb in the short description must be changed to use the third singular person.

    -  public function getDefaultColumnOption($type) {
    +  public function getDefaultColumnOption(numeric $type) {

    numeric is not a PHP type that can be used in defining parameters.

    +   * @param bool $isSubregion
    +   *   The bool.

    That does not describe the parameter.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia pray_12

    Preethy_ray โ†’ made their first commit to this issueโ€™s fork.

  • Assigned to nitin_lama
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India

    Patch #2 doesn't applies on 3.0.x branch. Providing the updated patch. Updating the IS with the remaining issues.

    @preethy_ray moving forward please provide a patch for the issues you have worked on.

  • Issue was unassigned.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India
  • Hi,
    Tested the #8 patch, patch does not apply and throws following errors.

    Checking patch src/LcLayoutRender.php...
    Hunk #1 succeeded at 327 (offset 1 line).
    Checking patch src/LcLayoutsManager.php...
    warning: src/LcLayoutsManager.php has type 100644, expected 100755
    Checking patch src/LcTheme.php...
    warning: src/LcTheme.php has type 100644, expected 100755
    error: while searching for:
    use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
    use Drupal\Core\Layout\LayoutPluginManager;
    use Drupal\Core\Routing\RouteMatchInterface;
    use Drupal\node\Entity\Node;
    use Symfony\Component\DependencyInjection\ContainerInterface;

    error: patch failed: src/LcTheme.php:5
    error: src/LcTheme.php: patch does not apply
    Checking patch src/Plugin/Layout/LcBase.php...
    warning: src/Plugin/Layout/LcBase.php has type 100644, expected 100755

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dev16.addweb

    Kindly review this patch.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    apaderno โ†’ changed the visibility of the branch 3.0.x to hidden.

  • Pipeline finished with Failed
    6 months ago
    Total: 696s
    #186046
Production build 0.71.5 2024