Skip to content

Make file size messages human-readable#803

Open
samdark wants to merge 1 commit into
masterfrom
issue-802-file-size-messages
Open

Make file size messages human-readable#803
samdark wants to merge 1 commit into
masterfrom
issue-802-file-size-messages

Conversation

@samdark
Copy link
Copy Markdown
Member

@samdark samdark commented Jun 4, 2026

Resolves #802.

Summary

  • Format File size placeholders as human-readable values for {limit} and {exactly}.
  • Update default File size messages to use the formatted placeholders directly.
  • Add regression coverage and document the placeholder behavior.

Tests

  • vendor/bin/phpunit tests/Rule/FileTest.php --testdox
  • vendor/bin/psalm --config=psalm.xml --output-format=console --no-cache --threads=1
  • vendor/bin/php-cs-fixer fix --dry-run --diff --sequential --allow-unsupported-php-version=yes

Full vendor/bin/phpunit was also run; it fails only on existing EmailTest DNS-dependent cases for gmail.com and ñandu.cl domains in this environment.

Copilot AI review requested due to automatic review settings June 4, 2026 19:00
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 updates the File validation rule to render size-related placeholders ({limit}, {exactly}) as human-readable values (e.g. 50 MB) instead of raw byte counts, and aligns defaults, tests, and documentation with that behavior.

Changes:

  • Format {limit} / {exactly} placeholders as human-readable sizes in FileHandler.
  • Update default File size messages to use {limit} / {exactly} directly (no ICU number/plural formatting).
  • Add regression tests and document the new placeholder behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
src/Rule/FileHandler.php Formats size placeholders before they’re passed into error message parameters.
src/Rule/File.php Updates default size messages and placeholder documentation to reflect human-readable sizing.
tests/Rule/FileTest.php Adds/updates regression cases asserting new human-readable size output.
docs/guide/en/built-in-rules-file.md Documents that size placeholders are now human-readable.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Rule/FileHandler.php Outdated
Comment thread src/Rule/FileHandler.php
Comment thread src/Rule/File.php
Comment thread src/Rule/File.php
Comment thread docs/guide/en/built-in-rules-file.md Outdated
Comment thread tests/Rule/FileTest.php
@samdark samdark force-pushed the issue-802-file-size-messages branch from 4700917 to 3dfc85b Compare June 4, 2026 19:16
@samdark samdark requested a review from Copilot June 4, 2026 19:57
@samdark samdark force-pushed the issue-802-file-size-messages branch 2 times, most recently from 79319f6 to b4e4c86 Compare June 4, 2026 20:00
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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread src/Rule/FileHandler.php Outdated
Comment thread src/Rule/File.php Outdated
Comment thread CHANGELOG.md Outdated
@samdark samdark force-pushed the issue-802-file-size-messages branch 5 times, most recently from 53fb650 to 7d12a71 Compare June 4, 2026 21:41
@samdark samdark requested review from a team and Copilot June 4, 2026 22:06
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

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Comment thread tests/Rule/FileTest.php Outdated
Comment thread src/Rule/FileHandler.php
@samdark samdark force-pushed the issue-802-file-size-messages branch from 7d12a71 to f93aa4a Compare June 5, 2026 20:38
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.

Make File size validation messages human-readable

2 participants