Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.1 compatibility #372

Merged
merged 2 commits into from Jul 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions idiorm.php
Expand Up @@ -2209,21 +2209,25 @@ public function delete_many() {
// --- ArrayAccess --- //
// --------------------- //

#[\ReturnTypeWillChange]
public function offsetExists($key) {
return array_key_exists($key, $this->_data);
}

#[\ReturnTypeWillChange]
public function offsetGet($key) {
return $this->get($key);
}

#[\ReturnTypeWillChange]
public function offsetSet($key, $value) {
if(is_null($key)) {
throw new InvalidArgumentException('You must specify a key/array index.');
}
$this->set($key, $value);
}

#[\ReturnTypeWillChange]
public function offsetUnset($key) {
unset($this->_data[$key]);
unset($this->_dirty_fields[$key]);
Expand Down Expand Up @@ -2445,6 +2449,7 @@ public function as_array() {
* Get the number of records in the result set
* @return int
*/
#[\ReturnTypeWillChange]
public function count() {
return count($this->_results);
}
Expand All @@ -2454,6 +2459,7 @@ public function count() {
* over the result set.
* @return \ArrayIterator
*/
#[\ReturnTypeWillChange]
public function getIterator() {
return new ArrayIterator($this->_results);
}
Expand All @@ -2463,6 +2469,7 @@ public function getIterator() {
* @param int|string $offset
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset) {
return isset($this->_results[$offset]);
}
Expand All @@ -2472,6 +2479,7 @@ public function offsetExists($offset) {
* @param int|string $offset
* @return mixed
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset) {
return $this->_results[$offset];
}
Expand All @@ -2481,6 +2489,7 @@ public function offsetGet($offset) {
* @param int|string $offset
* @param mixed $value
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value) {
$this->_results[$offset] = $value;
}
Expand All @@ -2489,10 +2498,19 @@ public function offsetSet($offset, $value) {
* ArrayAccess
* @param int|string $offset
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset) {
unset($this->_results[$offset]);
}

public function __serialize() {
return $this->serialize();
}

public function __unserialize($data) {
$this->unserialize($data);
}

/**
* Serializable
* @return string
Expand Down