Fix the issues reported by phpcs

Created on 3 July 2023, 12 months ago
Updated 1 August 2023, 11 months ago

Problem/Motivation

FILE: /var/www/html/vb/d_cont/media_photoswipe/README.txt
------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
------------------------------------------------------------------------
77 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
123 | ERROR | [x] Expected 1 newline at end of file; 2 found
------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------

FILE: ...w/html/vb/d_cont/media_photoswipe/src/Form/MediaPhotoSwipeSettingsForm.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
103 | WARNING | Unused variable $img_folder_path.
133 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
135 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
--------------------------------------------------------------------------------

FILE: ...otoswipe/src/Plugin/Field/FieldFormatter/MediaImagePhotoSwipeFormatter.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
476 | WARNING | ImageStyle::load calls should be avoided in classes, use
| | dependency injection instead
498 | WARNING | ImageStyle::load calls should be avoided in classes, use
| | dependency injection instead
505 | WARNING | ImageStyle::load calls should be avoided in classes, use
| | dependency injection instead
--------------------------------------------------------------------------------

Time: 294ms; Memory: 14MB

Steps to reproduce

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

Remaining tasks

Patch review

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India urvashi_vora Madhya Pradesh, India

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

  • Issue created by @urvashi_vora
  • Status changed to Needs work 12 months ago
  • 🇵🇭Philippines roberttabigue

    Hi @urvashi_vora,

    I got an error when applying your Patch, please see the attached screenshot for reference.

    Moving this to Needs work.

    Thank you.

  • Assigned to nitin_lama
  • 🇮🇳India nitin_lama

    Updated patch. Please review.

  • Issue was unassigned.
  • Status changed to Needs review 12 months ago
  • Status changed to RTBC 12 months ago
  • 🇵🇭Philippines roberttabigue

    Hi,

    I reviewed the changes and confirmed the Patch was applied cleanly.

    Checking patch README.md...
    Checking patch src/Form/MediaPhotoSwipeSettingsForm.php...
    Checking patch src/Plugin/Field/FieldFormatter/MediaImagePhotoSwipeFormatter.php...
    Applied patch README.md cleanly.
    Applied patch src/Form/MediaPhotoSwipeSettingsForm.php cleanly.
    Applied patch src/Plugin/Field/FieldFormatter/MediaImagePhotoSwipeFormatter.php cleanly.

    I ran this command:
    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig ab_age_gate/

    and all PHPCS errors have been fixed.

    Successfully applied to Media PhotoSwipe module with 1.0.0-alpha1 version and with the Drupal core version of 9.5.x.

    Please see the attached screenshots for your reference.

    I'm moving this now to RTBC.

    Thank you!

  • Status changed to Needs work 12 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    +  /**
    +   * The Get EntityTypeManagerInterface.
    +   *
    +   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
    +   */
    +  protected $entityTypeManager;
    +

    That description is not correct for a property and it does not make sense.

  • First commit to issue fork.
  • @frederikvho opened merge request.
  • @frederikvho opened merge request.
  • Status changed to Needs review 12 months ago
  • 🇧🇪Belgium Frederikvho Belgium

    Hi,

    I created a fork from the most recent branch 1.0.x-dev, also the patch from #4 seemed to be for that branch as well.

    Summary:

    1. Applied patch from #4
    2. Applied additional phpcbf fixes
    3. Fixed comment #7 and changed the description.

    Please see: merge request !4

  • Status changed to RTBC 12 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    The MR correctly changes the files.

  • Status changed to Fixed 11 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Status changed to Fixed 11 months ago
  • 🇦🇲Armenia levmyshkin Yerevan, Armenia
Production build 0.69.0 2024