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

Update CaseInsensitiveArray.php

Open frontdevops opened this issue 3 years ago • 3 comments

Many errors in PHP 8.0.13+ and 8.1 like this:

Error(8192)("Return type of Postmark\Models\CaseInsensitiveArray::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 vendor/wildbit/postmark-php/src/Postmark/Models/CaseInsensitiveArray.php:39

frontdevops avatar Dec 07 '21 10:12 frontdevops

This PR is not the correct fix: the package supports PHP >= 7.0, see https://github.com/wildbit/postmark-php/blob/823ca5bdb6355e266986434fab9139406b6e6c13/composer.json#L10

This is a breaking change making the code PHP8+ only.

A better fix would be to follow the alternative suggestion:

or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

mfn avatar Dec 07 '21 12:12 mfn

Since PHP support for version 7.3 now has been dropped (https://www.php.net/supported-versions.php) suppressing the notice is not the better fix. Dropping PHP 7.x support and actually fixing the code seems the only right thing to do. Maybe do a major release for that to prevent PHP 7 users from auto updating.

malles avatar Jan 29 '22 12:01 malles

7.4 is still security supported until Nov 2022

mfn avatar Jan 29 '22 15:01 mfn