Skip to content

PSR-7 compliance in response status and stream IO.#54

Merged
gustavofreze merged 1 commit intomainfrom
feature/develop
Apr 20, 2026
Merged

PSR-7 compliance in response status and stream IO.#54
gustavofreze merged 1 commit intomainfrom
feature/develop

Conversation

@gustavofreze
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 20, 2026 16:39
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 PR aims to improve PSR-7 alignment around stream reading semantics and response status handling, and updates supporting tests and project tooling/docs accordingly.

Changes:

  • Adjust stream behavior to follow PSR-7 expectations (notably getContents() reading from the current pointer; resource validity checks).
  • Make ResponseInterface::withStatus() return a new response instead of throwing, and update tests to avoid pointer-consuming getContents() assertions.
  • Refresh project configuration/docs (composer normalization, .editorconfig, .gitattributes, README, mutation-testing config).

Reviewed changes

Copilot reviewed 22 out of 23 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/ResponseTest.php Updates response body assertions to use __toString() and replaces withStatus exception test with success-path test.
tests/RequestTest.php Switches PHPUnit doubles from mocks to stubs for PSR-7 interfaces.
tests/Internal/Stream/StreamTest.php Adds coverage for seekability when an underlying resource is externally closed.
tests/Internal/Stream/StreamFactoryTest.php Switches PHPUnit doubles to stubs for stream behavior tests.
tests/Internal/Request/RouteParameterResolverTest.php Switches request doubles to stubs.
tests/Drivers/Slim/SlimTest.php Avoids getContents() pointer side effects by comparing bodies via __toString().
tests/Drivers/Laminas/LaminasTest.php Avoids getContents() pointer side effects by comparing bodies via __toString().
src/Internal/Stream/Stream.php Updates readability detection, getContents() semantics, and resource validity checks.
src/Internal/Response/InternalResponse.php Implements withStatus() by returning a new response instance instead of throwing.
src/Internal/Exceptions/BadMethodCall.php Removes an internal exception no longer used after withStatus() change.
infection.json.dist Disables the ProtectedVisibility mutator.
composer.json Normalizes metadata, updates dev dependencies, adds composer-normalize plugin config, and adjusts scripts ordering.
README.md Updates package overview wording.
Makefile Runs composer normalize during configure; adds show-outdated; updates help output.
.gitignore Reorders .phpunit.* ignore entry.
.gitattributes Adds LF normalization/diff drivers and revises export-ignore list.
.editorconfig Adds editor configuration for consistent formatting.
.claude/rules/php-library-testing.md Reflows/updates testing rules documentation.
.claude/rules/php-library-modeling.md Adds new library modeling rules document.
.claude/rules/php-library-documentation.md Refines documentation rules (including standalone examples requirement).
.claude/rules/php-library-code-style.md Updates/expands code-style rules, including complexity and PSR-12 brace guidance.
.claude/rules/php-domain.md Removes legacy domain rules document.
.claude/CLAUDE.md Updates project description to library context and clarifies commands/formatting rules.

Comment thread src/Internal/Response/InternalResponse.php
Comment thread src/Internal/Response/InternalResponse.php
Comment thread src/Internal/Stream/Stream.php
Comment thread infection.json.dist
Comment thread .gitattributes
Comment thread .gitattributes
Comment thread .claude/CLAUDE.md
@gustavofreze gustavofreze merged commit 6c4b035 into main Apr 20, 2026
10 checks passed
@gustavofreze gustavofreze deleted the feature/develop branch April 20, 2026 16:47
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