PSR-7 compliance in response status and stream IO.#54
Merged
gustavofreze merged 1 commit intomainfrom Apr 20, 2026
Merged
Conversation
There was a problem hiding this comment.
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-consuminggetContents()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. |
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.
No description provided.