Apply name-length ordering across src and tests.#58
Merged
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This pull request updates member ordering across src/ and tests/ to follow the repository’s name-length ordering conventions, while also reshuffling several tests and a few public APIs accordingly.
Changes:
- Reordered methods (and some enum cases) across multiple
src/classes to match name-length ordering conventions. - Reorganized and expanded several PHPUnit unit tests (notably around request decoding, headers, cookies, transports, and status code helpers).
- Updated
.clauderule docs to reflect the new ordering rules (and additional PHPDoc policy adjustments).
Reviewed changes
Copilot reviewed 41 out of 41 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/UserAgentTest.php | Reorders tests and adjusts a couple of exception assertions. |
| tests/Unit/Server/ResponseWithCookiesTest.php | Reorders tests and tweaks cookie construction/expectations. |
| tests/Unit/Server/RequestTest.php | Adds/reorders decoding tests (URI, query params, route attributes, stream rewind behavior, method mapping). |
| tests/Unit/Server/HeadersTest.php | Expands/reorders server response header behavior tests. |
| tests/Unit/HttpTest.php | Reorders/extends Http facade tests (base URL validation, malformed paths, exception chaining, query composition). |
| tests/Unit/HttpBuilderTest.php | Reorders builder tests and expands base URL acceptance/validation checks. |
| tests/Unit/HeadersTest.php | Reorders/expands Headers value object tests (validation, replacement semantics, toArray). |
| tests/Unit/FailingTransport.php | Swaps helper factory method names to align with naming/ordering expectations. |
| tests/Unit/CookieTest.php | Expands validation tests and reorders scenarios; adds data providers and attribute ordering assertions. |
| tests/Unit/CodeTest.php | Adds targeted Code helper tests and reorders providers/tests. |
| tests/Unit/Client/Transports/NetworkTransportTest.php | Adds/reorders transport forwarding tests (empty body, merged headers, invalid UTF-8 handling, wrapping responses). |
| tests/Unit/Client/Transports/InMemoryTransportTest.php | Adds/reorders queue exhaustion and FIFO behavior tests. |
| tests/Unit/Client/ResponseTest.php | Reorders/expands response wrapper tests (raw access, synthesized behavior, deep JSON, seekable streams). |
| tests/Unit/Client/RequestTest.php | Reorders/expands request factory + mutation tests and data providers. |
| tests/Models/Products.php | Reorders methods to match name-length ordering. |
| tests/Drivers/Slim/SlimTest.php | Reorders middleware tests. |
| tests/Drivers/Laminas/LaminasTest.php | Reorders middleware tests. |
| src/Server/Decoded/Uri.php | Reorders instance methods (route, toString, queryParameters). |
| src/Server/Decoded/QueryParameters.php | Reorders toArray() relative to get(). |
| src/ResponseCacheDirectives.php | Reorders directive factories (staleIfError, mustRevalidate, proxyRevalidate). |
| src/Method.php | Reorders enum cases. |
| src/Internal/Server/Stream/StreamFactory.php | Reorders static/instance methods in the stream factory. |
| src/Internal/Server/Stream/Stream.php | Reorders methods for stream implementation. |
| src/Internal/Server/Response/ResponseHeaders.php | Reorders helper methods for header storage/mutation. |
| src/Internal/Server/Response/ProtocolVersion.php | Reorders from() and default() factories. |
| src/Internal/Server/Response/InternalResponse.php | Reorders PSR-7 response method implementations. |
| src/Internal/Server/Request/RouteParameterResolver.php | Reorders helpers and resolveAttribute() flow while keeping behavior. |
| src/HttpBuilder.php | Moves build() earlier to match ordering. |
| src/Http.php | Moves create() below with() to match ordering. |
| src/Headers.php | Reorders factories/accessors and introduces Headers::empty(). |
| src/Cookie.php | Reorders methods (notably toArray() and partitioned()). |
| src/ContentType.php | Swaps applicationPdf() / applicationJson() order and updates docblocks accordingly. |
| src/Code.php | Reorders static/instance helpers (isSuccessCode, message, isInformational, etc.). |
| src/Client/Response.php | Reorders raw() vs code() methods. |
| src/Client/Request.php | Reorders factory methods and changes optional parameter ordering; moves queryParameters() below withHeader(). |
| src/Charset.php | Reorders enum cases. |
| src/Body.php | Moves fromServerRequest() and toArray() to satisfy ordering. |
| src/Attribute.php | Reorders toBoolean() / toInteger() and updates docblocks. |
| .claude/rules/php-library-testing.md | Clarifies what non-test methods are allowed and references test-class sub-grouping. |
| .claude/rules/php-library-code-style.md | Updates the ordering rules (name-length based) and modifies PHPDoc policy wording. |
Comments suppressed due to low confidence (2)
src/Internal/Server/Stream/StreamFactory.php:42
- Member ordering within the static-method group doesn’t follow the repo’s name-length ordering rule:
toJsonFrom(9 chars) is placed afterfromStream(10 chars). Reorder the static methods so shorter names come first (e.g.,fromBody→toJsonFrom→fromStream→fromEmptyBody).
public static function fromStream(StreamInterface $stream): StreamFactory
{
if ($stream->isSeekable()) {
$stream->rewind();
}
tests/Unit/CookieTest.php:47
- Same as above: this multi-line
@Given/@When/@Thendocblock doesn’t match the required Given/When/Then step-block format used throughout the test suite. Please convert to separate BDD step comments.
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.
Summary
What this pull request does.
Related issue
Closes #...
Checklist
composer reviewpasses.composer testspasses.