Skip to content

Issue/526 request multi file fields#527

Merged
armanist merged 5 commits into
softberg:masterfrom
armanist:issue/526-request-multi-file-fields
May 17, 2026
Merged

Issue/526 request multi file fields#527
armanist merged 5 commits into
softberg:masterfrom
armanist:issue/526-request-multi-file-fields

Conversation

@armanist
Copy link
Copy Markdown
Member

@armanist armanist commented May 17, 2026

Closes #526

Summary by CodeRabbit

  • Bug Fixes

    • Fixed handling of multipart requests containing multiple top-level file upload fields. Previously, only the first file field was properly processed. Now all uploaded files are correctly preserved and accessible during request handling.
  • Chores

    • Updated PHPStan static analysis baseline to level 7 for enhanced code quality validation.

Review Change Stack

@armanist armanist added the bug Something isn't working label May 17, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 17, 2026

Warning

Rate limit exceeded

@armanist has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 36 minutes and 41 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 774a9493-64cd-4b70-a371-df70343d4a38

📥 Commits

Reviewing files that changed from the base of the PR and between d7062fc and c454533.

📒 Files selected for processing (1)
  • src/Http/Traits/Request/File.php
📝 Walkthrough

Walkthrough

The pull request fixes a bug where multiple top-level uploaded file fields were lost during multipart request parsing. The handleFiles() method now iterates over all file entries instead of processing only the first key, preserving both single and multi-file fields. A test case validates the fix, and the changelog documents both this correction and a PHPStan baseline update.

Changes

Multipart File Handling Fix

Layer / File(s) Summary
Multiple top-level file fields parsing
src/Http/Traits/Request/File.php, tests/Unit/Http/Traits/Request/HttpRequestFileTest.php
handleFiles() refactored to iterate all $files entries, accumulating a $formatted map that preserves each key's structure (single UploadedFile or indexed array). New test testCreateWithMultipleTopLevelFileFields() validates both avatar and resume fields are available via hasFile() and getFile().
Changelog updates
CHANGELOG.md
Documented PHPStan static analysis baseline raised to level 7 and the multipart file parsing fix for issue #526.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

bug

Suggested reviewers

  • grigoryanmartin20
  • Wiltzsu
  • andrey-smaelov

Poem

🐰 Multiple files now dance in perfect sync,
No fields forgotten, preserved without a blink,
From avatar to résumé, all hold their place,
The parser works fast with newfound grace! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Issue/526 request multi file fields' directly addresses the main change—fixing multipart file handling for multiple top-level fields—matching the PR objectives.
Linked Issues check ✅ Passed The PR fully implements the proposed fix: refactored handleFiles() to iterate all top-level file keys, added regression test testCreateWithMultipleTopLevelFileFields, and updated changelog.
Out of Scope Changes check ✅ Passed All changes (handleFiles refactor, test case, changelog update) are directly aligned with resolving issue #526 and contain no out-of-scope modifications.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@armanist armanist added this to the 3.0.0 milestone May 17, 2026
@armanist armanist requested a review from andrey-smaelov May 17, 2026 16:28
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/Http/Traits/Request/File.php`:
- Around line 86-107: Run the project's PHP CS Fixer on
src/Http/Traits/Request/File.php and commit the formatted result; specifically,
reformat the method that builds $formatted (the loop that constructs
UploadedFile instances for both single and multiple files) so it complies with
php-cs-fixer rules (you can run the repository's formatter command, e.g.,
php-cs-fixer or the provided composer script) and re-add the updated file to the
PR.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fc238d1d-1cc2-48b6-b6cf-e39e3fb02c11

📥 Commits

Reviewing files that changed from the base of the PR and between a864bd0 and d7062fc.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/Http/Traits/Request/File.php
  • tests/Unit/Http/Traits/Request/HttpRequestFileTest.php

Comment thread src/Http/Traits/Request/File.php
@codecov
Copy link
Copy Markdown

codecov Bot commented May 17, 2026

Codecov Report

❌ Patch coverage is 90.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.86%. Comparing base (a864bd0) to head (c454533).

Files with missing lines Patch % Lines
src/Http/Traits/Request/File.php 90.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #527      +/-   ##
============================================
- Coverage     90.87%   90.86%   -0.01%     
- Complexity     3070     3078       +8     
============================================
  Files           263      263              
  Lines          8100     8115      +15     
============================================
+ Hits           7361     7374      +13     
- Misses          739      741       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@armanist armanist merged commit f95a94e into softberg:master May 17, 2026
6 of 7 checks passed
@armanist armanist deleted the issue/526-request-multi-file-fields branch May 17, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Request file handling drops multiple top-level uploaded file fields

2 participants