Fix broken method chain in README max-tokens example#249
Conversation
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>
There was a problem hiding this comment.
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.
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Summary
The "Text generation using max tokens" example in
README.mdhas 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