Skip to content

Fix article typo and broken method chain in README max-tokens example#250

Open
alewolf wants to merge 1 commit into
WordPress:trunkfrom
alewolf:claude/fix-readme-example
Open

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

Conversation

@alewolf

@alewolf alewolf commented Jun 4, 2026

Copy link
Copy Markdown

Summary

Two small fixes to the "Text generation using max tokens" code example in README.md:

  1. Article typo: 'Write a 80-verse poem ...''Write an 80-verse poem ...' ("eighty" begins with a vowel sound, so it takes an).
  2. Broken method chain: the stray semicolon after ->usingMaxTokens(8000) terminated the statement mid-chain, making the following ->generateText() a parse error. Removing it lets the fluent builder chain flow through as intended.
-$text = AiClient::prompt('Write a 80-verse poem with long stanzas about PHP.')
+$text = AiClient::prompt('Write an 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();

This supersedes and consolidates #246 and #249, which each touched this same code block.

Props

Props @vyskoczilova for the contribution.

🤖 Generated with Claude Code

Two fixes in the 'Text generation using max tokens' example:
- 'a 80-verse' -> 'an 80-verse' ('eighty' takes 'an').
- 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:52

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’s PHP usage example to improve grammar and correct the method-chaining snippet so it reads as a single fluent call.

Changes:

  • Fixes the article in the prompt text (“a 80-verse” → “an 80-verse”).
  • Adjusts the fluent chain so ->generateText() is part of the same statement (removes the premature semicolon after usingMaxTokens).

💡 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.

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