Skip to content

Refactor UploadedFile and introduce UploadError enum#8

Merged
Vyacheslav86RUS merged 6 commits into
mainfrom
refactor/uploaded-file
Mar 13, 2026
Merged

Refactor UploadedFile and introduce UploadError enum#8
Vyacheslav86RUS merged 6 commits into
mainfrom
refactor/uploaded-file

Conversation

@Vyacheslav86RUS
Copy link
Copy Markdown
Contributor

Summary

Refactors the UploadedFile implementation to improve error handling, stream safety, and internal structure.

Introduces a new UploadError enum to represent PHP upload error codes in a type-safe way.

Changes

  • Added UploadError enum (Philharmony\Http\Message\Enum\UploadError)
  • Refactored UploadedFile to internally use the enum
  • Improved stream copy logic in UploadedFile::moveTo()
  • Added cleanup logic when stream copy fails
  • Added tests covering error handling and failure scenarios
  • Minor internal refactoring and improvements

Tests

  • Added tests for UploadError
  • Added test covering stream read failure and file cleanup
  • Achieved full test coverage for UploadedFile

BC Breaks

None. Public PSR-7 API remains unchanged.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Vyacheslav86RUS Vyacheslav86RUS merged commit c9d7073 into main Mar 13, 2026
7 checks passed
@Vyacheslav86RUS Vyacheslav86RUS deleted the refactor/uploaded-file branch March 13, 2026 13:00
@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