Location::offsetExists($offset) signature is not compatible with PHP 8.1
alies-dev opened this issue · 0 comments
alies-dev commented
NOTICE: PHP message: PHP Deprecated: Return type of Torann\GeoIP\Location::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/vendor/torann/geoip/src/Location.php on line 157
current implementation:
/**
* Determine if the given attribute exists.
*
* @param mixed $offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->$offset);
}
should be:
public function offsetExists(mixed $offset): bool
{
return isset($this->$offset);
}
or you can suppress it:
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return isset($this->$offset);
}
Why it's important:
Some teams prefer to setup PHP to throw an exception on E_DEPRECATED on local/dev env