t() calls should be avoided in classes

Created on 20 March 2024, 9 months ago
Updated 31 July 2024, 5 months ago

Problem/Motivation

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

RTBC

Version

5.0

Component

Code

Created by

🇮🇳India chaitanyadessai Goa

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

Merge Requests

Comments & Activities

  • Issue created by @chaitanyadessai
  • Issue was unassigned.
  • Status changed to Needs review 9 months ago
  • 🇮🇳India chaitanyadessai Goa

    Please review.

  • 🇮🇳India rakesh.regar Rajasthan, India

    rakesh.regar made their first commit to this issue’s fork.

  • 🇮🇳India rakesh.regar Rajasthan, India

    Raised Merge Request.

  • Status changed to RTBC 5 months ago
  • 🇵🇭Philippines cleavinjosh

    Hi @rakesh.regar,

    I applied MR!53, it was applied smoothly and fixed all the t() calls issues.

    Before patch (These are the only files that have t() calls issues.

    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/modules/context_ui/src/Form/ContextEditForm.php
    ----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
    ----------------------------------------------------------------------------------------------------------------------------------------------
       6 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormState.
     245 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     251 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
    ----------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------------
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/Plugin/ContextReaction/Theme.php
    ----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AND 3 WARNINGS AFFECTING 5 LINES
    ----------------------------------------------------------------------------------------------------------------------------------------------
      44 | ERROR   | [x] Multi-line function declarations must have a trailing comma after the last parameter
      75 | WARNING | [x] 'TODO: Implement execute() method.' should match the format '@todo Fix problem X here.'
      88 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
      89 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     101 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
    ----------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------------
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/Plugin/Condition/UserProfilePage.php
    ----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 5 ERRORS AND 3 WARNINGS AFFECTING 8 LINES
    ----------------------------------------------------------------------------------------------------------------------------------------------
       6 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Condition\ConditionPluginBase.
      90 | WARNING | [ ] #description values usually have to run through t() for translation
     100 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
     142 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
     177 | ERROR   | [x] Use "elseif" in place of "else if"
     180 | ERROR   | [x] Use "elseif" in place of "else if"
     183 | ERROR   | [x] Use "elseif" in place of "else if"
     184 | WARNING | [ ] User::load calls should be avoided in classes, use dependency injection instead
    ----------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------------
    

    After patch

    ➜  context curl https://git.drupalcode.org/project/context/-/merge_requests/53.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2456    0  2456    0     0   5956      0 --:--:-- --:--:-- --:--:--  5946
    patching file modules/context_ui/src/Form/ContextEditForm.php
    patching file src/Plugin/Condition/UserProfilePage.php
    patching file src/Plugin/ContextReaction/Theme.php
    ➜  context ..
    ➜  contrib phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml context
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/context.module
    -------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------
     10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Utility\NestedArray.
    -------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/tests/modules/context_all_any_test/context_all_any_test.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: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/context.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: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/modules/context_ui/context_ui.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: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/modules/context_ui/context_ui.install
    ------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------
     14 | WARNING | Unused variable $key.
    ------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/modules/context_ui/src/ContextListBuilder.php
    --------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    --------------------------------------------------------------------------------------------------------------------------
      7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Utility\Html.
     65 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
    --------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/modules/context_ui/src/Form/ContextDisableForm.php
    -------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\context\ContextManager.
    -------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/modules/context_ui/src/Form/ContextFormBase.php
    ----------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\context\ContextManager.
    ----------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/modules/context_ui/src/Form/ReactionDeleteForm.php
    -------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\context\ContextManager.
    -------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/modules/context_ui/src/Form/ContextDeleteForm.php
    ------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\context\ContextManager.
    ------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/modules/context_ui/src/Form/ContextDuplicateForm.php
    ---------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
    ---------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/modules/context_ui/src/Form/ContextEditForm.php
    ----------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormState.
    ----------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/modules/context_ui/src/Form/ConditionDeleteForm.php
    --------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\context\ContextInterface.
    --------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/modules/context_ui/src/Plugin/Block/ContextInspector.php
    -------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    -------------------------------------------------------------------------------------------------------------------------------------
     30 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     32 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     35 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    -------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/modules/context_ui/src/Controller/ContextUIController.php
    --------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    --------------------------------------------------------------------------------------------------------------------------------------
      7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Utility\Html.
     61 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
    --------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/Reaction/Blocks/Form/BlockFormBase.php
    ---------------------------------------------------------------------------------------------------------------------------
    FOUND 6 ERRORS AFFECTING 6 LINES
    ---------------------------------------------------------------------------------------------------------------------------
      18 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\context\ContextInterface.
     142 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
     238 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     250 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     257 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     268 | ERROR | [x] Use null coalesce operator instead of ternary operator.
    ---------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/Reaction/Blocks/BlockCollection.php
    --------------------------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AND 1 WARNING AFFECTING 4 LINES
    --------------------------------------------------------------------------------------------------------------------
     16 | WARNING | [ ] Possible useless method overriding detected
     44 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
     54 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
     57 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
    --------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/Reaction/Blocks/Controller/ContextReactionBlocksController.php
    -----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    -----------------------------------------------------------------------------------------------------------------------------------------------
     10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\context\ContextInterface.
     67 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
    -----------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/ContextReactionInterface.php
    -------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Plugin\PluginInspectionInterface.
    -------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/Entity/Context.php
    -------------------------------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    -------------------------------------------------------------------------------------------------------------------------
     5 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
     6 | ERROR | [x] Non-namespaced classes/interfaces/traits should not be referenced with use statements
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\context\ContextInterface.
    -------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/Entity/ContextAccess.php
    ---------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    ---------------------------------------------------------------------------------------------------------
     23 | WARNING | Possible useless method overriding detected
     37 | WARNING | Possible useless method overriding detected
    ---------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/ContextReactionManager.php
    ---------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------
     6 | 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
    ---------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/Plugin/DisplayVariant/ContextBlockPageVariant.php
    ----------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Display\PageVariantInterface.
    ----------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/Plugin/ContextReaction/Blocks.php
    ---------------------------------------------------------------------------------------------------------------------
    FOUND 5 ERRORS AND 2 WARNINGS AFFECTING 7 LINES
    ---------------------------------------------------------------------------------------------------------------------
      11 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Cache\Cache.
     140 | ERROR   | [x] Multi-line function declarations must have a trailing comma after the last parameter
     198 | WARNING | [x] The variable name should be defined after the type
     302 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
     554 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
     706 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
     776 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
    ---------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/Plugin/ContextReaction/PageTemplateSuggestions.php
    -----------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------------
     42 | ERROR | [x] Use null coalesce operator instead of ternary operator.
    -----------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/Plugin/ContextReaction/Theme.php
    -----------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
    -----------------------------------------------------------------------------------------------------------------
      44 | ERROR   | [x] Multi-line function declarations must have a trailing comma after the last parameter
      75 | WARNING | [x] 'TODO: Implement execute() method.' should match the format '@todo Fix problem X here.'
     101 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
    -----------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/Plugin/ContextReaction/PageTitle.php
    ---------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------
     41 | ERROR | [x] Use null coalesce operator instead of ternary operator.
    ---------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/Plugin/ContextReaction/Menu.php
    ----------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------
     74 | ERROR | [x] Use null coalesce operator instead of ternary operator.
    ----------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/Plugin/ContextReaction/Regions.php
    -------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    -------------------------------------------------------------------------------------------------------------------
     52 | ERROR   | [x] Multi-line function declarations must have a trailing comma after the last parameter
     83 | WARNING | [x] 'TODO: Implement execute() method.' should match the format '@todo Fix problem X here.'
    -------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/Plugin/ContextReactionPluginCollection.php
    ---------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------
     15 | WARNING | Possible useless method overriding detected
    ---------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/Plugin/Condition/UserProfilePage.php
    ---------------------------------------------------------------------------------------------------------------------------------------
    FOUND 5 ERRORS AND 2 WARNINGS AFFECTING 7 LINES
    ---------------------------------------------------------------------------------------------------------------------------------------
       6 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Condition\ConditionPluginBase.
      90 | WARNING | [ ] #description values usually have to run through t() for translation
     100 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
     177 | ERROR   | [x] Use "elseif" in place of "else if"
     180 | ERROR   | [x] Use "elseif" in place of "else if"
     183 | ERROR   | [x] Use "elseif" in place of "else if"
     184 | WARNING | [ ] User::load calls should be avoided in classes, use dependency injection instead
    ---------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/Plugin/Condition/RequestDomain.php
    -----------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Condition\ConditionPluginBase.
    -----------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/Plugin/Condition/ViewInclusion.php
    -----------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Condition\ConditionPluginBase.
    -----------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/ContextManager.php
    -------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 5 ERRORS AFFECTING 4 LINES
    -------------------------------------------------------------------------------------------------------------------------------------------
      10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Condition\ConditionPluginCollection.
      88 | ERROR | [x] The open comment tag must be the only content on the line
      88 | ERROR | [x] Doc comment short description must be on the first line
      94 | ERROR | [ ] Parameter $currentRouteMatch is not described in comment
     114 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter
    -------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/Theme/ThemeSwitcherNegotiator.php
    ------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    ------------------------------------------------------------------------------------------------------------------
     76 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     80 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    ------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/context/src/EventSubscriber/BlockPageDisplayVariantSubscriber.php
    --------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------------------------------
     7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\context\Plugin\ContextReaction\Blocks.
    --------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 1.93 secs; Memory: 14MB
    
    ➜  contrib

    Moving this to RTBC since this issue only focuses on the t() calls issues.

    Thank you.

Production build 0.71.5 2024