Docs: Add missing @return tag to WP_Image_Editor_Imagick::remove_pdf_alpha_channel() - #13200
Docs: Add missing @return tag to WP_Image_Editor_Imagick::remove_pdf_alpha_channel()#13200csemazharul wants to merge 1 commit into
@return tag to WP_Image_Editor_Imagick::remove_pdf_alpha_channel()#13200Conversation
`WP_Image_Editor_Imagick::remove_pdf_alpha_channel()`, introduced in [56271], returns a `WP_Error` object when `Imagick::setImageAlphaChannel()` throws, but its DocBlock declares no return value. This documents the existing return value only; no behavior is changed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Trac ticket: https://core.trac.wordpress.org/ticket/65916
WP_Image_Editor_Imagick::remove_pdf_alpha_channel()returns aWP_ErrorifImagick::setImageAlphaChannel()throws, but there's no@returntag in the DocBlock. Been like that since the method was added in changeset 56271 (Trac #39216).Found it while looking at Trac #65817. PHPStan's
return.missingrule didn't catch it because there's no declared return type, so it got skipped even thoughset_imagick_time_limit()in the same file is being fixed for that rule in #13082.This just adds the tag. Nothing else changes, and PHPCS output for the file is the same before and after.
One other thing I ran into: the only caller, on line 372, throws the return value away, while
pdf_load_source()and->valid()right next to it are both checked. Not sure what the right call is there. Returning the error fromload()would kill the PDF preview completely instead of just giving you one with a black background, which seems worse. Or theWP_Errorcould come out since nothing reads it. Left it alone for now, can do either if someone has a preference.