Fix the warning reported by PHP_CodeSniffer

Created on 16 August 2024, 4 months ago
Updated 15 September 2024, 3 months ago

Problem/Motivation

Running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml shows the following warning which should be fixed.

FILE: /web/modules/custom/media_thumbnails/src/Form/MediaThumbnailConfigForm.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------
 62 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------
🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇺🇦Ukraine andrii momotov

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @andrii momotov
  • Status changed to Needs review 4 months ago
  • 🇺🇦Ukraine andrii momotov

    Fixed the warning reported by PHP_CodeSniffer and created MR. Please review. Thanks!

  • Issue was unassigned.
  • 🇺🇦Ukraine andrii momotov

    Fixed the warning reported by PHP_CodeSniffer and created MR. Please review. Thanks!

  • Assigned to paraderojether
  • Status changed to Needs work 4 months ago
  • 🇵🇭Philippines paraderojether

    Hi

    I reviewed MR!4, applied against Media Thumbnails 8.x-1.x-dev and there is one phpcs error shown below:

    ✗ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig media_thumbnails
    
    FILE: /Users/jetherparadero/Contributions/recommended-project/web/modules/contrib/media_thumbnails/src/Plugin/MediaThumbnailManager.php
    ---------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Cache\CacheBackendInterface.
    ---------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 350ms; Memory: 10MB

    Thank you.

  • Issue was unassigned.
  • Status changed to Needs review 4 months ago
  • 🇵🇭Philippines paraderojether

    I fixed the remaining issue, please review.

    Thank you.

  • Status changed to RTBC 4 months ago
  • 🇮🇳India riddhi.addweb

    The mentioned issue is resolved, & I have also checked and it is working as expected. I am attaching the Screenshots & doing RTBC for the same.

  • First commit to issue fork.
  • Status changed to Fixed 3 months ago
  • 🇫🇷France Renrhaf 📍 Strasbourg 🐦🦜

    Merged, thank you all!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024