Repository navigation
docs(agents): apply named arguments to new calls too - #1975
Merged
Merged
Conversation
The named arguments rule only covered calls whose arguments are changed, so it was unclear whether a call written from scratch should use them. State that every call that is written or modified uses named arguments, in new and in existing code. Calls that are not otherwise touched are still left alone. Also drop the exception for calls into lib/external/, so the rule covers third-party code too. The exception had no technical reason: that code is never modified, so its parameter names cannot change. For Composer packages, PHPStan reports an unknown named parameter, so a package that renames one is caught when the dependency is updated. Because the rule now covers every call, say that a call stays positional when the callee requires it. Built-in variadic functions do: array_merge(arrays: [1]) throws an ArgumentCountError. The exception for parameter names that are not stable stays. Assisted-by: Claude:claude-fable-5-2
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are present, and the change is limited to clarifying named-argument guidance and its documented exceptions.
No open issues 🎉
What changed in this PR
Clarifies the named-arguments guidance so it applies to all newly written or modified calls, including calls into third-party code, while preserving required positional-call exceptions.
Changes:
- Requires named arguments for new and modified calls.
- Removes the
lib/external/exception. - Documents positional exceptions for variadic callees and unstable parameter names.
- Updates the document’s last-updated date.
| File | Description |
|---|---|
| AGENTS.md | Updates the named-arguments coding guideline, exceptions, and document metadata date. |
Review effort: Lite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The named arguments rule only covered calls whose arguments are changed, so it was unclear whether a call written from scratch should use them. State that every call that is written or modified uses named arguments, in new and in existing code. Calls that are not otherwise touched are still left alone.
Also drop the exception for calls into lib/external/, so the rule covers third-party code too. The exception had no technical reason: that code is never modified, so its parameter names cannot change. For Composer packages, PHPStan reports an unknown named parameter, so a package that renames one is caught when the dependency is updated.
Because the rule now covers every call, say that a call stays positional when the callee requires it. Built-in variadic functions do: array_merge(arrays: [1]) throws an ArgumentCountError.
The exception for parameter names that are not stable stays.
Assisted-by: Claude:claude-fable-5-2