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.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

PrasadDeole created an issue. See original summary.

prasaddeole’s picture

StatusFileSize
new15.88 KB
prasaddeole’s picture

Assigned: prasaddeole » Unassigned
Status: Active » Needs review
graber’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#3323530: Coding Standards Issue | phpcs
graber’s picture

Status: Closed (duplicate) » Needs work
Related issues: -#3323530: Coding Standards Issue | phpcs
shefali99’s picture

Status: Needs work » Needs review
StatusFileSize
new1.34 KB

Fixed Coding Standards.

Status: Needs review » Needs work

The last submitted patch, 6: 3318147-6.patch, failed testing. View results

chaitanyadessai’s picture

Status: Needs work » Needs review
StatusFileSize
new2.47 KB

Fixed Coding Standards.

Status: Needs review » Needs work

The last submitted patch, 8: 3318147-8.patch, failed testing. View results

vishaljd made their first commit to this issue’s fork.

vishaljd’s picture

Assigned: Unassigned » vishaljd

vishaljd’s picture

Assigned: vishaljd » Unassigned
Status: Needs work » Needs review
rassoni’s picture

Status: Needs review » Needs work
------ ----------------------------------------------------------------------------------- 
  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                  
 ------ ---------------------------------------------------------------------------------------------- 
avpaderno’s picture

Title: Fix phpcs coding standards » Fix the issues reported by phpcs

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.

imustakim’s picture

Assigned: Unassigned » imustakim

working on this.

imustakim’s picture

Status: Needs work » Needs review
StatusFileSize
new13.51 KB

Created the patch for fixes.
Please review.

imustakim’s picture

Assigned: imustakim » Unassigned

Status: Needs review » Needs work

The last submitted patch, 17: 3318147-17.patch, failed testing. View results

avpaderno’s picture

imustakim’s picture

Status: Needs work » Needs review
StatusFileSize
new13.96 KB

Patch updated.
Please review.

Status: Needs review » Needs work

The last submitted patch, 21: 3318147-21.patch, failed testing. View results

gg24’s picture

Assigned: Unassigned » gg24
indrapatil’s picture

Issue summary: View changes
indrapatil’s picture

Status: Needs work » Needs review
Issue tags: -Needs issue summary update
graber’s picture

Status: Needs review » Needs work

The last patch failed so..

somesh1999’s picture

StatusFileSize
new14.88 KB

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

graber’s picture

What’s the point of adding @var tags to type hinted properties?

avpaderno’s picture

Assigned: gg24 » Unassigned

Shank115 made their first commit to this issue’s fork.

shank115’s picture

Fixed some of phpcs issues, please review

nikolay shapovalov’s picture

@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.

nikolay shapovalov’s picture

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 Merge Request?

nitin_lama’s picture

Assigned: Unassigned » nitin_lama

nitin_lama’s picture

Assigned: nitin_lama » Unassigned
nitin_lama’s picture

I believe this will require a rebase.

nikolay shapovalov’s picture

Issue tags: +Needs reroll
nikolay shapovalov’s picture

Assigned: Unassigned » nikolay shapovalov

nikolay shapovalov’s picture

Assigned: nikolay shapovalov » Unassigned
Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs reroll

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

nikolay shapovalov’s picture

Issue summary: View changes
nikolay shapovalov’s picture

Hide all patch files.

benstallings’s picture

Version: 4.2.x-dev » 4.3.x-dev

updating to point at latest version

benstallings’s picture

I'm confused - MR !76 is showing 0 changes.

graber’s picture

Status: Needs review » Closed (duplicate)

Indeed.
Closing in favor of #3549282: Improve module code quality checks and going for it.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.