Skip to content

Fix newly reported PHPStan issues#87

Merged
swissspidy merged 2 commits intomainfrom
fix-phpstan
Feb 11, 2026
Merged

Fix newly reported PHPStan issues#87
swissspidy merged 2 commits intomainfrom
fix-phpstan

Conversation

@swissspidy
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings February 11, 2026 14:10
@swissspidy swissspidy requested a review from a team as a code owner February 11, 2026 14:10
@swissspidy swissspidy added the scope:testing Related to testing label Feb 11, 2026
@github-actions

This comment was marked as resolved.

@github-actions github-actions bot added the help-wanted Extra attention is needed label Feb 11, 2026
@gemini-code-assist

This comment was marked as resolved.

@swissspidy swissspidy added this to the 2.1.1 milestone Feb 11, 2026
gemini-code-assist[bot]

This comment was marked as resolved.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_Command to use WordPress core’s _oembed_create_xml() and removed the local polyfill method.
  • Bumped the wp-cli/wp-cli Composer requirement from ^2.12 to ^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.

Comment on lines 168 to 172
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 {
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy merged commit 18f45af into main Feb 11, 2026
53 checks passed
@swissspidy swissspidy deleted the fix-phpstan branch February 11, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help-wanted Extra attention is needed scope:testing Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant