Skip to content

Commit

Permalink
add annotations for php 8.1 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronpk committed Mar 26, 2022
1 parent d23f970 commit 96dba46
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions idiorm.php
Original file line number Diff line number Diff line change
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,6 +2498,7 @@ public function offsetSet($offset, $value) {
* ArrayAccess
* @param int|string $offset
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset) {
unset($this->_results[$offset]);
}
Expand Down

0 comments on commit 96dba46

Please sign in to comment.