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 8 #1210

Merged
merged 2 commits into from
May 10, 2024
Merged

Update PHPStan level to 8 #1210

merged 2 commits into from
May 10, 2024

Conversation

westonruter
Copy link
Member

This is a sub-PR of #1205. Review and merge it first.

See #775.

This fixes the following PHPStan issues (only 8!):

 ------ ------------------------------------------------------------------ 
  Line   includes/server-timing/load.php                                   
 ------ ------------------------------------------------------------------ 
  215    Anonymous function should return string but returns string|null.  
 ------ ------------------------------------------------------------------ 

 ------ --------------------------------------------------------------------------------------------------- 
  Line   plugins/optimization-detective/class-od-html-tag-walker.php                                        
 ------ --------------------------------------------------------------------------------------------------- 
  229    Property OD_HTML_Tag_Walker::$open_stack_tags (array<string>) does not accept array<string|null>.  
  239    Generator expects value type string, string|null given.                                            
 ------ --------------------------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------------------------------- 
  Line   plugins/webp-uploads/hooks.php                                                                
 ------ ---------------------------------------------------------------------------------------------- 
  745    Parameter #1 $data of function wp_print_inline_script_tag expects string, string|null given.  
 ------ ---------------------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   plugins/webp-uploads/image-edit.php                                                                                                                                                                                                                                   
 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  156    Offset 'sizes' 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, ...}|null.                                                                                                                                                       
 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------------------------- 
  Line   tests/plugins/optimization-detective/class-od-html-tag-walker-tests.php                                 
 ------ -------------------------------------------------------------------------------------------------------- 
  466    Method OD_HTML_Tag_Walker_Tests::export_array_snapshot() should return string but returns string|null.  
 ------ -------------------------------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------------------------------------- 
  Line   tests/plugins/optimization-detective/optimization-tests.php                                         
 ------ ---------------------------------------------------------------------------------------------------- 
  1115   Anonymous function should return string but returns string|null.                                    
  1137   Method OD_Optimization_Tests::normalize_whitespace() should return string but returns string|null.  
 ------ ---------------------------------------------------------------------------------------------------- 

Please review individual commits for changes.

@westonruter westonruter force-pushed the update/phpstan-level-8 branch from 76d6053 to 40a2c88 Compare May 9, 2024 20:01
@westonruter westonruter marked this pull request as ready for review May 9, 2024 20:08
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 <[email protected]>
Co-authored-by: swissspidy <[email protected]>
Co-authored-by: adamsilverstein <[email protected]>

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

@westonruter westonruter added this to the performance-lab 3.1.0 milestone May 9, 2024
if ( webp_uploads_image_edit_thumbnails_separately() && 'nothumb' === $target && 'thumbnail' === $size_name ) {
continue;
}
if ( isset( $old_metadata['sizes'] ) ) {
Copy link
Member Author

Choose a reason for hiding this comment

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

The inclusion of this if statement wrapper is the only change to this block of code.

Copy link
Member

Choose a reason for hiding this comment

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

turning off whitespace confirms this

@westonruter westonruter added [Type] Enhancement A suggestion for improvement of an existing feature [Type] Bug An existing feature is broken and removed [Type] Enhancement A suggestion for improvement of an existing feature labels May 9, 2024
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.

Spiffy!

Base automatically changed from update/phpstan-level-7 to trunk May 10, 2024 20:57
@westonruter westonruter merged commit eb5c8a3 into trunk May 10, 2024
28 checks passed
@westonruter westonruter deleted the update/phpstan-level-8 branch May 10, 2024 20:58
@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.

3 participants