Skip to content

Apply name-length ordering across src and tests.#58

Merged
gustavofreze merged 2 commits into
mainfrom
fix/request
May 22, 2026
Merged

Apply name-length ordering across src and tests.#58
gustavofreze merged 2 commits into
mainfrom
fix/request

Conversation

@gustavofreze
Copy link
Copy Markdown
Member

@gustavofreze gustavofreze commented May 22, 2026

Please follow the contributing guidelines.

Summary

What this pull request does.

Related issue

Closes #...

Checklist

  • Tests added or updated.
  • Documentation updated when applicable.
  • composer review passes.
  • composer tests passes.

gustavofreze and others added 2 commits May 22, 2026 11:49
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 22, 2026 14:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 .claude rule 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 after fromStream (10 chars). Reorder the static methods so shorter names come first (e.g., fromBodytoJsonFromfromStreamfromEmptyBody).
    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/@Then docblock doesn’t match the required Given/When/Then step-block format used throughout the test suite. Please convert to separate BDD step comments.

Comment thread tests/Unit/CookieTest.php
Comment thread src/Client/Request.php
Comment thread .claude/rules/php-library-code-style.md
@gustavofreze gustavofreze merged commit 2414bf9 into main May 22, 2026
11 checks passed
@gustavofreze gustavofreze deleted the fix/request branch May 22, 2026 14:59
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