Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Pull request overview
Addresses newly reported PHPStan findings in the embed-command package (WP-CLI), primarily by adjusting code paths that PHPStan flags and updating the WP-CLI dependency.
Changes:
- Added inline PHPStan ignores around option validation in
Provider_Command. - Switched XML generation in
Fetch_Commandto use WordPress core’s_oembed_create_xml()and removed the local polyfill method. - Bumped the
wp-cli/wp-cliComposer requirement from^2.12to^2.13.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/Provider_Command.php |
Adds PHPStan suppression comments around null-comparison option validation. |
src/Fetch_Command.php |
Replaces the class’ XML polyfill with a direct call to _oembed_create_xml() and removes the polyfill implementation. |
composer.json |
Updates the minimum required WP-CLI version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if ( ! class_exists( 'SimpleXMLElement' ) ) { | ||
| WP_CLI::error( "The PHP extension 'SimpleXMLElement' is not available but is required for XML-formatted output." ); | ||
| } | ||
| WP_CLI::log( (string) $this->oembed_create_xml( (array) $data ) ); | ||
| WP_CLI::log( (string) _oembed_create_xml( (array) $data ) ); | ||
| } else { |
There was a problem hiding this comment.
Calling _oembed_create_xml() here will fatally error on WordPress versions prior to 4.4 (this command’s removed oembed_create_xml() method explicitly existed as a polyfill for older WP). Consider restoring the polyfill, or guarding with function_exists('_oembed_create_xml') and falling back to the local implementation / emitting a clear error if unavailable.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
No description provided.