Skip to content

[5.x] Throw a LogicException from Files::set() and Files::def() - #68

Open
Hackwar wants to merge 3 commits into
joomla-framework:5.x-devfrom
Hackwar:5.x-files-readonly-exception
Open

Hackwar wants to merge 3 commits into
joomla-framework:5.x-devfrom
Hackwar:5.x-files-readonly-exception

Conversation

@Hackwar

@Hackwar Hackwar commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary of Changes

Uploaded files are read-only, but Files::set() silently does nothing (so callers believe the value was stored), and the inherited def() writes into the data. This is the 5.0 step: set() and def() throw a LogicException.

Depends on #66 (native types; Files::def() uses the typed Input::def() signature) and #65 (update guide); this branch contains their commits until they are merged.

Testing Instructions

FilesTest::testSet() now expects the exception, and the new testDef() checks that def() throws and does not write. Both fail before the change and pass after it.

Documentation Changes Required

docs/overview.md ("Uploaded files"): set() and def() throw. docs/v4-to-v5-update.md: new section.

Depends on #66

🤖 Generated with Claude Code

Hackwar and others added 3 commits November 13, 2026 06:41
Several 5.x changes add entries to docs/v4-to-v5-update.md; creating the
file once keeps them from conflicting over its creation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The package requires PHP 8.3 but still declared its API in docblocks,
and count() carried #[\ReturnTypeWillChange]. Parameters, return values
and properties are now typed natively. set() keeps an untyped return
value because Cookie::set() returns whether the cookie was sent, and the
$filter argument of get() stays untyped until getArray() no longer passes
input values as filter names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Uploaded files are read-only. set() silently did nothing and the
inherited def() wrote into the data; both now throw a LogicException so
that callers notice instead of believing the value was stored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant