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 2 #1199

Merged
merged 2 commits into from
May 6, 2024
Merged

Update PHPStan level to 2 #1199

merged 2 commits into from
May 6, 2024

Conversation

westonruter
Copy link
Member

@westonruter westonruter commented May 3, 2024

See #775.

This fixes the following PHPStan issues:

 ------ -------------------------------------------------------------------- 
  Line   plugins/dominant-color-images/helper.php                            
 ------ -------------------------------------------------------------------- 
  76     Call to an undefined method WP_Image_Editor::has_transparency().    
  82     Call to an undefined method WP_Image_Editor::get_dominant_color().  
 ------ -------------------------------------------------------------------- 

Note that PHPStan is correctly identifying a bug here which could cause a fatal error in case another plugin is filtering wp_image_editors so that our specific subclasses are not used.

@westonruter westonruter added the [Type] Bug An existing feature is broken label May 3, 2024
@westonruter westonruter added this to the performance-lab 3.1.0 milestone May 3, 2024
Copy link

github-actions bot commented May 3, 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: mukeshpanchal27 <[email protected]>

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

@westonruter westonruter force-pushed the update/phpstan-level-2 branch from f4fec1f to 7fd8cde Compare May 4, 2024 00:24
@westonruter westonruter requested a review from thelovekesh May 4, 2024 00:58
Base automatically changed from update/phpstan-level-1 to trunk May 6, 2024 05:34
@@ -58,6 +58,13 @@ function dominant_color_get_dominant_color_data( $attachment_id ) {
$file = get_attached_file( $attachment_id );
}
add_filter( 'wp_image_editors', 'dominant_color_set_image_editors' );

/**
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/**
/*

Seems it's local variable so do we needs to use multiline comment per https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#5-inline-comments

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think that's right. Without /** then the phpdoc is not parsed.

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 docs you link to are talking about a regular multiline comment, not one that serves as a doc block.

@westonruter westonruter merged commit cdf67e2 into trunk May 6, 2024
27 checks passed
@westonruter westonruter deleted the update/phpstan-level-2 branch May 6, 2024 05:45
@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.

2 participants