You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using PHP 8.x and the lack of a return type :mixed on the various library JsonSerialize functions throws out warnings all over the place when using the lib in newer php.
There are a couple of fixes. For newer php, the preferred method is to add the :mixed return type on any definitions of JsonSerialize so they are compatible with the interface.
// Json Serialize Code
public function jsonSerialize(): mixed { /* code */ }
But you can also add a comment above the function that older version of php will ignore and newer ones will suppress the warning.
e.g.:
// Json Serialize Code
#[\ReturnTypeWillChange]
public function jsonSerialize() { /* code */ }
I'm using PHP 8.x and the lack of a return type :mixed on the various library JsonSerialize functions throws out warnings all over the place when using the lib in newer php.
There are a couple of fixes. For newer php, the preferred method is to add the :mixed return type on any definitions of JsonSerialize so they are compatible with the interface.
But you can also add a comment above the function that older version of php will ignore and newer ones will suppress the warning.
e.g.:
See ReturnTypeWillChange
The text was updated successfully, but these errors were encountered: