Deprecate Jetpack_PostImages in favor of Post_Media\Images#47376
Deprecate Jetpack_PostImages in favor of Post_Media\Images#47376
Conversation
All methods in the Jetpack_PostImages class are now thin wrappers that emit a deprecation notice and delegate to the equivalent method in Automattic\Jetpack\Post_Media\Images, following the same pattern used for Jetpack_Twitter_Cards in #47208. The old test file is removed since the post-media package already has equivalent coverage in ImagesTest.php.
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
There was a problem hiding this comment.
Pull request overview
This PR deprecates the Jetpack_PostImages class in favor of the Automattic\Jetpack\Post_Media\Images class from the post-media package. This follows the same deprecation pattern established in PR #47208 for Jetpack_Twitter_Cards. All public methods are marked as deprecated with @deprecated docblocks pointing to their equivalents in the new Images class, and most include _deprecated_function() runtime notices. Three heavily-used methods (from_html, fit_image_url, and get_image) omit runtime notices to avoid noisy warnings in production but retain IDE-visible deprecation markers.
Changes:
- Deprecated all 15 public methods in
Jetpack_PostImagesclass with delegation toAutomattic\Jetpack\Post_Media\Images - Added runtime deprecation notices to 12 methods; 3 heavily-used methods retain only docblock deprecation
- Removed dead code (private
get_images_from_block_attributesmethod) and test file with equivalent coverage in the package
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
projects/plugins/jetpack/class.jetpack-post-images.php |
Converted to thin deprecation wrapper: added @deprecated docblocks, _deprecated_function() calls, and delegation to Images class; removed unused imports and private helper method |
projects/plugins/jetpack/tests/php/media/Jetpack_PostImages_Test.php |
Deleted test file since equivalent coverage exists in package's ImagesTest.php |
projects/plugins/jetpack/changelog/deprecate-postimages-class |
Added changelog entry documenting the deprecation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Code Coverage SummaryCoverage changed in 1 file.
|
The PhanTypeMismatchDefault issue no longer applies after the class was converted to a thin deprecation wrapper.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes CM-550
Proposed changes:
Following up on #47208 (which moved
Jetpack_Twitter_Cardsto thepost-mediapackage), this PR applies the same deprecation pattern toJetpack_PostImages:Jetpack_PostImagesas deprecated via@deprecateddocblocks, pointing to the equivalent method inAutomattic\Jetpack\Post_Media\Images._deprecated_function()runtime notices for most methods. Three heavily-used methods (from_html,fit_image_url,get_image) keep the@deprecateddocblock for IDE visibility but omit the runtime notice to avoid noisy warnings in production.Images::method in thepost-mediapackage.get_images_from_block_attributes()helper (dead code now thatfrom_blocks()delegates entirely).Jetpack_PostImages_Test.php— equivalent test coverage already exists in the package'sImagesTest.php.Other information:
Jetpack product discussion
N/A — straightforward deprecation following established pattern from #47208.
Does this pull request change what data or activity we track or use?
No.
Testing instructions:
Jetpack_PostImages::method still returns the same results as before (the methods delegate toImages::).from_slideshow,from_gallery,from_thumbnail, etc.), confirm a_deprecated_functionnotice is triggered.from_html,fit_image_url, andget_image, confirm no runtime deprecation notice is triggered, but IDEs show the method as deprecated.Jetpack_PostImages(Related Posts, Open Graph tags, etc.) continue to work without regressions.Changelog