Fix the issues reported by phpcs

Created on 29 October 2022, over 1 year ago
Updated 17 November 2023, 7 months ago

Problem/Motivation

FILE: modules/views_bulk_operations/tests/src/Unit/ViewsBulkOperationsBatchTest.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\StringTranslation\TranslatableMarkup.
------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------

Steps to reproduce

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig modules/views_bulk_operations/

Proposed resolution

Resolve the PHPCS issues.

๐Ÿ“Œ Task
Status

Needs review

Version

4.2

Component

Miscellaneous

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia PrasadDeole

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

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia chaitanyadessai

    Fixed Coding Standards.

  • First commit to issue fork.
  • Assigned to vishaljd
  • Status changed to Needs work over 1 year ago
  • @vishaljd opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Rashmisoni Bangalore

    ------ -----------------------------------------------------------------------------------
    Line modules/actions_permissions/src/ActionsPermissions.php
    ------ -----------------------------------------------------------------------------------
    45 Unsafe usage of new static().
    ๐Ÿ’ก See: https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static
    ------ -----------------------------------------------------------------------------------

    ------ -----------------------------------------------------------------------------------------------------------------------------
    Line src/Commands/ViewsBulkOperationsCommands.php
    ------ -----------------------------------------------------------------------------------------------------------------------------
    12 Interface Drupal\views_bulk_operations\Service\ViewsBulkOperationsViewDataInterface referenced with incorrect case:
    Drupal\views_bulk_operations\Service\ViewsbulkOperationsViewDataInterface.
    21 Class Drupal\views_bulk_operations\Commands\ViewsBulkOperationsCommands extends unknown class Drush\Commands\DrushCommands.
    ๐Ÿ’ก Learn more at https://phpstan.org/user-guide/discovering-symbols
    209 Access to an undefined property Drupal\views_bulk_operations\Commands\ViewsBulkOperationsCommands::$logger.
    223 Access to an undefined property Drupal\views_bulk_operations\Commands\ViewsBulkOperationsCommands::$logger.
    230 Access to an undefined property Drupal\views_bulk_operations\Commands\ViewsBulkOperationsCommands::$logger.
    233 Access to an undefined property Drupal\views_bulk_operations\Commands\ViewsBulkOperationsCommands::$logger.
    236 Access to an undefined property Drupal\views_bulk_operations\Commands\ViewsBulkOperationsCommands::$logger.
    273 Function dt not found.
    ๐Ÿ’ก Learn more at https://phpstan.org/user-guide/discovering-symbols
    277 Instantiated class Consolidation\OutputFormatters\StructuredData\RowsOfFields not found.
    ๐Ÿ’ก Learn more at https://phpstan.org/user-guide/discovering-symbols
    333 Function dt not found.
    ๐Ÿ’ก Learn more at https://phpstan.org/user-guide/discovering-symbols
    346 Call to static method logger() on an unknown class Drush\Drush.
    ๐Ÿ’ก Learn more at https://phpstan.org/user-guide/discovering-symbols
    ------ -----------------------------------------------------------------------------------------------------------------------------

    ------ -----------------------------------------------------------------------------------
    Line src/Controller/ViewsBulkOperationsController.php
    ------ -----------------------------------------------------------------------------------
    63 Unsafe usage of new static().
    ๐Ÿ’ก See: https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static
    ------ -----------------------------------------------------------------------------------

    ------ -----------------------------------------------------------------------------------
    Line src/Form/ConfigureAction.php
    ------ -----------------------------------------------------------------------------------
    59 Unsafe usage of new static().
    ๐Ÿ’ก See: https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static
    ------ -----------------------------------------------------------------------------------

    ------ -----------------------------------------------------------------------------------
    Line src/Form/ConfirmAction.php
    ------ -----------------------------------------------------------------------------------
    59 Unsafe usage of new static().
    ๐Ÿ’ก See: https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static
    ------ -----------------------------------------------------------------------------------

    ------ ---------------------------------------------------------------------------------------------------------------------------------------------
    Line src/Form/ViewsBulkOperationsFormTrait.php (in context of class
    Drupal\Tests\views_bulk_operations\FunctionalJavascript\ViewsBulkOperationsBulkFormTest)
    ------ ---------------------------------------------------------------------------------------------------------------------------------------------
    64 Access to an undefined property Drupal\Tests\views_bulk_operations\FunctionalJavascript\ViewsBulkOperationsBulkFormTest::$actionProcessor.
    81 Method Drupal\Tests\views_bulk_operations\FunctionalJavascript\ViewsBulkOperationsBulkFormTest::getSelectionInfoTitle() should return
    Drupal\Core\StringTranslation\TranslatableMarkup but return statement is missing.
    82 Call to an undefined method Drupal\Tests\views_bulk_operations\FunctionalJavascript\ViewsBulkOperationsBulkFormTest::t().
    82 Call to an undefined method Drupal\Tests\views_bulk_operations\FunctionalJavascript\ViewsBulkOperationsBulkFormTest::t().
    114 Call to an undefined method Drupal\Tests\views_bulk_operations\FunctionalJavascript\ViewsBulkOperationsBulkFormTest::t().
    120 Call to an undefined method Drupal\Tests\views_bulk_operations\FunctionalJavascript\ViewsBulkOperationsBulkFormTest::t().
    129 Call to an undefined method Drupal\Tests\views_bulk_operations\FunctionalJavascript\ViewsBulkOperationsBulkFormTest::t().
    195 Access to an undefined property Drupal\Tests\views_bulk_operations\FunctionalJavascript\ViewsBulkOperationsBulkFormTest::$tempStoreFactory.
    209 Call to an undefined method Drupal\Tests\views_bulk_operations\FunctionalJavascript\ViewsBulkOperationsBulkFormTest::currentUser().
    225 Call to an undefined method Drupal\Tests\views_bulk_operations\FunctionalJavascript\ViewsBulkOperationsBulkFormTest::currentUser().
    237 Call to an undefined method Drupal\Tests\views_bulk_operations\FunctionalJavascript\ViewsBulkOperationsBulkFormTest::currentUser().
    249 Call to an undefined method Drupal\Tests\views_bulk_operations\FunctionalJavascript\ViewsBulkOperationsBulkFormTest::t().
    267 Call to an undefined method Drupal\Tests\views_bulk_operations\FunctionalJavascript\ViewsBulkOperationsBulkFormTest::t().
    ------ ---------------------------------------------------------------------------------------------------------------------------------------------

    ------ -------------------------------------------------------------------------------------------------------------------------------
    Line src/Form/ViewsBulkOperationsFormTrait.php (in context of class Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess)
    ------ -------------------------------------------------------------------------------------------------------------------------------
    64 Access to an undefined property Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess::$actionProcessor.
    81 Method Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess::getSelectionInfoTitle() should return
    Drupal\Core\StringTranslation\TranslatableMarkup but return statement is missing.
    82 Call to an undefined method Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess::t().
    82 Call to an undefined method Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess::t().
    114 Call to an undefined method Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess::t().
    120 Call to an undefined method Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess::t().
    129 Call to an undefined method Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess::t().
    209 Call to an undefined method Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess::currentUser().
    225 Call to an undefined method Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess::currentUser().
    237 Call to an undefined method Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess::currentUser().
    249 Call to an undefined method Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess::t().
    267 Call to an undefined method Drupal\views_bulk_operations\Access\ViewsBulkOperationsAccess::t().
    ------ -------------------------------------------------------------------------------------------------------------------------------

    ------ ---------------------------------------------------------------------------------------------------------------------------------------
    Line src/Form/ViewsBulkOperationsFormTrait.php (in context of class Drupal\views_bulk_operations\Controller\ViewsBulkOperationsController)
    ------ ---------------------------------------------------------------------------------------------------------------------------------------
    81 Method Drupal\views_bulk_operations\Controller\ViewsBulkOperationsController::getSelectionInfoTitle() should return
    Drupal\Core\StringTranslation\TranslatableMarkup but return statement is missing.
    ------ ---------------------------------------------------------------------------------------------------------------------------------------

    ------ --------------------------------------------------------------------------------------------------------------------------------------------------
    Line src/Form/ViewsBulkOperationsFormTrait.php (in context of class Drupal\views_bulk_operations\Form\ConfigureAction)
    ------ --------------------------------------------------------------------------------------------------------------------------------------------------
    81 Method Drupal\views_bulk_operations\Form\ConfigureAction::getSelectionInfoTitle() should return Drupal\Core\StringTranslation\TranslatableMarkup
    but return statement is missing.
    ------ --------------------------------------------------------------------------------------------------------------------------------------------------

    ------ ----------------------------------------------------------------------------------------------------------------------------------------------------
    Line src/Form/ViewsBulkOperationsFormTrait.php (in context of class Drupal\views_bulk_operations\Form\ConfirmAction)
    ------ ----------------------------------------------------------------------------------------------------------------------------------------------------
    81 Method Drupal\views_bulk_operations\Form\ConfirmAction::getSelectionInfoTitle() should return Drupal\Core\StringTranslation\TranslatableMarkup but
    return statement is missing.
    ------ ----------------------------------------------------------------------------------------------------------------------------------------------------

    ------ ---------------------------------------------------------------------------------------------------------------------------------------------
    Line src/Form/ViewsBulkOperationsFormTrait.php (in context of class Drupal\views_bulk_operations\Plugin\views\field\ViewsBulkOperationsBulkForm)
    ------ ---------------------------------------------------------------------------------------------------------------------------------------------
    81 Method Drupal\views_bulk_operations\Plugin\views\field\ViewsBulkOperationsBulkForm::getSelectionInfoTitle() should return
    Drupal\Core\StringTranslation\TranslatableMarkup but return statement is missing.
    ------ ---------------------------------------------------------------------------------------------------------------------------------------------

    ------ -----------------------------------------------------------------------------------
    Line src/Plugin/Action/CancelUserAction.php
    ------ -----------------------------------------------------------------------------------
    75 Unsafe usage of new static().
    ๐Ÿ’ก See: https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static
    123 \Drupal calls should be avoided in classes, use dependency injection instead
    ------ -----------------------------------------------------------------------------------

    ------ ---------------------------------------------------------------------------------------------------------------------
    Line src/Plugin/views/field/ViewsBulkOperationsBulkForm.php
    ------ ---------------------------------------------------------------------------------------------------------------------
    21 Interface Drupal\views_bulk_operations\Service\ViewsBulkOperationsViewDataInterface referenced with incorrect case:
    Drupal\views_bulk_operations\Service\ViewsbulkOperationsViewDataInterface.
    140 Unsafe usage of new static().
    ๐Ÿ’ก See: https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static
    681 Undefined variable: $element
    898 Undefined variable: $action_id
    ------ ---------------------------------------------------------------------------------------------------------------------

    ------ ---------------------------------------------------------------------------------------------------------
    Line src/Service/ViewsBulkOperationsActionManager.php
    ------ ---------------------------------------------------------------------------------------------------------
    19 Plugin definitions cannot be altered.
    190 Call to static method mergeDeep() on an unknown class Drupal\views_bulk_operations\Service\NestedArray.
    ๐Ÿ’ก Learn more at https://phpstan.org/user-guide/discovering-symbols
    ------ ---------------------------------------------------------------------------------------------------------

    ------ ---------------------------------------------------------------------------------------------------------------------------
    Line tests/src/Functional/DrushCommandsTest.php
    ------ ---------------------------------------------------------------------------------------------------------------------------
    13 Class Drupal\Tests\views_bulk_operations\Functional\DrushCommandsTest uses unknown trait Drush\TestTraits\DrushTestTrait.
    ๐Ÿ’ก Learn more at https://phpstan.org/user-guide/discovering-symbols
    43 Access to an undefined property Drupal\Tests\views_bulk_operations\Functional\DrushCommandsTest::$testNodes.
    70 Call to an undefined method Drupal\Tests\views_bulk_operations\Functional\DrushCommandsTest::drush().
    72 Call to an undefined method Drupal\Tests\views_bulk_operations\Functional\DrushCommandsTest::getErrorOutput().
    76 Call to an undefined method Drupal\Tests\views_bulk_operations\Functional\DrushCommandsTest::drush().
    80 Call to an undefined method Drupal\Tests\views_bulk_operations\Functional\DrushCommandsTest::getErrorOutput().
    83 Call to an undefined method Drupal\Tests\views_bulk_operations\Functional\DrushCommandsTest::getErrorOutput().
    ------ ---------------------------------------------------------------------------------------------------------------------------

    ------ ----------------------------------------------------------------------------------------------------------------------------
    Line tests/src/Functional/ViewsBulkOperationsBulkFormTest.php
    ------ ----------------------------------------------------------------------------------------------------------------------------
    47 Access to an undefined property Drupal\Tests\views_bulk_operations\Functional\ViewsBulkOperationsBulkFormTest::$testNodes.
    101 Access to an undefined property Drupal\Tests\views_bulk_operations\Functional\ViewsBulkOperationsBulkFormTest::$testNodes.
    126 Access to an undefined property Drupal\Tests\views_bulk_operations\Functional\ViewsBulkOperationsBulkFormTest::$testNodes.
    146 Access to an undefined property Drupal\Tests\views_bulk_operations\Functional\ViewsBulkOperationsBulkFormTest::$testNodes.
    228 Access to an undefined property Drupal\Tests\views_bulk_operations\Functional\ViewsBulkOperationsBulkFormTest::$testNodes.
    ------ ----------------------------------------------------------------------------------------------------------------------------

    ------ ----------------------------------------------------------------------------------------------------------------------------------
    Line tests/src/Functional/ViewsBulkOperationsFunctionalTestBase.php
    ------ ----------------------------------------------------------------------------------------------------------------------------------
    40 Access to an undefined property Drupal\Tests\views_bulk_operations\Functional\ViewsBulkOperationsFunctionalTestBase::$testNodes.
    ------ ----------------------------------------------------------------------------------------------------------------------------------

    ------ ---------------------------------------------------------------------------------------------------------------------
    Line tests/src/Kernel/ViewsBulkOperationsKernelTestBase.php
    ------ ---------------------------------------------------------------------------------------------------------------------
    114 Access to an undefined property Drupal\Tests\views_bulk_operations\Kernel\ViewsBulkOperationsKernelTestBase::$time.
    145 Access to an undefined property Drupal\Tests\views_bulk_operations\Kernel\ViewsBulkOperationsKernelTestBase::$time.
    ------ ---------------------------------------------------------------------------------------------------------------------

    ------ ----------------------------------------------------------------------------------------------------------------------------
    Line tests/src/Unit/ViewsBulkOperationsBatchTest.php
    ------ ----------------------------------------------------------------------------------------------------------------------------
    38 Access to an undefined property Drupal\Tests\views_bulk_operations\Unit\ViewsBulkOperationsBatchTest::$container.
    41 Access to an undefined property Drupal\Tests\views_bulk_operations\Unit\ViewsBulkOperationsBatchTest::$translationManager.
    51 Access to an undefined property Drupal\Tests\views_bulk_operations\Unit\ViewsBulkOperationsBatchTest::$messenger.
    110 Access to an undefined property Drupal\Tests\views_bulk_operations\Unit\ViewsBulkOperationsBatchTest::$messenger.
    129 Access to an undefined property Drupal\Tests\views_bulk_operations\Unit\ViewsBulkOperationsBatchTest::$messenger.
    ------ ----------------------------------------------------------------------------------------------------------------------------

    ------ ----------------------------------------------------------------------------------------------
    Line tests/views_bulk_operations_test/src/Plugin/Action/ViewsBulkOperationsAdvancedTestAction.php
    ------ ----------------------------------------------------------------------------------------------
    53 \Drupal calls should be avoided in classes, use dependency injection instead
    ------ ----------------------------------------------------------------------------------------------

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

    The issue summary should always describe what the issue is trying to fix and, in the case, of coding standards issues, report which command has been used, which arguments have been used, and which report that command shown.

  • Assigned to imustakim
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia imustakim Ahmedabad

    working on this.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia imustakim Ahmedabad

    Created the patch for fixes.
    Please review.

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia imustakim Ahmedabad
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia imustakim Ahmedabad

    Patch updated.
    Please review.

  • Assigned to gg24
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia gg24
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Indra patil Bangalore
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Indra patil Bangalore
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ต๐Ÿ‡ฑPoland Graber

    The last patch failed so..

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia somesh1999

    I have run the phpcs and fixed some part of the code. Please check.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.0.7 + Environment: PHP 7.4 & MySQL 5.7
    last update about 1 year ago
    Composer require failure
  • ๐Ÿ‡ต๐Ÿ‡ฑPoland Graber

    Whatโ€™s the point of adding @var tags to a type hinted properties?

  • Issue was unassigned.
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • First commit to issue fork.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Shank115

    Fixed some of phpcs issues, please review

  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    @Shank115 thank you for you contribution, as I can see there are several patches already attached to the issue and in the branch **3318147-fix-phpcs-coding** these changes are not presented. Please add changes from patch #27.

    I suggest to continue with MR workflow, because it will be easy to review.

  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    I reviewed patch in #27, it only adds @var declaration for typed class properties may.

    Source: Drupal coding standards โ†’ .

    Typed class properties may omit the @var declaration.

    I suggest to skip patch #27.

    I execute comand on latest 4.2.x phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig views_bulk_operations/
    and was not able to find any violations.

    Changes suggested in 3318147-fix-phpcs-coding make sense for me, can you please create new MR?

  • Assigned to nitin_lama
  • Open on Drupal.org โ†’
    Core: 10.1.x + Environment: PHP 8.2 & MySQL 8
    last update 8 months ago
    Not currently mergeable.
  • @nitin_lama opened merge request.
  • Issue was unassigned.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama

    I believe this will require a rebase.

  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru
  • Assigned to zniki.ru
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.1.x + Environment: PHP 8.2 & MySQL 8
    last update 7 months ago
    15 pass
  • @znikiru opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review 7 months ago
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    IS updated, only one thing left to fix.
    Update branch 3318147-fix-phpcs-coding.
    And create MR.

  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    Hide all patch files.

Production build 0.69.0 2024