Fix new issues reported by PHPStan after extra rules

Created on 17 April 2024, 12 months ago
Updated 1 May 2024, 12 months ago

Problem/Motivation

After adding 📌 Add extra PHPStan rules Fixed , PHPStan reports extra issues which is good. But we need to solve them.
See https://git.drupalcode.org/project/domain_menu_access/-/jobs/1348415

 ------ --------------------------------------------------------------- 
  Line   domain_menu_access.install                                     
 ------ --------------------------------------------------------------- 
  66     Construct empty() is not allowed. Use more strict comparison.  
 ------ --------------------------------------------------------------- 
 ------ --------------------------------------------------------------- 
  Line   domain_menu_access.module                                      
 ------ --------------------------------------------------------------- 
  35     Call to function in_array() requires parameter #3 to be set.   
  35     Construct empty() is not allowed. Use more strict comparison.  
  81     Construct empty() is not allowed. Use more strict comparison.  
  101    Call to function in_array() requires parameter #3 to be set.   
  101    Construct empty() is not allowed. Use more strict comparison.  
 ------ --------------------------------------------------------------- 
 ------ ------------------------------------------------------------------------------------------ 
  Line   modules/domain_menu_access_menu_block/src/Plugin/Block/DomainMenuAccessMenuMenuBlock.php  
 ------ ------------------------------------------------------------------------------------------ 
  121    Loose comparison via "==" is not allowed.                                                 
         💡 Use strict comparison via "===" instead.                                               
  148    Construct empty() is not allowed. Use more strict comparison.                             
  185    Construct empty() is not allowed. Use more strict comparison.                             
  190    Short ternary operator is not allowed. Use null coalesce operator if                      
         applicable or consider using long ternary.                                                
  196    Construct empty() is not allowed. Use more strict comparison.                             
  229    Call to function in_array() requires parameter #3 to be set.                              
 ------ ------------------------------------------------------------------------------------------ 
 ------ --------------------------------------------------------------- 
  Line   src/Form/DomainMenuAccessSettingsForm.php                      
 ------ --------------------------------------------------------------- 
  67     Only booleans are allowed in a negated boolean, mixed given.   
  72     Construct empty() is not allowed. Use more strict comparison.  
  86     Call to function in_array() requires parameter #3 to be set.   
  101    Construct empty() is not allowed. Use more strict comparison.  
  101    Construct empty() is not allowed. Use more strict comparison.  
  105    Call to function in_array() requires parameter #3 to be set.   
 ------ --------------------------------------------------------------- 
 ------ --------------------------------------------------------------- 
  Line   src/Menu/DomainMenuLinkTreeManipulators.php                    
 ------ --------------------------------------------------------------- 
  137    Call to function in_array() requires parameter #3 to be set.   
  164    Construct empty() is not allowed. Use more strict comparison.  
  180    Construct empty() is not allowed. Use more strict comparison.  
 ------ --------------------------------------------------------------- 
 ------ -------------------------------------------------------------- 
  Line   src/Plugin/Block/DomainMenuAccessMenuBlock.php                
 ------ -------------------------------------------------------------- 
  126    Call to function in_array() requires parameter #3 to be set.  
 ------ -------------------------------------------------------------- 
 ------ -------------------------------------------------------------- 
  Line   src/Plugin/Derivative/DomainMenuAccessMenuBlock.php           
 ------ -------------------------------------------------------------- 
  55     Call to function in_array() requires parameter #3 to be set.  
 ------ -------------------------------------------------------------- 
 [ERROR] Found 23 errors       

Steps to reproduce

Run PHPStan

Proposed resolution

Fix issues

Remaining tasks

Create MR

User interface changes

-

API changes

-

Data model changes

-

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇧🇪Belgium tim-diels Belgium 🇧🇪

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