webapix / mygls-sdk

An unofficial lightweight PHP SDK for the MyGLS (GLS logistics) REST API.
MIT License
28 stars 10 forks source link

Add return type declaration to implement ArrayAccess interface in PHP 8.1 #19

Closed arwin009 closed 10 months ago

arwin009 commented 1 year ago

https://github.com/webapix/mygls-sdk/blob/abc87c34ac3415e0bcf7c02228fb9349268bdf0b/src/Responses/Response.php#L51 https://github.com/webapix/mygls-sdk/blob/abc87c34ac3415e0bcf7c02228fb9349268bdf0b/src/Responses/Response.php#L62 https://github.com/webapix/mygls-sdk/blob/abc87c34ac3415e0bcf7c02228fb9349268bdf0b/src/Responses/Response.php#L76 https://github.com/webapix/mygls-sdk/blob/abc87c34ac3415e0bcf7c02228fb9349268bdf0b/src/Responses/Response.php#L89

These methods should have return types declared to be compatible with PHP 8.1:

interface ArrayAccess {
    /* Methods */
    public offsetExists(mixed $offset): bool
    public offsetGet(mixed $offset): mixed
    public offsetSet(mixed $offset, mixed $value): void
    public offsetUnset(mixed $offset): void
}
zsocakave commented 10 months ago

New version released, 2.x now PHP8.1 compatible.

arwin009 commented 10 months ago

Thank you!