Skip to content

Fix broken method chain in README max-tokens example#249

Closed
alewolf wants to merge 1 commit into
WordPress:trunkfrom
alewolf:claude/fix-readme-semicolon
Closed

Fix broken method chain in README max-tokens example#249
alewolf wants to merge 1 commit into
WordPress:trunkfrom
alewolf:claude/fix-readme-semicolon

Conversation

@alewolf

@alewolf alewolf commented Jun 4, 2026

Copy link
Copy Markdown

Summary

The "Text generation using max tokens" example in README.md has a stray semicolon after ->usingMaxTokens(8000), which terminates the statement mid-chain and makes the following ->generateText() a parse error. Removing it lets the fluent builder chain flow through to ->generateText() as intended.

Changes

  • README.md: remove the ; after ->usingMaxTokens(8000) so the method chain continues to ->generateText();.
 $text = AiClient::prompt('Write a 80-verse poem with long stanzas about PHP.')
     ->usingSystemInstruction('You are a famous poet from the 17th century.')
     ->usingTemperature(0.8)
-    ->usingMaxTokens(8000);
+    ->usingMaxTokens(8000)
     ->generateText();

Props

Props @vyskoczilova for the contribution.

🤖 Generated with Claude Code

Remove the stray semicolon after usingMaxTokens(8000) so the fluent chain
correctly continues to ->generateText().

Co-authored-by: Karolína Vyskočilová <3611726+vyskoczilova@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 4, 2026 09:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the README usage example to correctly continue the fluent AI client call chain rather than terminating it early.

Changes:

  • Removes the premature statement terminator in the PHP example so generateText() remains part of the chain.

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

@github-actions

github-actions Bot commented Jun 4, 2026

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. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: alewolf <alekv@git.wordpress.org>

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

@alewolf

alewolf commented Jun 4, 2026

Copy link
Copy Markdown
Author

Superseded by #250, which consolidates this fix with the related typo fix (#246) since both touch the same README code block.

@alewolf alewolf closed this Jun 4, 2026
@alewolf alewolf deleted the claude/fix-readme-semicolon branch June 4, 2026 09:53
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.

2 participants