Skip to content

AI Client: Narrow WP_AI_Client_Builder::$builder type and remove strict baseline - #16244

Open
bsulyan wants to merge 1 commit into
WordPress:trunkfrom
bsulyan:fix/phpstan-strict-ai-client-builder
Open

bsulyan wants to merge 1 commit into
WordPress:trunkfrom
bsulyan:fix/phpstan-strict-ai-client-builder

Conversation

@bsulyan

@bsulyan bsulyan commented Nov 25, 2026

Copy link
Copy Markdown

Resolves the single remaining method.notFound error in the strict (level 10) PHPStan baseline and deletes tests/phpstan/baselines-strict/method.notFound.neon.

WP_AI_Client_Builder is @internal to core and only extended by WP_AI_Client_Prompt_Builder (returning PromptBuilder) and WP_AI_Client_Embedding_Builder (returning EmbeddingBuilder), both of which implement usingRequestOptions(). Narrowing the PHPDoc @var on $builder and @return on create_sdk_builder() to PromptBuilder|EmbeddingBuilder keeps the native : object signatures PHP 7.4 compatible while letting PHPStan verify the call at level 10.

Verified locally with composer phpstan:default, composer phpstan:strict, composer lint, and composer compat.

Trac ticket: https://core.trac.wordpress.org/ticket/66739

Use of AI Tools

AI assistance: Yes
Tool(s): Antigravity
Used for: Checking the strict baseline and SDK builder classes, and verifying PHPStan/PHPCS output; all changes were reviewed before submitting.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props sunasty.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub or WordPress.org user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant