Skip to content

Feature/stream improvements#7

Merged
Vyacheslav86RUS merged 4 commits into
mainfrom
feature/stream-improvements
Mar 11, 2026
Merged

Feature/stream improvements#7
Vyacheslav86RUS merged 4 commits into
mainfrom
feature/stream-improvements

Conversation

@Vyacheslav86RUS
Copy link
Copy Markdown
Contributor

Stream improvements

This PR improves the internal behavior and reliability of the Stream implementation.

Changes

Refactoring

  • Simplified stream mode detection using dynamic checks instead of static mode lists
  • Improved close() implementation and resource cleanup
  • Safer internal state handling ($this->stream = null after closing)

Behavior Improvements

  • Automatic rewind when creating a stream from a non-empty string
  • More robust size detection using fstat()
  • __toString() now safely catches Throwable as recommended by PSR-7

Testing

  • Refactored and reorganized StreamTest
  • Added additional edge cases
  • Improved append mode pointer behaviour tests

Result

  • More predictable stream behavior
  • Cleaner and safer internal implementation
  • Improved test coverage and readability

No breaking changes.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Vyacheslav86RUS Vyacheslav86RUS merged commit bbde65b into main Mar 11, 2026
13 checks passed
@Vyacheslav86RUS Vyacheslav86RUS deleted the feature/stream-improvements branch March 11, 2026 16:07
@Vyacheslav86RUS Vyacheslav86RUS self-assigned this Mar 13, 2026
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