mux-php icon indicating copy to clipboard operation
mux-php copied to clipboard

Return Type Exceptions with PHP 8.1

Open mojowill opened this issue 3 years ago • 2 comments

A lot of Models are generating return type exceptions for us in our application:

PHP 8.1.4 Mux PHP SDK 3.3.1

Return type of MuxPhp\Models\AssetResponse::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mojowill/Sites/work/media-manager-3/vendor/muxinc/mux-php/MuxPhp/Models/AssetResponse.php on line 245

Return type of MuxPhp\Models\CreateAssetRequest::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mojowill/Sites/work/media-manager-3/vendor/muxinc/mux-php/MuxPhp/Models/CreateAssetRequest.php on line 523

Return type of MuxPhp\Models\AssetResponse::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/mojowill/Sites/work/media-manager-3/vendor/muxinc/mux-php/MuxPhp/Models/AssetResponse.php on line 257

There are lots more I haven't pasted in. Is it possible to get a fix?

Adding #[ReturnTypeWillChange] to all models should silence any notices/errors in PHP 8.1 without affecting older versions of PHP.

mojowill avatar Apr 01 '22 11:04 mojowill

Thanks for reporting this. We'll take a look and see if we can make this work better.

jaredsmith avatar Apr 04 '22 14:04 jaredsmith

Can you please test to see if the new 3.8.0 release works better in this regard, please?

jaredsmith avatar Aug 25 '22 13:08 jaredsmith