CyberSource / cybersource-rest-client-php

PHP client library for the CyberSource REST API
27 stars 65 forks source link

Issue with PHP 8.1 #117

Open devdeepcoderin opened 1 year ago

devdeepcoderin commented 1 year ago

Getting below error when using PHP 8.1,

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 /var/www/html/vendor/cybersource/rest-client-php/lib/Model/GeneratePublicKeyRequest.php on line 221

is there any other LIB i need to use ?

TechN8 commented 1 year ago

This seems to be the same issue as mentioned in #89 .

PHP 8.1 is warning that the return type of the functions doesn't match that of the base class they are extending / using.

If you don't need to maintain backwards compatibility to PHP5, the return types can be added.

To maintain backwards compatibility (at least until these warnings become errors). These warnings can be suppressed by adding #[\ReturnTypeWillChange] to the doc blocks in your mustache files and regenerating the code. Example model_generic.mustache

If this isn't something you plan to change soon, would you be open to a PR?