Skip to content

Add a native return type to offsetGet() - #106

Merged
GrahamCampbell merged 1 commit into
3.0from
add-offsetget-return-type-3.0
Nov 20, 2026
Merged

GrahamCampbell merged 1 commit into
3.0from
add-offsetget-return-type-3.0

Conversation

@GrahamCampbell

@GrahamCampbell GrahamCampbell commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

HasDataTrait::offsetGet(), which Command and Result use, was the only method left on this branch that carried #[\ReturnTypeWillChange] instead of a return type, because PHP 7.4 has no mixed type. With PHP 8.0 as the minimum it now declares mixed and the attribute is removed.

This is a deliberate break for the major release. A class that extends Command, Result, or any other class that takes offsetGet() from the trait, and overrides it without a return type, no longer loads, and putting the attribute on the override does not change that, so the 3.0 upgrade guide says what such classes need. Custom implementations of CommandInterface and ResultInterface that do not use the trait are not affected.

@GrahamCampbell
GrahamCampbell force-pushed the add-offsetget-return-type-3.0 branch from d4eb9e0 to f2f6af8 Compare November 20, 2026 16:51
@GrahamCampbell
GrahamCampbell marked this pull request as ready for review November 20, 2026 17:18
@GrahamCampbell
GrahamCampbell merged commit 51865bb into 3.0 Nov 20, 2026
22 checks passed
@GrahamCampbell
GrahamCampbell deleted the add-offsetget-return-type-3.0 branch November 20, 2026 17:18
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