Skip to content

Remove #[\ReturnTypeWillChange] in favor of proper return types#50

Merged
voku merged 2 commits intomasterfrom
copilot/fix-php-compatibility-warnings
Apr 13, 2026
Merged

Remove #[\ReturnTypeWillChange] in favor of proper return types#50
voku merged 2 commits intomasterfrom
copilot/fix-php-compatibility-warnings

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 11, 2026

PHP 8.4 deprecated implicitly nullable parameter types, which was fixed in #43. This PR completes the cleanup by replacing #[\ReturnTypeWillChange] suppression attributes with actual return type declarations, now that minimum PHP is 8.0.

  • jsonSerialize(): mixed — matches JsonSerializable interface
  • offsetSet(): void — matches ArrayAccess interface
  • offsetUnset(): void — matches ArrayAccess interface
// Before: suppress the deprecation
#[\ReturnTypeWillChange]
public function jsonSerialize() { ... }

// After: declare the type
public function jsonSerialize(): mixed { ... }

This change is Reviewable

Copilot AI linked an issue Apr 11, 2026 that may be closed by this pull request
…eWillChange] attributes

Agent-Logs-Url: https://github.com/voku/Stringy/sessions/21daae3c-674b-4017-a3fa-56be4ba82c53

Co-authored-by: voku <264695+voku@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix PHP 8.4 deprecation warnings Remove #[\ReturnTypeWillChange] in favor of proper return types Apr 11, 2026
Copilot finished work on behalf of voku April 11, 2026 21:08
Copilot AI requested a review from voku April 11, 2026 21:08
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 97.987%. remained the same — copilot/fix-php-compatibility-warnings into master

@voku voku marked this pull request as ready for review April 13, 2026 01:54
@voku voku merged commit 0f66f2b into master Apr 13, 2026
13 of 14 checks passed
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.

PHP 8.4 deprecation warnings

3 participants