Skip to content

[5.x] Add native parameter, return and property types - #66

Open
Hackwar wants to merge 2 commits into
joomla-framework:5.x-devfrom
Hackwar:5.x-native-types
Open

Hackwar wants to merge 2 commits into
joomla-framework:5.x-devfrom
Hackwar:5.x-native-types

Conversation

@Hackwar

@Hackwar Hackwar commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary of Changes

The package requires PHP ^8.3 but its API is typed only in docblocks, and Input::count() still carries #[\ReturnTypeWillChange]. This adds native parameter, return and property types to Input, Cookie, Files and Json (count(): int, exists(string $name): bool, get(string $name, mixed $default = null, $filter = 'cmd'): mixed, typed $options/$data/$inputs/$filter properties, ?array $source in the constructors, …). The full list is in the update guide.

Deliberately left untyped:

Depends on #65 (adds docs/v4-to-v5-update.md); this branch contains its commit until it is merged.

When 4.x-dev is merged up: the 4.x PRs add methods that must then get matching types, or PHP rejects the class: Input::__isset() from #63 (__isset(string $name): bool), and Json::getRawBody()/getRaw() from #60.

Testing Instructions

The existing test suite passes unchanged; PHPStan and PHPCS report no errors.

Documentation Changes Required

docs/v4-to-v5-update.md: new section listing the typed signatures and what subclasses and callers need to check.

Depends on #65

🤖 Generated with Claude Code

Hackwar and others added 2 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>
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