Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase PHPStan level to 3 #6799

Open
Tabrisrp opened this issue Jul 18, 2024 · 0 comments · May be fixed by #6803
Open

Increase PHPStan level to 3 #6799

Tabrisrp opened this issue Jul 18, 2024 · 0 comments · May be fixed by #6803

Comments

@Tabrisrp
Copy link
Contributor

Tabrisrp commented Jul 18, 2024

Previous levels:

Once this is resolved, another issue should be created to bump the rule level again.

Initial report at level 3, Found 45 errors:

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   inc/Engine/Admin/API/Subscriber.php                                                                                                                          
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  17     Method WP_Rocket\Engine\Admin\API\Subscriber::get_subscribed_events() should return array<string> but returns array<string, array<int, int|string>|string>.  
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------- 
  Line   inc/Engine/Admin/Metaboxes/PostEditOptionsSubscriber.php  
 ------ ---------------------------------------------------------- 
  159    Invalid array key type bool\string.                       
  162    Invalid array key type bool\string.                       
  163    Invalid array key type bool\string.                       
 ------ ---------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   inc/Engine/Admin/Settings/Page.php                                                                                                                      
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- 
  144    Property WP_Rocket\Engine\Admin\Settings\Page::$render (WP_Rocket\Engine\Admin\Settings\Render) does not accept WP_Rocket\Interfaces\Render_Interface.  
  288    Method WP_Rocket\Engine\Admin\Settings\Page::customer_data() should return object but returns array<string, string|false>.                              
  303    Method WP_Rocket\Engine\Admin\Settings\Page::customer_data() should return object but returns array<string, bool|string>.                               
  2247   Method WP_Rocket\Engine\Admin\Settings\Page::display_update_notice() with return type void returns false but should not return anything.                
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------------------------------------- 
  Line   inc/Engine/Cache/PurgeExpired/PurgeExpiredCache.php                                                                 
 ------ -------------------------------------------------------------------------------------------------------------------- 
  365    Method WP_Rocket\Engine\Cache\PurgeExpired\PurgeExpiredCache::is_dir_empty() should return bool but returns array.  
 ------ -------------------------------------------------------------------------------------------------------------------- 

 ------ --------------------------------------------------------------------------------------------------------------------- 
  Line   inc/Engine/Common/Database/Tables/AbstractTable.php                                                                  
 ------ --------------------------------------------------------------------------------------------------------------------- 
  86     Method WP_Rocket\Engine\Common\Database\Tables\AbstractTable::get_old_rows() should return array but returns false.  
  93     Method WP_Rocket\Engine\Common\Database\Tables\AbstractTable::get_old_rows() should return array but returns false.  
 ------ --------------------------------------------------------------------------------------------------------------------- 

 ------ --------------------------------------------------------------------------------------------------------------------------- 
  Line   inc/Engine/Common/JobManager/Queue/Queue.php                                                                               
 ------ --------------------------------------------------------------------------------------------------------------------------- 
  57     Method WP_Rocket\Engine\Common\JobManager\Queue\Queue::schedule_pending_jobs_cron() should return string but returns int.  
 ------ --------------------------------------------------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   inc/Engine/Common/Queue/AbstractASQueue.php                                                                                                                                                                                  
 ------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  26     Return type (int) of method WP_Rocket\Engine\Common\Queue\AbstractASQueue::add_async() should be compatible with return type (string) of method WP_Rocket\Engine\Common\Queue\QueueInterface::add_async()                    
  48     Return type (int) of method WP_Rocket\Engine\Common\Queue\AbstractASQueue::schedule_single() should be compatible with return type (string) of method WP_Rocket\Engine\Common\Queue\QueueInterface::schedule_single()        
  67     Return type (int) of method WP_Rocket\Engine\Common\Queue\AbstractASQueue::schedule_recurring() should be compatible with return type (string) of method WP_Rocket\Engine\Common\Queue\QueueInterface::schedule_recurring()  
  80     Method WP_Rocket\Engine\Common\Queue\AbstractASQueue::schedule_recurring() should return int but returns string.                                                                                                             
  92     Method WP_Rocket\Engine\Common\Queue\AbstractASQueue::schedule_recurring() should return int but returns string.                                                                                                             
  148    Return type (int) of method WP_Rocket\Engine\Common\Queue\AbstractASQueue::schedule_cron() should be compatible with return type (string) of method WP_Rocket\Engine\Common\Queue\QueueInterface::schedule_cron()            
  150    Method WP_Rocket\Engine\Common\Queue\AbstractASQueue::schedule_cron() should return int but returns string.                                                                                                                  
 ------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   inc/Engine/Common/Queue/RUCSSQueueRunner.php                                                                                                                                          
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  168    Return type (void) of method WP_Rocket\Engine\Common\Queue\RUCSSQueueRunner::run() should be compatible with return type (int) of method ActionScheduler_Abstract_QueueRunner::run()  
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------- 
  Line   inc/Engine/CriticalPath/Admin/Post.php                                                           
 ------ ------------------------------------------------------------------------------------------------- 
  162    Property WP_Rocket\Engine\CriticalPath\Admin\Post::$disabled_data (array) does not accept null.  
 ------ ------------------------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------------------------------- 
  Line   inc/Engine/License/Renewal.php                                                                             
 ------ ----------------------------------------------------------------------------------------------------------- 
  406    Method WP_Rocket\Engine\License\Renewal::get_user_renewal_status() should return array but returns false.  
 ------ ----------------------------------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   inc/Engine/Media/Lazyload/CSS/Admin/Subscriber.php                                                                                             
 ------ ----------------------------------------------------------------------------------------------------------------------------------------------- 
  79     Method WP_Rocket\Engine\Media\Lazyload\CSS\Admin\Subscriber::add_option_safemode() should return array<string> but returns array<int|string>.  
 ------ ----------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------------------------------- 
  Line   inc/Engine/Optimization/CacheDynamicResource.php                                                              
 ------ -------------------------------------------------------------------------------------------------------------- 
  82     Property WP_Rocket\Engine\Optimization\CacheDynamicResource::$excluded_files (string) does not accept array.  
 ------ -------------------------------------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------------------------------------------------------- 
  Line   inc/Engine/Optimization/RUCSS/Admin/Subscriber.php                                                                                 
 ------ ----------------------------------------------------------------------------------------------------------------------------------- 
  509    Method WP_Rocket\Engine\Optimization\RUCSS\Admin\Subscriber::disable_russ_on_wrong_license() should return bool but returns null.  
 ------ ----------------------------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------ 
  Line   inc/Engine/Optimization/UrlTrait.php (in context of class WP_Rocket\Engine\Media\AboveTheFold\AJAX\Controller)          
 ------ ------------------------------------------------------------------------------------------------------------------------ 
  122    Method WP_Rocket\Engine\Media\AboveTheFold\AJAX\Controller::get_file_content() should return string but returns false.  
 ------ ------------------------------------------------------------------------------------------------------------------------ 

 ------ ---------------------------------------------------------------------------------------------------------------------------- 
  Line   inc/Engine/Optimization/UrlTrait.php (in context of class WP_Rocket\Engine\Media\AboveTheFold\Frontend\Controller)          
 ------ ---------------------------------------------------------------------------------------------------------------------------- 
  122    Method WP_Rocket\Engine\Media\AboveTheFold\Frontend\Controller::get_file_content() should return string but returns false.  
 ------ ---------------------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------ 
  Line   inc/Engine/Optimization/UrlTrait.php (in context of class WP_Rocket\Engine\Media\Lazyload\CSS\Front\Extractor)          
 ------ ------------------------------------------------------------------------------------------------------------------------ 
  122    Method WP_Rocket\Engine\Media\Lazyload\CSS\Front\Extractor::get_file_content() should return string but returns false.  
 ------ ------------------------------------------------------------------------------------------------------------------------ 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   inc/Engine/Preload/Controller/Queue.php                                                                                                   
 ------ ------------------------------------------------------------------------------------------------------------------------------------------ 
  24     Method WP_Rocket\Engine\Preload\Controller\Queue::add_job_preload_job_load_initial_sitemap_async() should return string but returns int.  
  35     Method WP_Rocket\Engine\Preload\Controller\Queue::add_job_preload_job_parse_sitemap_async() should return string but returns int.         
  51     Method WP_Rocket\Engine\Preload\Controller\Queue::add_job_preload_job_preload_url_async() should return string but returns int.           
  71     Method WP_Rocket\Engine\Preload\Controller\Queue::add_job_preload_job_check_finished_async() should return string but returns int.        
 ------ ------------------------------------------------------------------------------------------------------------------------------------------ 

 ------ -------------------------------------------------------------------------------------------------------------------------------- 
  Line   inc/Engine/Preload/Fonts.php                                                                                                    
 ------ -------------------------------------------------------------------------------------------------------------------------------- 
  42     Property WP_Rocket\Engine\Preload\Fonts::$font_formats (bool|string) does not accept default value of type array<int, string>.  
 ------ -------------------------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   inc/Engine/Preload/Links/Subscriber.php                                                                                                               
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------ 
  160    Method WP_Rocket\Engine\Preload\Links\Subscriber::get_preload_links_config() should return array<string> but returns array<string, bool|int|string>.  
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------ 

 ------ -------------------------------------------------------------------------------------------------------------------------- 
  Line   inc/ThirdParty/Plugins/Security/WordFenceCompatibility.php                                                                
 ------ -------------------------------------------------------------------------------------------------------------------------- 
  97     Method WP_Rocket\ThirdParty\Plugins\Security\WordFenceCompatibility::can_pop_ip() should return array but returns false.  
 ------ -------------------------------------------------------------------------------------------------------------------------- 

 ------ ---------------------------------------------- 
  Line   inc/ThirdParty/Themes/Avada.php               
 ------ ---------------------------------------------- 
  70     Offset 'lazy_load' does not exist on string.  
 ------ ---------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   inc/ThirdParty/Themes/SubscriberFactory.php                                                                                                                                                                                                                        
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  14     Return type (array) of method WP_Rocket\ThirdParty\Themes\SubscriberFactory::get_subscriber() should be compatible with return type (WP_Rocket\Event_Management\Subscriber_Interface) of method WP_Rocket\ThirdParty\SubscriberFactoryInterface::get_subscriber()  
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   tests/Integration/ASTrait.php (in context of class WP_Rocket\Tests\Integration\inc\Engine\Preload\Frontend\Subscriber\Test_ParseSitemap)                    
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  10     Method WP_Rocket\Tests\Integration\inc\Engine\Preload\Frontend\Subscriber\Test_ParseSitemap::countTasks() should return int but returns array|string|null.  
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------ 

 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   tests/Integration/ASTrait.php (in context of class WP_Rocket\Tests\Integration\inc\Engine\Preload\Frontend\Subscriber\Test_PreloadUrl)                    
 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------- 
  10     Method WP_Rocket\Tests\Integration\inc\Engine\Preload\Frontend\Subscriber\Test_PreloadUrl::countTasks() should return int but returns array|string|null.  
 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ --------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   tests/Integration/ASTrait.php (in context of class WP_Rocket\Tests\Integration\inc\Engine\Preload\Subscriber\Test_LoadInitialSitemap)                    
 ------ --------------------------------------------------------------------------------------------------------------------------------------------------------- 
  10     Method WP_Rocket\Tests\Integration\inc\Engine\Preload\Subscriber\Test_LoadInitialSitemap::countTasks() should return int but returns array|string|null.  
 ------ --------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------- 
  Line   tests/Integration/AjaxTestCase.php                                                         
 ------ ------------------------------------------------------------------------------------------- 
  75     Property WPMedia\PHPUnit\Integration\AjaxTestCase::$action (string) does not accept null.  
 ------ ------------------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------- 
  Line   tests/Unit/inc/Engine/CriticalPath/RESTWPPost/delete.php  
 ------ ---------------------------------------------------------- 
  98     Cannot assign offset 'id' to WP_REST_Request<array>.      
 ------ ---------------------------------------------------------- 

 ------ ------------------------------------------------------------- 
  Line   tests/Unit/inc/Engine/CriticalPath/RESTWPPost/generate.php   
 ------ ------------------------------------------------------------- 
  222    Cannot assign offset 'id' to WP_REST_Request<array>.         
  223    Cannot assign offset 'is_mobile' to WP_REST_Request<array>.  
  226    Cannot assign offset 'timeout' to WP_REST_Request<array>.    
 ------ ------------------------------------------------------------- 
@Tabrisrp Tabrisrp linked a pull request Jul 19, 2024 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant