Skip to content

dev: Update Composer deps and remediate PHPStan smells - #777

Draft
justlevine wants to merge 2 commits into
WordPress:developfrom
justlevine:dev/phpstan-update-fixes
Draft

dev: Update Composer deps and remediate PHPStan smells#777
justlevine wants to merge 2 commits into
WordPress:developfrom
justlevine:dev/phpstan-update-fixes

Conversation

@justlevine

@justlevine justlevine commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What?

Bumps Composer deps to their latest versions, and remediates the resulting PHPStan errors.

More specifically, it makes php-stubs/wordpress-stubs@7.0 a direct dependency aliased to WP 6.9.4, and then adds various inline ignores, where issues with the lack of FQCN cause type mismatches.

Now-unnecessary ignores have been removed from the PHPStan config.

Why?

  • Broadly, it's better to use the latest stubs - and suppress the type errors - than outdated ones, and type-hinting with inline-ignore annotations for improper hints are better than ignoreErrors because it allows the rest of the related code to still be typehinted correctly.

  • While Adjust php-stubs/wordpress-stubs dependency range so 7.0 can be used php-stubs/wp-cli-stubs#24 fixed the use of SemVer to allow v7.x, releases are tied to WP-CLI and therefore it hasn't hit downstream. Aliasing to 6.9.4 solves this temporarily.

How?

Use of AI Tools

None.

Testing Instructions

Screenshots or screencast

Before After

Changelog Entry

Developer - Bump Composer dev-dependencies and remediate new PHPStan smells

Open WordPress Playground Preview

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the project’s PHP dev toolchain (Composer/PHPStan-related dependencies and stubs) and adjusts code annotations/config so PHPStan passes cleanly against the newer stubs (notably WP 7.0-era definitions), while keeping analysis scoped appropriately.

Changes:

  • Bump Composer dev dependencies (including php-stubs/wordpress-stubs@7.0 via an alias) and update the lockfile accordingly.
  • Simplify phpstan.neon.dist by removing now-unnecessary ignoreErrors/excludePaths entries.
  • Add targeted inline PHPStan suppressions and refine PHPDoc types/array-shapes where newer stubs expose mismatches.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
phpstan.neon.dist Removes no-longer-needed ignores/exclusions after stub updates.
includes/Services/AI_Service.php Adds inline PHPStan ignore around model config usage for stub/type mismatches.
includes/REST/Models_Controller.php Adds inline PHPStan ignores and var annotations for AI Client model/provider metadata handling.
includes/Logging/REST/AI_Request_Log_Controller.php Adds property annotations for REST controller namespace/base to satisfy static analysis.
includes/helpers.php Adds/adjusts var annotations and ignores around provider/model capability inspection.
includes/Contracts/Feature.php Tightens get_id() PHPDoc to indicate lowercase feature IDs.
includes/Asset_Loader.php Adds inline PHPStan ignore for wp_enqueue_script() dependencies typing mismatch.
includes/Admin/Dashboard/AI_Capabilities_Widget.php Adds var annotations/ignores while enumerating provider capabilities.
includes/Abstracts/Abstract_Feature.php Tightens $id PHPDoc to lowercase-string intersection type.
includes/Abstracts/Abstract_Ability.php Adds inline PHPStan ignore around provider model selection call.
includes/Abilities/Image/Generate_Image.php Refines return array-shape PHPDoc and adds inline PHPStan ignores for AI Client SDK typing.
composer.lock Updates locked versions/hashes and records the wordpress-stubs alias.
composer.json Adds direct wordpress-stubs alias dependency, bumps wp-phpunit, and increases PHPStan memory limit.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread includes/REST/Models_Controller.php Outdated
Comment thread includes/Admin/Dashboard/AI_Capabilities_Widget.php Outdated
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.51%. Comparing base (56cef56) to head (26e2761).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #777   +/-   ##
==========================================
  Coverage      76.50%   76.51%           
  Complexity      1868     1868           
==========================================
  Files             89       89           
  Lines           7985     7987    +2     
==========================================
+ Hits            6109     6111    +2     
  Misses          1876     1876           
Flag Coverage Δ
unit 76.51% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jeffpaul

Copy link
Copy Markdown
Member

@justlevine is this still in progress or can it come out of draft for review?

@jeffpaul jeffpaul added this to the 1.2.0 milestone Jun 26, 2026
@jeffpaul jeffpaul moved this from Triage to In progress in WordPress AI Roadmap Jun 26, 2026
@justlevine

Copy link
Copy Markdown
Contributor Author

Per WordPress/php-ai-client#257 (comment), the FQCN bug has been patched upstream, so wordpress-stubs will be fixed when 7.1 generates.

I think that changes the math here, and I should move the ignores out of the file and into ignoreErrors it's not worth the file churn. cc @dkotter in case you disagree

@dkotter

dkotter commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

I think that changes the math here, and I should move the ignores out of the file and into ignoreErrors it's not worth the file churn. cc @dkotter in case you disagree

That makes sense to me 👍🏻

@jeffpaul

Copy link
Copy Markdown
Member

@justlevine heads up that I'm punting this to the next release, so you've got some time (especially to see what lands in WP 7.1 beta 1) before this ideally gets wrapped up

@jeffpaul jeffpaul modified the milestones: 1.2.0, 1.3.0 Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

4 participants