gateio / gateapi-php

29 stars 34 forks source link

Deprecated in PHP 8 #12

Open allanmcarvalho opened 2 years ago

allanmcarvalho commented 2 years ago

The warning: Deprecated (8192): Return type of GateApi\Model\Ticker::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

I don't know if the same error is on the other models or parts of the library.

revilwang commented 2 years ago

Sorry for the late reply. Since PHP 8, ArrayAccess interface the Ticker model implements from adds a bool return type for its method offsetExists, but the Ticker model doesn't specify the return type, causing PHP 8 reports a warning(actually the Ticker model returns bool too).

We'll add the return type explicitly in Ticker model(and other models inherits from ArrayAccess) to avoid such warnings.