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

Update PHPStan level to 7 #1205

Merged
merged 20 commits into from
May 10, 2024
Merged

Update PHPStan level to 7 #1205

merged 20 commits into from
May 10, 2024

Conversation

westonruter
Copy link
Member

@westonruter westonruter commented May 7, 2024

See #775.

This addresses the following PHPStan issues:

[ERROR] Found 512 errors
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   includes/admin/plugins.php                                                                                                                                                                                                                                         
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  63     Function perflab_query_plugin_info() should return array{name: string, slug: string, short_description: string, requires: string|false, requires_php: string|false, requires_plugins: array<string>, download_link: string, version: string}|WP_Error but returns  
         non-empty-array.                                                                                                                                                                                                                                                   
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   includes/server-timing/class-perflab-server-timing.php                                                                                                                                    
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  99     Property Perflab_Server_Timing::$registered_metrics_data (array<string, array{measure_callback: callable(): mixed, access_cap: string}>) does not accept non-empty-array<string, array>.  
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 

 ------ --------------------------------------------------------------------------------------------------------------- 
  Line   includes/server-timing/defaults.php                                                                            
 ------ --------------------------------------------------------------------------------------------------------------- 
  153    Parameter #2 $callback of function add_action expects callable(): mixed, array{mixed, 'measure_after'} given.  
 ------ --------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   includes/server-timing/load.php                                                                                                                                                                       
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  230    Function perflab_sanitize_server_timing_setting() should return array{benchmarking_actions: array<string>, benchmarking_filters: array<string>, output_buffering: bool} but returns non-empty-array.  
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 

 ------ ------------------------------------------------------------------------------------------------------------------- 
  Line   includes/site-health/audit-enqueued-assets/helper.php                                                              
 ------ ------------------------------------------------------------------------------------------------------------------- 
  51     Parameter #1 $bytes of function size_format expects int|string, int|false given.                                   
  92     Parameter #1 $bytes of function size_format expects int|string, int|false given.                                   
  145    Parameter #1 $bytes of function size_format expects int|string, int|false given.                                   
  185    Parameter #1 $bytes of function size_format expects int|string, int|false given.                                   
  235    Function perflab_aea_get_total_size_bytes_enqueued_scripts() should return int|false but returns float|int|false.  
  270    Function perflab_aea_get_total_size_bytes_enqueued_styles() should return int|false but returns float|int|false.   
 ------ ------------------------------------------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------------------- 
  Line   plugins/dominant-color-images/class-dominant-color-image-editor-gd.php                         
 ------ ----------------------------------------------------------------------------------------------- 
  35     Parameter #1 $dst_im of function imagecopyresampled expects resource, resource|false given.    
  35     Parameter #1 $im of function imagesx expects resource, GdImage|resource given.                 
  35     Parameter #1 $im of function imagesy expects resource, GdImage|resource given.                 
  35     Parameter #10 $src_h of function imagecopyresampled expects int, int|false given.              
  35     Parameter #2 $src_im of function imagecopyresampled expects resource, GdImage|resource given.  
  35     Parameter #9 $src_w of function imagecopyresampled expects int, int|false given.               
  37     Parameter #1 $im of function imagecolorat expects resource, resource|false given.              
  65     Parameter #1 $im of function imagesx expects resource, GdImage|resource given.                 
  66     Parameter #1 $im of function imagesy expects resource, GdImage|resource given.                 
  69     Parameter #1 $im of function imagecolorat expects resource, GdImage|resource given.            
  70     Parameter #1 $im of function imagecolorsforindex expects resource, GdImage|resource given.     
  70     Parameter #2 $col of function imagecolorsforindex expects int, int|false given.                
  71     Cannot access offset 'alpha' on array|false.                                                   
 ------ ----------------------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------------- 
  Line   plugins/dominant-color-images/helper.php                                                 
 ------ ----------------------------------------------------------------------------------------- 
  69     Parameter #1 $path of function wp_get_image_editor expects string, string|false given.   
  123    Parameter #1 $path of function wp_basename expects string, string|false given.           
  123    Parameter #3 $subject of function str_replace expects array|string, string|false given.  
 ------ ----------------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------------------------- 
  Line   plugins/embed-optimizer/hooks.php                                                       
 ------ ---------------------------------------------------------------------------------------- 
  87     Parameter #3 $subject of function str_replace expects array|string, string|true given.  
 ------ ---------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------ 
  Line   plugins/optimization-detective/class-od-html-tag-walker.php                   
 ------ ------------------------------------------------------------------------------ 
  223    Parameter #2 $offset of function array_splice expects int, int|string given.  
 ------ ------------------------------------------------------------------------------ 

 ------ ---------------------------------------------------------------------------------------------------------------------------------------- 
  Line   plugins/optimization-detective/class-od-url-metrics-group-collection.php                                                                
 ------ ---------------------------------------------------------------------------------------------------------------------------------------- 
  96     Property OD_URL_Metrics_Group_Collection::$breakpoints (array<int<1, max>>) does not accept list<int>.                                  
  127    Property OD_URL_Metrics_Group_Collection::$groups (non-empty-array<OD_URL_Metrics_Group>) does not accept array<OD_URL_Metrics_Group>.  
         💡 array<OD_URL_Metrics_Group> might be empty.                                                                                          
 ------ ---------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   plugins/optimization-detective/optimization.php                                                                                                                                                                                                                   
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  198    Cannot access offset 0 on list<string>|false.                                                                                                                                                                                                                     
  198    Parameter #1 $var of function count expects array|Countable, array<int, string>|false given.                                                                                                                                                                      
  282    Parameter #1 $haystack of function str_starts_with expects string, string|true given.                                                                                                                                                                             
  298    Parameter #2 $subject of function preg_match expects string, string|true given.                                                                                                                                                                                   
  350    Cannot access offset 'img_attributes' on array{background_image?: non-falsy-string, xpath: string, img_attributes?: array<'crossorigin'|'sizes'|'src'|'srcset', string|true>}|false.                                                                              
  354    Cannot access offset 'background_image' on array{background_image?: non-falsy-string, xpath: string, img_attributes?: array<'crossorigin'|'sizes'|'src'|'srcset', string|true>}|false.                                                                            
  375    Parameter #1 $lcp_elements_by_minimum_viewport_widths of function od_construct_preload_links expects array<int, array{background_image?: string, img_attributes?: array{src?: string, srcset?: string, sizes?: string, crossorigin?: string}}|false>, array<int,  
         array{background_image?: non-falsy-string, xpath: string, img_attributes?: array<'crossorigin'|'sizes'|'src'|'srcset', string|true>}|false> given.                                                                                                                
         💡 Type #1 from the union: Offset 'img_attributes' (array{src?: string, srcset?: string, sizes?: string, crossorigin?: string}) does not accept type array<'crossorigin'|'sizes'|'src'|'srcset', string|true>.                                                    
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 

 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   plugins/optimization-detective/storage/class-od-url-metrics-post-type.php                                                                                                                                                                                                   
 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  157    Parameter #1 $data of class OD_URL_Metric constructor expects array{url: string, timestamp: float, viewport: array{width: int, height: int}, elements: array<array{isLCP: bool, isLCPCandidate: bool, xpath: string, intersectionRatio: float, intersectionRect:            
         array{width: int, height: int}, boundingClientRect: array{width: int, height: int}}>}, array given.                                                                                                                                                                         
  239    Parameter #1 $postarr of function wp_update_post expects array{ID?: int, post_author?: int, post_date?: string, post_date_gmt?: string, post_content?: string, post_content_filtered?: string, post_title?: string, post_excerpt?: string, ...}, array{post_title: string,  
         ID?: int, post_name: string, post_content: string|false, post_type: 'od_url_metrics', post_status: 'publish'} given.                                                                                                                                                        
         💡 Offset 'post_content' (string) does not accept type string|false.                                                                                                                                                                                                        
  241    Parameter #1 $postarr of function wp_insert_post expects array{ID?: int, post_author?: int, post_date?: string, post_date_gmt?: string, post_content?: string, post_content_filtered?: string, post_title?: string, post_excerpt?: string, ...}, array{post_title: string,  
         ID?: int, post_name: string, post_content: string|false, post_type: 'od_url_metrics', post_status: 'publish'} given.                                                                                                                                                        
         💡 Offset 'post_content' (string) does not accept type string|false.                                                                                                                                                                                                        
  293    Cannot access property $post_type on int|WP_Post.                                                                                                                                                                                                                           
  294    Cannot access property $ID on int|WP_Post.                                                                                                                                                                                                                                  
 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   plugins/optimization-detective/storage/data.php                        
 ------ ----------------------------------------------------------------------- 
  140    Parameter #1 $str of function md5 expects string, string|false given.  
 ------ ----------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   plugins/optimization-detective/storage/rest-api.php                                                                                                                                                                                                               
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  133    Parameter #1 $data of class OD_URL_Metric constructor expects array{url: string, timestamp: float, viewport: array{width: int, height: int}, elements: array<array{isLCP: bool, isLCPCandidate: bool, xpath: string, intersectionRatio: float, intersectionRect:  
         array{width: int, height: int}, boundingClientRect: array{width: int, height: int}}>}, non-empty-array given.                                                                                                                                                     
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 

 ------ ------------------------------------------------------------------------------------------ 
  Line   plugins/speculation-rules/class-plsr-url-pattern-prefixer.php                             
 ------ ------------------------------------------------------------------------------------------ 
  110    Parameter #1 $value of function trailingslashit expects string, string|false|null given.  
  111    Parameter #1 $value of function trailingslashit expects string, string|false|null given.  
  112    Parameter #1 $value of function trailingslashit expects string, string|false|null given.  
  113    Parameter #1 $value of function trailingslashit expects string, string|false|null given.  
  114    Parameter #1 $value of function trailingslashit expects string, string|false|null given.  
  115    Parameter #1 $value of function trailingslashit expects string, string|false|null given.  
  116    Parameter #1 $value of function trailingslashit expects string, string|false|null given.  
 ------ ------------------------------------------------------------------------------------------ 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   plugins/speculation-rules/helper.php                                                                                                       
 ------ ------------------------------------------------------------------------------------------------------------------------------------------- 
  124    Function plsr_get_speculation_rules() should return array<string, mixed> but returns array<int|string, array<int, array<string, mixed>>>.  
 ------ ------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------------------- 
  Line   plugins/speculation-rules/hooks.php                                                            
 ------ ----------------------------------------------------------------------------------------------- 
  30     Parameter #1 $version1 of function version_compare expects string, string|false given.         
  31     Parameter #1 $version1 of function version_compare expects string, string|false given.         
  39     Parameter #1 $data of function wp_print_inline_script_tag expects string, string|false given.  
 ------ ----------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------ 
  Line   plugins/speculation-rules/settings.php                                                                
 ------ ------------------------------------------------------------------------------------------------------ 
  210    Parameter #1 $function of function call_user_func expects callable(): mixed, non-falsy-string given.  
 ------ ------------------------------------------------------------------------------------------------------ 

 ------ ---------------------------------------------------------------------------------------- 
  Line   plugins/webp-uploads/helper.php                                                         
 ------ ---------------------------------------------------------------------------------------- 
  122    Offset 'path' might not exist on array{file: non-falsy-string, path?: string}.          
  136    Parameter #1 $filename of function file_exists expects string, string|false given.      
  140    Parameter #1 $path of function wp_get_image_editor expects string, string|false given.  
  161    Parameter #1 $path of function pathinfo expects string, string|false given.             
 ------ ---------------------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   plugins/webp-uploads/hooks.php                                                                                                                                                                                                                                            
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  51     Function webp_uploads_create_sources_property() should return array{width: int, height: int, file: non-falsy-string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>,  
         image_meta: array<string, mixed>, filesize: int, sources?: array<string, array{file: string, filesize: int}>} but returns array<string, mixed>.                                                                                                                           
  56     Parameter #1 $filename of function file_exists expects string, string|false given.                                                                                                                                                                                        
  57     Function webp_uploads_create_sources_property() should return array{width: int, height: int, file: non-falsy-string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>,  
         image_meta: array<string, mixed>, filesize: int, sources?: array<string, array{file: string, filesize: int}>} but returns array<string, mixed>.                                                                                                                           
  67     Parameter #1 $path of function wp_basename expects string, string|false given.                                                                                                                                                                                            
  68     Parameter #1 $path of function wp_filesize expects string, string|false given.                                                                                                                                                                                            
  79     Parameter #1 $path of function pathinfo expects string, string|false given.                                                                                                                                                                                               
  80     Parameter #1 $path of function pathinfo expects string, string|false given.                                                                                                                                                                                               
  81     Parameter #1 $path of function pathinfo expects string, string|false given.                                                                                                                                                                                               
  125    Parameter #2 $mimes of function wp_check_filetype expects array<string>|null, array<bool|string> given.                                                                                                                                                                   
  138    Parameter #1 $file of function wp_delete_file_from_directory expects string, string|false given.                                                                                                                                                                          
  142    Parameter #2 $original_file of function _wp_image_meta_replace_original expects string, string|false given.                                                                                                                                                               
  153    Function webp_uploads_create_sources_property() should return array{width: int, height: int, file: non-falsy-string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>,  
         image_meta: array<string, mixed>, filesize: int, sources?: array<string, array{file: string, filesize: int}>} but returns array.                                                                                                                                          
  221    Function webp_uploads_create_sources_property() should return array{width: int, height: int, file: non-falsy-string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>,  
         image_meta: array<string, mixed>, filesize: int, sources?: array<string, array{file: string, filesize: int}>} but returns array.                                                                                                                                          
  719    Parameter #3 $subject of function preg_replace expects array|string, string|false given.                                                                                                                                                                                  
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   plugins/webp-uploads/image-edit.php                                                                                                                                                                                                                                           
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  101    Function webp_uploads_update_sources() should return array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta:             
         array<string, mixed>, filesize: int, sources: array<string, array{file: string, filesize: int}>} but returns array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string,        
         array{file: string, filesize: int}>}>, image_meta: array<string, mixed>, filesize: int, sources?: non-empty-array<string, array{file: string, filesize: int}>}.                                                                                                               
         💡 Array might not have offset 'sources'.                                                                                                                                                                                                                                     
  194    Call to an undefined static method WP_Error|WP_Image_Editor::supports_mime_type().                                                                                                                                                                                            
  232    Call to an undefined method WP_Error|WP_Image_Editor::save().                                                                                                                                                                                                                 
  240    Call to an undefined method WP_Error|WP_Image_Editor::multi_resize().                                                                                                                                                                                                         
  293    Function webp_uploads_update_attachment_metadata() should return array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>,             
         image_meta: array<string, mixed>, filesize: int, original_image: string} but returns array<string, mixed>.                                                                                                                                                                    
  325    Function webp_uploads_backup_sources() should return array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string}>, image_meta: array<string, mixed>, filesize: int, original_image: string} but         
         returns array<string, mixed>.                                                                                                                                                                                                                                                 
  331    Function webp_uploads_backup_sources() should return array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string}>, image_meta: array<string, mixed>, filesize: int, original_image: string} but         
         returns array<string, mixed>.                                                                                                                                                                                                                                                 
  364    Function webp_uploads_backup_sources() should return array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string}>, image_meta: array<string, mixed>, filesize: int, original_image: string} but         
         returns array<string, mixed>.                                                                                                                                                                                                                                                 
  457    Function webp_uploads_restore_image() should return array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string}>, image_meta: array<string, mixed>, filesize: int, original_image: string} but returns  
         array<string, mixed>.                                                                                                                                                                                                                                                         
  464    Function webp_uploads_restore_image() should return array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string}>, image_meta: array<string, mixed>, filesize: int, original_image: string} but returns  
         non-empty-array<string, mixed>.                                                                                                                                                                                                                                               
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 

 ------ ---------------------------------------------------------------------------------------------------------------------- 
  Line   plugins/webp-uploads/rest-api.php                                                                                     
 ------ ---------------------------------------------------------------------------------------------------------------------- 
  52     Function webp_uploads_update_rest_attachment() should return WP_REST_Response but returns WP_Error|WP_REST_Response.  
 ------ ---------------------------------------------------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------------------------------------------------- 
  Line   tests/includes/admin/load-tests.php                                                                                             
 ------ -------------------------------------------------------------------------------------------------------------------------------- 
  39     Parameter #1 $id of function wp_set_current_user expects int|null, int|WP_Error given.                                          
  58     Parameter #2 $haystack of method PHPUnit\Framework\Assert::assertStringContainsString() expects string, string|false given.     
  59     Parameter #2 $haystack of method PHPUnit\Framework\Assert::assertStringNotContainsString() expects string, string|false given.  
 ------ -------------------------------------------------------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------------------------------------------------- 
  Line   tests/includes/admin/server-timing-tests.php                                                                                 
 ------ ----------------------------------------------------------------------------------------------------------------------------- 
  26     Parameter #1 $id of function wp_set_current_user expects int|null, int|WP_Error given.                                       
  86     Parameter #2 $haystack of method PHPUnit\Framework\Assert::assertStringContainsString() expects string, string|false given.  
  87     Parameter #2 $haystack of method PHPUnit\Framework\Assert::assertStringContainsString() expects string, string|false given.  
  97     Parameter #2 $haystack of method PHPUnit\Framework\Assert::assertStringContainsString() expects string, string|false given.  
  98     Parameter #2 $haystack of method PHPUnit\Framework\Assert::assertStringContainsString() expects string, string|false given.  
  99     Parameter #2 $haystack of method PHPUnit\Framework\Assert::assertStringContainsString() expects string, string|false given.  
  109    Parameter #2 $haystack of method PHPUnit\Framework\Assert::assertStringContainsString() expects string, string|false given.  
  123    Parameter #2 $haystack of method PHPUnit\Framework\Assert::assertStringContainsString() expects string, string|false given.  
 ------ ----------------------------------------------------------------------------------------------------------------------------- 

 ------ --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   tests/includes/server-timing/perflab-server-timing-tests.php                                                                                                               
 ------ --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  30     Static property Perflab_Server_Timing_Tests::$admin_id (int) does not accept int|WP_Error.                                                                                 
  92     Parameter #2 $args of method Perflab_Server_Timing::register_metric() expects array{measure_callback: callable(): mixed, access_cap: string}, array<string, mixed> given.  
  93     Parameter #2 $args of method Perflab_Server_Timing::register_metric() expects array{measure_callback: callable(): mixed, access_cap: string}, array<string, mixed> given.  
  101    Parameter #2 $args of method Perflab_Server_Timing::register_metric() expects array{measure_callback: callable(): mixed, access_cap: string}, array<string, mixed> given.  
  103    Parameter #2 $args of method Perflab_Server_Timing::register_metric() expects array{measure_callback: callable(): mixed, access_cap: string}, array<string, mixed> given.  
  136    Parameter #2 $args of method Perflab_Server_Timing::register_metric() expects array{measure_callback: callable(): mixed, access_cap: string}, array<string, mixed> given.  
 ------ --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------------------------- 
  Line   tests/includes/site-health/audit-autoloaded-options/audit-autoloaded-options-test.php   
 ------ ---------------------------------------------------------------------------------------- 
  91     Parameter #1 $id of function wp_set_current_user expects int|null, int|WP_Error given.  
 ------ ---------------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------------------------------------------------- 
  Line   tests/load-tests.php                                                                                                         
 ------ ----------------------------------------------------------------------------------------------------------------------------- 
  25     Parameter #2 $haystack of method PHPUnit\Framework\Assert::assertStringContainsString() expects string, string|false given.  
  87     Parameter #3 $subject of function preg_replace expects array|string, string|false given.                                     
  117    Parameter #2 $subject of function preg_match expects string, string|false given.                                             
  158    Parameter #2 $subject of function preg_match expects string, string|false given.                                             
  160    Parameter #2 $subject of function preg_match expects string, string|false given.                                             
 ------ ----------------------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------- 
  Line   tests/plugins/auto-sizes/auto-sizes-test.php                                   
 ------ ------------------------------------------------------------------------------- 
  22     Static property AutoSizesTests::$image_id (int) does not accept int|WP_Error.  
 ------ ------------------------------------------------------------------------------- 

 ------ --------------------------------------------------------------------------------------------------------------------------- 
  Line   tests/plugins/dominant-color-images/dominant-color-image-editor-gd-test.php                                                
 ------ --------------------------------------------------------------------------------------------------------------------------- 
  32     Parameter #1 $post of function get_post expects int|WP_Post|null, int|WP_Error given.                                      
  34     Parameter #1 $attachment_id of function dominant_color_get_dominant_color_data expects int, int|WP_Error given.            
  37     Offset 'dominant_color' might not exist on array{has_transparency?: bool, dominant_color?: string}.                        
  38     Offset 'has_transparency' might not exist on array{has_transparency?: bool, dominant_color?: string}.                      
  56     Parameter #1 $post of function get_post expects int|WP_Post|null, int|WP_Error given.                                      
  58     Parameter #1 $attachment_id of function dominant_color_get_dominant_color_data expects int, int|WP_Error given.            
  61     Parameter #2 $haystack of method PHPUnit\Framework\Assert::assertStringContainsString() expects string, int|string given.  
  77     Parameter #1 $post of function get_post expects int|WP_Post|null, int|WP_Error given.                                      
  79     Parameter #1 $attachment_id of function dominant_color_get_dominant_color_data expects int, int|WP_Error given.            
 ------ --------------------------------------------------------------------------------------------------------------------------- 

 ------ --------------------------------------------------------------------------------------------------------------------------- 
  Line   tests/plugins/dominant-color-images/dominant-color-image-editor-imagick-test.php                                           
 ------ --------------------------------------------------------------------------------------------------------------------------- 
  34     Parameter #1 $post of function get_post expects int|WP_Post|null, int|WP_Error given.                                      
  36     Parameter #1 $attachment_id of function dominant_color_get_dominant_color_data expects int, int|WP_Error given.            
  39     Offset 'dominant_color' might not exist on array{has_transparency?: bool, dominant_color?: string}.                        
  40     Offset 'has_transparency' might not exist on array{has_transparency?: bool, dominant_color?: string}.                      
  58     Parameter #1 $post of function get_post expects int|WP_Post|null, int|WP_Error given.                                      
  60     Parameter #1 $attachment_id of function dominant_color_get_dominant_color_data expects int, int|WP_Error given.            
  63     Parameter #2 $haystack of method PHPUnit\Framework\Assert::assertStringContainsString() expects string, int|string given.  
  79     Parameter #1 $post of function get_post expects int|WP_Post|null, int|WP_Error given.                                      
  81     Parameter #1 $attachment_id of function dominant_color_get_dominant_color_data expects int, int|WP_Error given.            
 ------ --------------------------------------------------------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------------------------------------- 
  Line   tests/plugins/dominant-color-images/dominant-color-test.php                                                         
 ------ -------------------------------------------------------------------------------------------------------------------- 
  33     Parameter #1 $post of function get_post expects int|WP_Post|null, int|WP_Error given.                               
  34     Parameter #2 $attachment_id of function dominant_color_metadata expects int, int|WP_Error given.                    
  58     Parameter #1 $attachment_id of function dominant_color_get_dominant_color expects int, int|WP_Error given.          
  83     Parameter #1 $post of function get_post expects int|WP_Post|null, int|WP_Error given.                               
  84     Parameter #2 $attachment_id of function dominant_color_metadata expects int, int|WP_Error given.                    
  108    Parameter #1 $attachment_id of function dominant_color_has_transparency expects int, int|WP_Error given.            
  129    Parameter #1 $post of function get_post expects int|WP_Post|null, int|WP_Error given.                               
  131    Cannot use array destructuring on array<int, bool|int|string>|false.                                                
  131    Parameter #1 $attachment_id of function wp_get_attachment_image_src expects int, int|WP_Error given.                
  135    Parameter #3 $attachment_id of function dominant_color_img_tag_add_dominant_color expects int, int|WP_Error given.  
  149    Parameter #3 $attachment_id of function dominant_color_img_tag_add_dominant_color expects int, int|WP_Error given.  
  166    Parameter #1 $post of function get_post expects int|WP_Post|null, int|WP_Error given.                               
  168    Parameter #1 $attachment_id of function wp_get_attachment_image_url expects int, int|WP_Error given.                
  170    Parameter #3 $attachment_id of function dominant_color_img_tag_add_dominant_color expects int, int|WP_Error given.  
  214    Parameter #1 $post of function get_post expects int|WP_Post|null, int|WP_Error given.                               
  216    Cannot use array destructuring on array<int, bool|int|string>|false.                                                
  216    Parameter #1 $attachment_id of function wp_get_attachment_image_src expects int, int|WP_Error given.                
  222    Parameter #3 $attachment_id of function dominant_color_img_tag_add_dominant_color expects int, int|WP_Error given.  
  255    Parameter #1 $attachment_id of function wp_get_attachment_image expects int, int|WP_Error given.                    
 ------ -------------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   tests/plugins/optimization-detective/class-od-url-metric-tests.php                                                                                                                                                                                                
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  134    Parameter #1 $data of class OD_URL_Metric constructor expects array{url: string, timestamp: float, viewport: array{width: int, height: int}, elements: array<array{isLCP: bool, isLCPCandidate: bool, xpath: string, intersectionRatio: float, intersectionRect:  
         array{width: int, height: int}, boundingClientRect: array{width: int, height: int}}>}, array<string, mixed> given.                                                                                                                                                
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 

 ------ -------------------------------------------------------------------------------------------------------------------------------- 
  Line   tests/plugins/optimization-detective/class-od-url-metrics-group-collection-tests.php                                            
 ------ -------------------------------------------------------------------------------------------------------------------------------- 
  102    Parameter #1 $exception of method PHPUnit\Framework\TestCase::expectException() expects class-string<Throwable>, string given.  
 ------ -------------------------------------------------------------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------------------------------------------------- 
  Line   tests/plugins/optimization-detective/class-od-url-metrics-group-tests.php                                                       
 ------ -------------------------------------------------------------------------------------------------------------------------------- 
  111    Parameter #1 $exception of method PHPUnit\Framework\TestCase::expectException() expects class-string<Throwable>, string given.  
  199    Parameter #1 $exception of method PHPUnit\Framework\TestCase::expectException() expects class-string<Throwable>, string given.  
 ------ -------------------------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------ 
  Line   tests/plugins/optimization-detective/optimization-tests.php                               
 ------ ------------------------------------------------------------------------------------------ 
  30     Property OD_Optimization_Tests::$default_mimetype (string) does not accept string|false.  
  154    Parameter #1 $id of function wp_set_current_user expects int|null, int|WP_Error given.    
  161    Parameter #1 $id of function wp_set_current_user expects int|null, int|WP_Error given.    
 ------ ------------------------------------------------------------------------------------------ 

 ------ ------------------------------------------------------------------------------------------------------------------------------------ 
  Line   tests/plugins/optimization-detective/storage/class-od-url-metrics-post-type-tests.php                                               
 ------ ------------------------------------------------------------------------------------------------------------------------------------ 
  142    Parameter #1 $post of static method OD_URL_Metrics_Post_Type::get_url_metrics_from_post() expects WP_Post, WP_Error|WP_Post given.  
  169    Parameter #1 $post of function get_post expects int|WP_Post|null, int|WP_Error given.                                               
  191    Parameter #1 $id of function wp_set_current_user expects int|null, int|WP_Error given.                                              
  204    Parameter #1 $id of function wp_set_current_user expects int|null, int|WP_Error given.                                              
  232    Parameter #1 $post of function clean_post_cache expects int|WP_Post, int|WP_Error given.                                            
  235    Parameter #1 $post of function get_permalink expects int|WP_Post, int|WP_Error given.                                               
  235    Parameter #1 $url of method OD_Storage_Post_Type_Tests::get_sample_url_metric() expects string, string|false given.                 
  237    Parameter #1 $post of function get_permalink expects int|WP_Post, int|WP_Error given.                                               
  237    Parameter #1 $url of method OD_Storage_Post_Type_Tests::get_sample_url_metric() expects string, string|false given.                 
  246    Parameter #1 $post of function clean_post_cache expects int|WP_Post, int|WP_Error given.                                            
  251    Parameter #1 $post of function get_post expects int|WP_Post|null, int|WP_Error given.                                               
  252    Parameter #1 $post of function get_post expects int|WP_Post|null, int|WP_Error given.                                               
  253    Parameter #1 $post of function get_post expects int|WP_Post|null, int|WP_Error given.                                               
  254    Parameter #1 $post of function get_post expects int|WP_Post|null, int|WP_Error given.                                               
  278    Parameter #1 $post_id of function update_post_meta expects int, int|WP_Error given.                                                 
  285    Parameter #1 $post_id of function update_post_meta expects int, int|WP_Error given.                                                 
  320    Parameter #1 $post of function get_post expects int|WP_Post|null, int|WP_Error given.                                               
  321    Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                    
 ------ ------------------------------------------------------------------------------------------------------------------------------------ 

 ------ ------------------------------------------------------------------------------------------------ 
  Line   tests/plugins/optimization-detective/storage/data-tests.php                                     
 ------ ------------------------------------------------------------------------------------------------ 
  79     Parameter #1 $post of function get_permalink expects int|WP_Post, int|WP_Error given.           
  79     Parameter #1 $url of method WP_UnitTestCase_Base::go_to() expects string, string|false given.   
  80     Cannot cast int|WP_Error to string.                                                             
  86     Parameter #1 $post of function get_post_datetime expects int|WP_Post|null, int|WP_Error given.  
  91     Cannot call method format() on DateTimeImmutable|false.                                         
  92     Cannot call method format() on DateTimeImmutable|false.                                         
  93     Cannot call method format() on DateTimeImmutable|false.                                         
  100    Cannot call method format() on DateTimeImmutable|false.                                         
  101    Cannot call method format() on DateTimeImmutable|false.                                         
  102    Cannot call method format() on DateTimeImmutable|false.                                         
  114    Parameter #1 $id of function wp_set_current_user expects int|null, int|WP_Error given.          
  182    Parameter #1 $post of function get_permalink expects int|WP_Post, int|WP_Error given.           
  184    Parameter #1 $url of method WP_UnitTestCase_Base::go_to() expects string, string|false given.   
  323    Parameter #1 $id of function wp_set_current_user expects int|null, int|WP_Error given.          
 ------ ------------------------------------------------------------------------------------------------ 

 ------ ---------------------------------------------------------------------------------------------------------------------------------------- 
  Line   tests/plugins/optimization-detective/storage/rest-api-tests.php                                                                         
 ------ ---------------------------------------------------------------------------------------------------------------------------------------- 
  289    Parameter #2 $haystack of method PHPUnit\Framework\Assert::assertCount() expects Countable|iterable, OD_URL_Metrics_Group|false given.  
 ------ ---------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------------------------- 
  Line   tests/plugins/optimization-detective/uninstall-tests.php                                
 ------ ---------------------------------------------------------------------------------------- 
  41     Parameter #1 $post of function get_post expects int|WP_Post|null, int|WP_Error given.   
  42     Parameter #1 $post of function get_post expects int|WP_Post|null, int|WP_Error given.   
  50     Parameter #1 $id of function wp_set_current_user expects int|null, int|WP_Error given.  
 ------ ---------------------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   tests/plugins/webp-uploads/data/class-wp-image-edit.php                                                                                                 
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- 
  59     Property WP_Image_Edit::$changes (array<string, array<string, int>|int>) does not accept array<int|string, array<string, int>|int>.                     
  70     Property WP_Image_Edit::$changes (array<string, array<string, int>|int>) does not accept array<int|string, array<string, int>|int>.                     
  81     Property WP_Image_Edit::$changes (array<string, array<string, int>|int>) does not accept array<int|string, array<string, int>|int>.                     
  92     Property WP_Image_Edit::$changes (array<string, array<string, int>|int>) does not accept array<int|string, array<string, int>|int>.                     
  108    Property WP_Image_Edit::$changes (array<string, array<string, int>|int>) does not accept array<int|string, array<string, array<string, int>|int>|int>.  
 ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   tests/plugins/webp-uploads/helper-tests.php                                                                                               
 ------ ------------------------------------------------------------------------------------------------------------------------------------------ 
  100    Parameter #1 $attachment_id of function webp_uploads_generate_additional_image_source expects int, int|WP_Error given.                    
  101    Parameter #1 $attachment_id of function get_attached_file expects int, int|WP_Error given.                                                
  102    Parameter #1 $path of function pathinfo expects string, string|false given.                                                               
  103    Parameter #1 $path of function pathinfo expects string, string|false given.                                                               
  129    Parameter #1 $attachment_id of function webp_uploads_generate_additional_image_source expects int, int|WP_Error given.                    
  149    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                       
  150    Parameter #1 $attachment_id of function wp_update_attachment_metadata expects int, int|WP_Error given.                                    
  151    Parameter #1 $attachment_id of function webp_uploads_generate_image_size expects int, int|WP_Error given.                                 
  197    Parameter #1 $attachment_id of function get_attached_file expects int, int|WP_Error given.                                                
  198    Parameter #1 $attachment_id of function wp_get_original_image_path expects int, int|WP_Error given.                                       
  200    Parameter #1 $filename of method PHPUnit\Framework\Assert::assertFileExists() expects string, string|false given.                         
  201    Parameter #1 $filename of method PHPUnit\Framework\Assert::assertFileExists() expects string, string|false given.                         
  202    Parameter #1 $file of function wp_delete_file expects string, string|false given.                                                         
  203    Parameter #1 $file of function wp_delete_file expects string, string|false given.                                                         
  204    Parameter #1 $filename of method Yoast\PHPUnitPolyfills\TestCases\TestCase::assertFileDoesNotExist() expects string, string|false given.  
  205    Parameter #1 $filename of method Yoast\PHPUnitPolyfills\TestCases\TestCase::assertFileDoesNotExist() expects string, string|false given.  
  207    Parameter #1 $attachment_id of function webp_uploads_generate_image_size expects int, int|WP_Error given.                                 
  224    Parameter #1 $attachment_id of function webp_uploads_generate_image_size expects int, int|WP_Error given.                                 
  238    Parameter #1 $attachment_id of function webp_uploads_generate_image_size expects int, int|WP_Error given.                                 
  261    Parameter #1 $attachment_id of function webp_uploads_generate_image_size expects int, int|WP_Error given.                                 
  292    Parameter #1 $attachment_id of function webp_uploads_generate_additional_image_source expects int, int|WP_Error given.                    
  326    Parameter #1 $attachment_id of function webp_uploads_generate_additional_image_source expects int, int|WP_Error given.                    
  358    Parameter #1 $attachment_id of function webp_uploads_generate_additional_image_source expects int, int|WP_Error given.                    
  578    Parameter #1 $attachment_id of function webp_uploads_generate_additional_image_source expects int, int|WP_Error given.                    
  579    Parameter #1 $attachment_id of function webp_uploads_generate_additional_image_source expects int, int|WP_Error given.                    
 ------ ------------------------------------------------------------------------------------------------------------------------------------------ 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   tests/plugins/webp-uploads/image-edit-tests.php                                                                                                                                                                                                                         
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  27     Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  28     Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  29     Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  31     Parameter #1 $attachment_id of class WP_Image_Edit constructor expects int, int|WP_Error given.                                                                                                                                                                         
  37     Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  46     Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  49     Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  59     Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  59     Possibly invalid array key type array<int, string>|string.                                                                                                                                                                                                              
  62     Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  76     Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  78     Parameter #1 $attachment_id of class WP_Image_Edit constructor expects int, int|WP_Error given.                                                                                                                                                                         
  82     Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  85     Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  87     Parameter #1 $post_id of function wp_restore_image expects int, int|WP_Error given.                                                                                                                                                                                     
  89     Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSource() expects int, int|WP_Error given.                                                                                                                          
  90     Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  92     Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  93     Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  95     Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  97     Parameter #2 $haystack of method PHPUnit\Framework\Assert::assertCount() expects Countable|iterable, array|ArrayAccess given.                                                                                                                                           
  100    Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  115    Possibly invalid array key type (array<int, string>|string).                                                                                                                                                                                                            
  116    Possibly invalid array key type (array<int, string>|string).                                                                                                                                                                                                            
  130    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  134    Parameter #1 $attachment_id of class WP_Image_Edit constructor expects int, int|WP_Error given.                                                                                                                                                                         
  138    Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  141    Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  163    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  166    Parameter #1 $attachment_id of class WP_Image_Edit constructor expects int, int|WP_Error given.                                                                                                                                                                         
  170    Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  173    Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  179    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  180    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  181    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  182    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  183    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  185    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  186    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  189    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  190    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  193    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  198    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  199    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  215    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  217    Parameter #1 $attachment_id of class WP_Image_Edit constructor expects int, int|WP_Error given.                                                                                                                                                                         
  221    Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  224    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  226    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  230    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSource() expects int, int|WP_Error given.                                                                                                                          
  231    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  237    Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  272    Parameter #1 $attachment_id of function get_attached_file expects int, int|WP_Error given.                                                                                                                                                                              
  272    Parameter #1 $attachment_id of function wp_get_original_image_path expects int, int|WP_Error given.                                                                                                                                                                     
  274    Parameter #1 $attachment_id of class WP_Image_Edit constructor expects int, int|WP_Error given.                                                                                                                                                                         
  279    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  283    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSource() expects int, int|WP_Error given.                                                                                                                          
  284    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  293    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSizeSource() expects int, int|WP_Error given.                                                                                                                      
  294    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  319    Parameter #1 $attachment_id of class WP_Image_Edit constructor expects int, int|WP_Error given.                                                                                                                                                                         
  323    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  324    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSource() expects int, int|WP_Error given.                                                                                                                          
  326    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  328    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  334    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSizeSource() expects int, int|WP_Error given.                                                                                                                      
  335    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  336    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  347    Parameter #1 $attachment_id of function webp_uploads_get_next_full_size_key_from_backup expects int, int|WP_Error given.                                                                                                                                                
  360    Parameter #1 $attachment_id of class WP_Image_Edit constructor expects int, int|WP_Error given.                                                                                                                                                                         
  364    Parameter #1 $attachment_id of function webp_uploads_get_next_full_size_key_from_backup expects int, int|WP_Error given.                                                                                                                                                
  374    Parameter #1 $attachment_id of class WP_Image_Edit constructor expects int, int|WP_Error given.                                                                                                                                                                         
  378    Parameter #1 $attachment_id of function webp_uploads_get_next_full_size_key_from_backup expects int, int|WP_Error given.                                                                                                                                                
  391    Parameter #1 $attachment_id of class WP_Image_Edit constructor expects int, int|WP_Error given.                                                                                                                                                                         
  395    Parameter #1 $attachment_id of function webp_uploads_get_next_full_size_key_from_backup expects int, int|WP_Error given.                                                                                                                                                
  401    Parameter #1 $attachment_id of function webp_uploads_get_next_full_size_key_from_backup expects int, int|WP_Error given.                                                                                                                                                
  417    Parameter #1 $attachment_id of class WP_Image_Edit constructor expects int, int|WP_Error given.                                                                                                                                                                         
  427    Parameter #1 $attachment_id of function webp_uploads_backup_full_image_sources expects int, int|WP_Error given.                                                                                                                                                         
  429    Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  443    Parameter #1 $attachment_id of class WP_Image_Edit constructor expects int, int|WP_Error given.                                                                                                                                                                         
  458    Parameter #1 $attachment_id of function webp_uploads_backup_full_image_sources expects int, int|WP_Error given.                                                                                                                                                         
  460    Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  465    Parameter #2 $hashed_size_name of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertSizeNameIsHashed() expects string, int|string|false given.                                                                                                                 
  479    Parameter #1 $attachment_id of class WP_Image_Edit constructor expects int, int|WP_Error given.                                                                                                                                                                         
  482    Parameter #1 $attachment_id of function webp_uploads_backup_full_image_sources expects int, int|WP_Error given.                                                                                                                                                         
  485    Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  499    Parameter #1 $attachment_id of class WP_Image_Edit constructor expects int, int|WP_Error given.                                                                                                                                                                         
  503    Parameter #1 $post_id of function wp_restore_image expects int, int|WP_Error given.                                                                                                                                                                                     
  505    Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  527    Parameter #1 $attachment_id of class WP_Image_Edit constructor expects int, int|WP_Error given.                                                                                                                                                                         
  535    Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  536    Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   tests/plugins/webp-uploads/load-tests.php                                                                                                                                                                                                                               
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  49     Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  50     Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSource() expects int, int|WP_Error given.                                                                                                                          
  52     Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  56     Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  57     Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  57     Parameter #1 $attachment_id of function get_attached_file expects int, int|WP_Error given.                                                                                                                                                                              
  57     Parameter #2 $string of method PHPUnit\Framework\Assert::assertStringEndsWith() expects string, string|false given.                                                                                                                                                     
  60     Parameter #1 $attachment_id of function wp_get_original_image_path expects int, int|WP_Error given.                                                                                                                                                                     
  60     Parameter #2 $string of method PHPUnit\Framework\Assert::assertStringEndsWith() expects string, string|false given.                                                                                                                                                     
  63     Parameter #1 $post of function get_post_mime_type expects int|WP_Post|null, int|WP_Error given.                                                                                                                                                                         
  67     Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  68     Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSizeSource() expects int, int|WP_Error given.                                                                                                                      
  81     Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSource() expects int, int|WP_Error given.                                                                                                                          
  82     Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  84     Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  88     Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  89     Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  89     Parameter #1 $attachment_id of function get_attached_file expects int, int|WP_Error given.                                                                                                                                                                              
  89     Parameter #2 $string of method PHPUnit\Framework\Assert::assertStringEndsWith() expects string, string|false given.                                                                                                                                                     
  92     Parameter #1 $post of function get_post_mime_type expects int|WP_Post|null, int|WP_Error given.                                                                                                                                                                         
  96     Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSizeSource() expects int, int|WP_Error given.                                                                                                                      
  97     Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  112    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  113    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  115    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  119    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  120    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  120    Parameter #1 $attachment_id of function get_attached_file expects int, int|WP_Error given.                                                                                                                                                                              
  120    Parameter #2 $string of method PHPUnit\Framework\Assert::assertStringEndsWith() expects string, string|false given.                                                                                                                                                     
  123    Parameter #1 $post of function get_post_mime_type expects int|WP_Post|null, int|WP_Error given.                                                                                                                                                                         
  127    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  128    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  143    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  144    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  146    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  150    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  151    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  151    Parameter #1 $attachment_id of function get_attached_file expects int, int|WP_Error given.                                                                                                                                                                              
  151    Parameter #2 $string of method PHPUnit\Framework\Assert::assertStringEndsWith() expects string, string|false given.                                                                                                                                                     
  154    Parameter #1 $post of function get_post_mime_type expects int|WP_Post|null, int|WP_Error given.                                                                                                                                                                         
  158    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  159    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  175    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  201    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  202    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSource() expects int, int|WP_Error given.                                                                                                                          
  204    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  206    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  207    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSizeSource() expects int, int|WP_Error given.                                                                                                                      
  228    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  247    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  252    Parameter #1 $attachment_id of function get_attached_file expects int, int|WP_Error given.                                                                                                                                                                              
  253    Parameter #1 $path of function pathinfo expects string, string|false given.                                                                                                                                                                                             
  255    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSource() expects int, int|WP_Error given.                                                                                                                          
  257    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  261    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSizeSource() expects int, int|WP_Error given.                                                                                                                      
  262    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  276    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  279    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSource() expects int, int|WP_Error given.                                                                                                                          
  280    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  303    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  304    Parameter #1 $attachment_id of function get_attached_file expects int, int|WP_Error given.                                                                                                                                                                              
  304    Parameter #2 $string of method PHPUnit\Framework\Assert::assertStringEndsWith() expects string, string|false given.                                                                                                                                                     
  305    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  306    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  307    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  320    Parameter #1 $attachment_id of function get_attached_file expects int, int|WP_Error given.                                                                                                                                                                              
  321    Parameter #1 $path of function pathinfo expects string, string|false given.                                                                                                                                                                                             
  326    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  329    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  332    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  333    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  336    Parameter #1 $post_id of function wp_delete_attachment expects int, int|WP_Error given.                                                                                                                                                                                 
  339    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  342    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  355    Parameter #1 $attachment_id of function get_attached_file expects int, int|WP_Error given.                                                                                                                                                                              
  356    Parameter #1 $path of function pathinfo expects string, string|false given.                                                                                                                                                                                             
  361    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  363    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  364    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  366    Parameter #1 $post_id of function wp_delete_attachment expects int, int|WP_Error given.                                                                                                                                                                                 
  368    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  369    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  383    Parameter #1 $attachment_id of function get_attached_file expects int, int|WP_Error given.                                                                                                                                                                              
  384    Parameter #1 $path of function pathinfo expects string, string|false given.                                                                                                                                                                                             
  386    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  389    Parameter #1 $filename of method PHPUnit\Framework\Assert::assertFileExists() expects string, string|false given.                                                                                                                                                       
  390    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  392    Parameter #1 $post_id of function wp_delete_attachment expects int, int|WP_Error given.                                                                                                                                                                                 
  394    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  407    Parameter #1 $attachment_id of function get_attached_file expects int, int|WP_Error given.                                                                                                                                                                              
  408    Parameter #1 $path of function pathinfo expects string, string|false given.                                                                                                                                                                                             
  413    Parameter #1 $attachment_id of class WP_Image_Edit constructor expects int, int|WP_Error given.                                                                                                                                                                         
  416    Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  420    Parameter #1 $post_id of function get_post_meta expects int, int|WP_Error given.                                                                                                                                                                                        
  424    Parameter #1 $post_id of function wp_delete_attachment expects int, int|WP_Error given.                                                                                                                                                                                 
  477    Parameter #1 $attachment_id of function wp_get_attachment_image expects int, int|WP_Error given.                                                                                                                                                                        
  477    Part $attachment_id (int|WP_Error) of encapsed string cannot be cast to string.                                                                                                                                                                                         
  479    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  481    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  481    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  484    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  484    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  488    Parameter #3 $attachment_id of function webp_uploads_img_tag_update_mime_type expects int, int|WP_Error given.                                                                                                                                                          
  504    Parameter #1 $attachment_id of function wp_get_attachment_image expects int, int|WP_Error given.                                                                                                                                                                        
  523    Parameter #1 $attachment_id of function wp_get_attachment_image expects int, int|WP_Error given.                                                                                                                                                                        
  523    Part $attachment_id (int|WP_Error) of encapsed string cannot be cast to string.                                                                                                                                                                                         
  525    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  527    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  527    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  530    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  530    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  534    Parameter #3 $attachment_id of function webp_uploads_img_tag_update_mime_type expects int, int|WP_Error given.                                                                                                                                                          
  557    Parameter #1 $attachment_id of function wp_get_attachment_image expects int, int|WP_Error given.                                                                                                                                                                        
  557    Part $attachment_id (int|WP_Error) of encapsed string cannot be cast to string.                                                                                                                                                                                         
  559    Parameter #3 $attachment_id of function webp_uploads_img_tag_update_mime_type expects int, int|WP_Error given.                                                                                                                                                          
  580    Parameter #1 $attachment_id of function wp_get_attachment_image expects int, int|WP_Error given.                                                                                                                                                                        
  580    Part $attachment_id (int|WP_Error) of encapsed string cannot be cast to string.                                                                                                                                                                                         
  586    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  587    Parameter #1 $attachment_id of function get_attached_file expects int, int|WP_Error given.                                                                                                                                                                              
  587    Parameter #1 $filename of function wp_check_filetype expects string, string|false given.                                                                                                                                                                                
  588    Parameter #1 $attachment_id of function get_attached_file expects int, int|WP_Error given.                                                                                                                                                                              
  588    Parameter #1 $path of function wp_basename expects string, string|false given.                                                                                                                                                                                          
  588    Parameter #3 $attachment_id of function webp_uploads_img_tag_update_mime_type expects int, int|WP_Error given.                                                                                                                                                          
  589    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  589    Parameter #3 $attachment_id of function webp_uploads_img_tag_update_mime_type expects int, int|WP_Error given.                                                                                                                                                          
  604    Parameter #1 $attachment_id of function wp_get_attachment_image expects int, int|WP_Error given.                                                                                                                                                                        
  604    Part $attachment_id (int|WP_Error) of encapsed string cannot be cast to string.                                                                                                                                                                                         
  605    Parameter #3 $attachment_id of function webp_uploads_img_tag_update_mime_type expects int, int|WP_Error given.                                                                                                                                                          
  645    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  674    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  675    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  677    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  679    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  680    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  702    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  707    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSource() expects int, int|WP_Error given.                                                                                                                          
  708    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  710    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSizeSource() expects int, int|WP_Error given.                                                                                                                      
  711    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  722    Parameter #1 $post of function set_post_thumbnail expects int|WP_Post, int|WP_Error given.                                                                                                                                                                              
  722    Parameter #2 $thumbnail_id of function set_post_thumbnail expects int, int|WP_Error given.                                                                                                                                                                              
  724    Parameter #1 $post of function get_the_post_thumbnail expects int|WP_Post|null, int|WP_Error given.                                                                                                                                                                     
  747    Parameter #1 $attachment_id of function wp_get_attachment_image expects int, int|WP_Error given.                                                                                                                                                                        
  747    Part $attachment_id (int|WP_Error) of encapsed string cannot be cast to string.                                                                                                                                                                                         
  748    Parameter #3 $attachment_id of function webp_uploads_img_tag_update_mime_type expects int, int|WP_Error given.                                                                                                                                                          
  764    Parameter #1 $attachment_id of function wp_get_attachment_image expects int, int|WP_Error given.                                                                                                                                                                        
  764    Part $attachment_id (int|WP_Error) of encapsed string cannot be cast to string.                                                                                                                                                                                         
  766    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  767    Parameter #1 $attachment_id of function get_attached_file expects int, int|WP_Error given.                                                                                                                                                                              
  768    Parameter #1 $path of function pathinfo expects string, string|false given.                                                                                                                                                                                             
  769    Parameter #3 $attachment_id of function webp_uploads_img_tag_update_mime_type expects int, int|WP_Error given.                                                                                                                                                          
  770    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  771    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  775    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  778    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  779    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  779    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  782    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  783    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  783    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  804    Parameter #1 $attachment_id of function wp_get_attachment_image expects int, int|WP_Error given.                                                                                                                                                                        
  804    Part $attachment_id (int|WP_Error) of encapsed string cannot be cast to string.                                                                                                                                                                                         
  805    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  806    Parameter #1 $attachment_id of function get_attached_file expects int, int|WP_Error given.                                                                                                                                                                              
  807    Parameter #1 $path of function pathinfo expects string, string|false given.                                                                                                                                                                                             
  808    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSource() expects int, int|WP_Error given.                                                                                                                             
  809    Offset 'sources' might not exist on array{width: int, height: int, file: string, sizes: array<string, array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}>, image_meta: array<string, mixed>,  
         filesize: int, sources?: array<string, array{file: string, filesize: int}>, has_transparency?: bool, ...}.                                                                                                                                                              
  812    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSizeSource() expects int, int|WP_Error given.                                                                                                                      
  814    Parameter #3 $attachment_id of function webp_uploads_img_tag_update_mime_type expects int, int|WP_Error given.                                                                                                                                                          
  831    Parameter #1 $attachment_id of function wp_get_attachment_image expects int, int|WP_Error given.                                                                                                                                                                        
  831    Part $attachment_id (int|WP_Error) of encapsed string cannot be cast to string.                                                                                                                                                                                         
  833    Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.                                                                                                                                                                     
  834    Parameter #1 $attachment_id of function get_attached_file expects int, int|WP_Error given.                                                                                                                                                                              
  835    Parameter #1 $path of function pathinfo expects string, string|false given.                                                                                                                                                                                             
  836    Parameter #3 $attachment_id of function webp_uploads_img_tag_update_mime_type expects int, int|WP_Error given.                                                                                                                                                          
  838    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  839    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  840    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSource() expects int, int|WP_Error given.                                                                                                                          
  841    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  843    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  843    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  844    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  844    Offset 'sources' might not exist on array{file: string, width: int, height: int, mime-type: string, sources?: array<string, array{file: string, filesize: int}>}.                                                                                                       
  872    Parameter #1 $attachment_id of function wp_get_attachment_image expects int, int|WP_Error given.                                                                                                                                                                        
  872    Part $attachment_id (int|WP_Error) of encapsed string cannot be cast to string.                                                                                                                                                                                         
  920    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  921    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSizeSource() expects int, int|WP_Error given.                                                                                                                      
  941    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageHasSizeSource() expects int, int|WP_Error given.                                                                                                                         
  942    Parameter #1 $attachment_id of method PerformanceLab\Tests\TestCase\ImagesTestCase::assertImageNotHasSizeSource() expects int, int|WP_Error given.                                                                                                                      
  957    Call to an undefined method WP_Error|WP_Image_Editor::get_quality().                                                                                                                                                                                                    
  960    Call to an undefined method WP_Error|WP_Image_Editor::save().                                                                                                                                                                                                           
  961    Call to an undefined method WP_Error|WP_Image_Editor::get_quality().                                                                                                                                                                                                    
  966    Call to an undefined method WP_Error|WP_Image_Editor::get_quality().                                                                                                                                                                                                    
  969    Call to an undefined method WP_Error|WP_Image_Editor::save().                                                                                                                                                                                                           
  970    Call to an undefined method WP_Error|WP_Image_Editor::get_quality().                                                                                                                                                                                                    
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 

 ------ ----------------------------------------------------------------------------------------------------- 
  Line   tests/plugins/webp-uploads/rest-api-tests.php                                                        
 ------ ----------------------------------------------------------------------------------------------------- 
  34     Parameter #1 $attachment_id of function wp_get_attachment_metadata expects int, int|WP_Error given.  
  96     Parameter #1 $post_id of function delete_post_meta expects int, int|WP_Error given.                  
 ------ ----------------------------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------------------- 
  Line   tests/testdata/modules/site-health/audit-enqueued-assets/class-site-health-mock-responses.php  
 ------ ----------------------------------------------------------------------------------------------- 
  58     Parameter #1 $bytes of function size_format expects int|string, int|false given.               
  89     Parameter #1 $bytes of function size_format expects int|string, int|false given.               
  130    Parameter #1 $bytes of function size_format expects int|string, int|false given.               
  161    Parameter #1 $bytes of function size_format expects int|string, int|false given.               
 ------ ----------------------------------------------------------------------------------------------- 

Please review individual commits for changes.

I've ignored most of the errors in tests since they are overly strict and likely aren't worth fixing. The only other ignored errors are in dominant-color-images where PHP 8 changed the function signature from resource to GdImage.

@westonruter westonruter changed the base branch from trunk to update/phpstan-level-6 May 7, 2024 17:14
@westonruter
Copy link
Member Author

westonruter commented May 7, 2024

I've fixed the issues in includes and most of the ones in plugins/, with the remaining 16 errors being:

 ------ ----------------------------------------------------------------------------------------------- 
  Line   dominant-color-images/class-dominant-color-image-editor-gd.php                                 
 ------ ----------------------------------------------------------------------------------------------- 
  35     Parameter #1 $dst_im of function imagecopyresampled expects resource, resource|false given.    
  35     Parameter #1 $im of function imagesx expects resource, GdImage|resource given.                 
  35     Parameter #1 $im of function imagesy expects resource, GdImage|resource given.                 
  35     Parameter #10 $src_h of function imagecopyresampled expects int, int|false given.              
  35     Parameter #2 $src_im of function imagecopyresampled expects resource, GdImage|resource given.  
  35     Parameter #9 $src_w of function imagecopyresampled expects int, int|false given.               
  37     Parameter #1 $im of function imagecolorat expects resource, resource|false given.              
  65     Parameter #1 $im of function imagesx expects resource, GdImage|resource given.                 
  66     Parameter #1 $im of function imagesy expects resource, GdImage|resource given.                 
  69     Parameter #1 $im of function imagecolorat expects resource, GdImage|resource given.            
  70     Parameter #1 $im of function imagecolorsforindex expects resource, GdImage|resource given.     
  70     Parameter #2 $col of function imagecolorsforindex expects int, int|false given.                
  71     Cannot access offset 'alpha' on array|false.                                                   
 ------ ----------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   optimization-detective/optimization.php                                                                                                                                                                                                                           
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  350    Cannot access offset 'img_attributes' on array{background_image?: non-falsy-string, xpath: string, img_attributes?: array<'crossorigin'|'sizes'|'src'|'srcset', string|true>}|false.                                                                              
  354    Cannot access offset 'background_image' on array{background_image?: non-falsy-string, xpath: string, img_attributes?: array<'crossorigin'|'sizes'|'src'|'srcset', string|true>}|false.                                                                            
  375    Parameter #1 $lcp_elements_by_minimum_viewport_widths of function od_construct_preload_links expects array<int, array{background_image?: string, img_attributes?: array{src?: string, srcset?: string, sizes?: string, crossorigin?: string}}|false>, array<int,  
         array{background_image?: non-falsy-string, xpath: string, img_attributes?: array<'crossorigin'|'sizes'|'src'|'srcset', string|true>}|false> given.                                                                                                                
         💡 Type #1 from the union: Offset 'img_attributes' (array{src?: string, srcset?: string, sizes?: string, crossorigin?: string}) does not accept type array<'crossorigin'|'sizes'|'src'|'srcset', string|true>.                                                    
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 

The issues for optimization-detective should not be fixed here since I'm refactoring this code in #1172. The issues for dominant-color-images are fair game, however.

There are also 431 errors remaining in tests/. I doubt there will be much value in fixing all of those.

Base automatically changed from update/phpstan-level-6 to trunk May 9, 2024 17:07
… update/phpstan-level-7

* 'trunk' of https://github.com/WordPress/performance:
  Add missing sources to return tag of webp_uploads_restore_image
  Improve consistency of phpdoc in return tags
  Add missing keys to webp_uploads_update_sources arrays
  Fix param descriptions
  Fix strpos() argument order error to fix test_tag_add_adjust_to_image_attributes
  Move deprecated function to deprecated.php
  Deprecate unused webp_uploads_get_attachment_sources
  Add test case for when RGB values are too high
  Ensure RGB variable is int
  fix: avoid needless array allocation in rgb to hex conversion
@westonruter
Copy link
Member Author

When PHPStan 1.11 is out next week, we can easily ignore a lot of the errors in tests via the new error identifiers:

image

@westonruter westonruter added the [Type] Bug An existing feature is broken label May 9, 2024
@westonruter westonruter added this to the performance-lab 3.1.0 milestone May 9, 2024
Comment on lines +25 to +26
$bytes_enqueued = perflab_aea_get_total_size_bytes_enqueued_scripts();
if ( false === $enqueued_scripts || false === $bytes_enqueued ) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a big fix, since it is possible that the transient for perflab_aea_get_total_size_bytes_enqueued_scripts() could be empty but not for perflab_aea_get_total_enqueued_scripts().

Comment on lines +121 to +122
$bytes_enqueued = perflab_aea_get_total_size_bytes_enqueued_styles();
if ( false === $enqueued_styles || false === $bytes_enqueued ) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto above for how this may fix a bug.

$total_size += $enqueued_style['size'];
if ( is_array( $enqueued_style ) && array_key_exists( 'size', $enqueued_style ) && is_int( $enqueued_style['size'] ) ) {
$total_size += $enqueued_style['size'];
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe overly-defensive coding, but in reality a transient could return anything. This ensures we're working with what we expect.

@@ -81,7 +81,7 @@ function embed_optimizer_filter_oembed_html( string $html ): string {
// by preventing links in the hidden iframe from receiving focus.
if ( $html_processor->has_class( 'wp-embedded-content' ) ) {
$style = $html_processor->get_attribute( 'style' );
if ( $style ) {
if ( is_string( $style ) ) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case only happens if it had parsed <div style> where there is no attribute value. Unlikely, but it is a hardening.

Comment on lines -81 to +86
if ( $breakpoint <= 1 || PHP_INT_MAX === $breakpoint ) {
if ( ! is_int( $breakpoint ) || $breakpoint < 1 || PHP_INT_MAX === $breakpoint ) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a minor logic error that likely never would have been encountered, since no one should attempt to have a breakpoint of 1px.

@westonruter westonruter marked this pull request as ready for review May 9, 2024 19:33
Copy link

github-actions bot commented May 9, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: westonruter <westonruter@git.wordpress.org>
Co-authored-by: swissspidy <swissspidy@git.wordpress.org>
Co-authored-by: adamsilverstein <adamsilverstein@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Comment on lines 218 to 220
if ( ! wp_image_editor_supports( array( 'mime_type' => 'image/webp' ) ) ) {
$this->markTestSkipped( 'Mime type image/webp is not supported.' );
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason this test is failing in PHP 7.2 now with:

There was 1 failure:

1) WebP_Uploads_Helper_Tests::it_should_create_an_image_with_filter_webp_uploads_pre_generate_additional_image_source
Failed asserting that WP_Error Object &0000000004c81e5c000000005c809afd (
    'errors' => Array &0 (
        'image_mime_type_not_supported' => Array &1 (
            0 => 'The provided mime type is not supported.'
        )
    )
    'error_data' => Array &2 ()
    'additional_data' => Array &3 ()
) is of type "array".

/var/www/html/wp-content/plugins/performance/tests/plugins/webp-uploads/helper-tests.php:294

So I added this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it's because of the additional validation I added. Fixed in d8f886b.

@westonruter westonruter force-pushed the update/phpstan-level-7 branch from 281e94f to 5f6c663 Compare May 9, 2024 19:54
@westonruter westonruter force-pushed the update/phpstan-level-7 branch from 5f6c663 to d8f886b Compare May 9, 2024 20:01
'filesize' => $filesize,
);
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This improved/hardened validation logic resulted in the test change tests/plugins/webp-uploads/helper-tests.php wherein the filtered value was pointing to an invalid path which was not resulting in an incorrect overridden value. Now that there is validation for the filtered value, the value will only be used if it is valid.

@adamsilverstein
Copy link
Member

overall looks good, left a couple of questions. Very interesting to see all the hardening and sanity checks added here, seems useful if tedious.

westonruter and others added 2 commits May 10, 2024 09:31
Copy link
Member

@adamsilverstein adamsilverstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nifty!

@westonruter westonruter merged commit 914537b into trunk May 10, 2024
29 checks passed
@westonruter westonruter deleted the update/phpstan-level-7 branch May 10, 2024 20:57
@westonruter westonruter added the skip changelog PRs that should not be mentioned in changelogs label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip changelog PRs that should not be mentioned in changelogs [Type] Bug An existing feature is broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants