Issues reported by PHPStan

Created on 6 November 2023, about 1 year ago

Problem/Motivation

Steps to reproduce

$ php vendor/bin/phpstan analyze $_WEB_ROOT/modules/custom/$CI_PROJECT_NAME $PHPSTAN_CONFIGURATION --no-progress || EXIT_CODE=$?
 ------ ------------------------------------------------------------------------------ 
  Line   modules/message_notify_ui/src/Form/MessageNotifyForm.php                      
 ------ ------------------------------------------------------------------------------ 
  125    Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------------------------------------------ 
  Line   modules/message_notify_ui/src/Plugin/MessageNotifyUiSenderSettingsForm/MessageNotifyUiSenderMailSettingsForm.php  
 ------ ------------------------------------------------------------------------------------------------------------------ 
  70     \Drupal calls should be avoided in classes, use dependency injection                                              
         instead                                                                                                           
 ------ ------------------------------------------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------------------------------------- 
  Line   modules/message_notify_ui/src/Plugin/MessageUiViewsContextualLinks/MessageUiContextualLinkNotifyMessage.php  
 ------ ------------------------------------------------------------------------------------------------------------- 
  81     Unsafe usage of new static().                                                                                
         💡 See:                                                                                                      
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static                                 
 ------ ------------------------------------------------------------------------------------------------------------- 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Controller/MessageController.php                                          
 ------ ------------------------------------------------------------------------------ 
  45     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Form/DeleteMultiple.php                                                   
 ------ ------------------------------------------------------------------------------ 
  104    Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ------------------------------------------------------------------------------ 
  Line   src/Form/MessageMultipleDeleteForm.php                                        
 ------ ------------------------------------------------------------------------------ 
  49     Unsafe usage of new static().                                                 
         💡 See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 ------ ---------------------------------------------------------------------- 
  Line   src/MessageAccessControlHandler.php                                   
 ------ ---------------------------------------------------------------------- 
  79     \Drupal calls should be avoided in classes, use dependency injection  
         instead                                                               
 ------ ---------------------------------------------------------------------- 
 ------ --------------------------------------------------------------------- 
  Line   src/MessageUiViewsContextualLinksBase.php                            
 ------ --------------------------------------------------------------------- 
  24     Method                                                               
         Drupal\message_ui\MessageUiViewsContextualLinksBase::setMessage()    
         should return                                                        
         Drupal\message_ui\MessageUiViewsContextualLinksInterface but return  
         statement is missing.                                                
 ------ --------------------------------------------------------------------- 
 ------ ----------------------------------------------------------------------------------- 
  Line   src/Plugin/MessageUiViewsContextualLinks/MessageUiContextualLinkDeleteMessage.php  
 ------ ----------------------------------------------------------------------------------- 
  70     Unsafe usage of new static().                                                      
         💡 See:                                                                            
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static       
 ------ ----------------------------------------------------------------------------------- 
 ------ --------------------------------------------------------------------------------- 
  Line   src/Plugin/MessageUiViewsContextualLinks/MessageUiContextualLinkEditMessage.php  
 ------ --------------------------------------------------------------------------------- 
  70     Unsafe usage of new static().                                                    
         💡 See:                                                                          
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static     
 ------ --------------------------------------------------------------------------------- 
 ------ --------------------------------------------------------------------------------- 
  Line   src/Plugin/MessageUiViewsContextualLinks/MessageUiContextualLinkViewMessage.php  
 ------ --------------------------------------------------------------------------------- 
  70     Unsafe usage of new static().                                                    
         💡 See:                                                                          
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static     
 ------ --------------------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   src/Plugin/QueueWorker/MessageArgumentsWorker.php                     
 ------ ---------------------------------------------------------------------- 
  27     \Drupal calls should be avoided in classes, use dependency injection  
         instead                                                               
  50     \Drupal calls should be avoided in classes, use dependency injection  
         instead                                                               
 ------ ---------------------------------------------------------------------- 
 ------ ---------------------------------------------------------------------- 
  Line   src/Plugin/views/field/MessageUIContextualLinks.php                   
 ------ ---------------------------------------------------------------------- 
  36     \Drupal calls should be avoided in classes, use dependency injection  
         instead                                                               
 ------ ---------------------------------------------------------------------- 
 [ERROR] Found 14 errors 

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇺🇸United States bluegeek9

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024