Problem/Motivation

In PHP 8.1 a tentative return type was added to the method: JsonSerializable::jsonSerialize()

These trigger a deprecation warning on existing code. Code that is compatible with PHP 8.1 only can add the return type now, for backward compatibility we can declare #[ReturnTypeWillChange] which silences the warning and tells PHP we will add the return type later on.

Proposed resolution

Add #[ReturnTypeWillChange] to jsonSerialize method.

CommentFileSizeAuthor
#2 3278937.patch475 bytesnsavitsky

Comments

nsavitsky created an issue. See original summary.

nsavitsky’s picture

StatusFileSize
new475 bytes
dewalt’s picture

Status: Active » Needs review
Issue tags: +PHP 8.1
Related issues: +#3224523: [PHP 8.1] Add ReturnTypeWillChange attribute where necessary

  • dewalt committed 8bfd6c0 on 8.x-1.x authored by nsavitsky
    Issue #3278937 by nsavitsky: [PHP 8.1] Deprecated function: Return type...
dewalt’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.