diff --git a/lib/activities/Stream.php b/lib/activities/Stream.php index c63e238f4c9381f7176d67c7392e0c49f174bc07..6b64eff6cfbf6dd6e430b2ebad787b7f8232a533 100644 --- a/lib/activities/Stream.php +++ b/lib/activities/Stream.php @@ -79,7 +79,10 @@ class Stream implements \ArrayAccess, \Countable, \IteratorAggregate /** * ArrayAccess: Check whether the given offset exists. + * + * @todo Add bool return type when Stud.IP requires PHP8 minimal */ + #[\ReturnTypeWillChange] public function offsetExists($offset) { return isset($this->activities[$offset]); @@ -87,7 +90,10 @@ class Stream implements \ArrayAccess, \Countable, \IteratorAggregate /** * ArrayAccess: Get the value at the given offset. + * + * @todo Add mixed return type when Stud.IP requires PHP8 minimal */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->activities[$offset]; @@ -95,7 +101,10 @@ class Stream implements \ArrayAccess, \Countable, \IteratorAggregate /** * ArrayAccess: Set the value at the given offset. + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->activities[$offset] = $value; @@ -103,7 +112,10 @@ class Stream implements \ArrayAccess, \Countable, \IteratorAggregate /** * ArrayAccess: unset the value at the given offset (not applicable) + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[\ReturnTypeWillChange] public function offsetUnset($offset) { unset($this->activities[$offset]); @@ -111,7 +123,10 @@ class Stream implements \ArrayAccess, \Countable, \IteratorAggregate /** * IteratorAggregate + * + * @todo Add \Traversable return type when Stud.IP requires PHP8 minimal */ + #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator($this->activities); @@ -119,10 +134,13 @@ class Stream implements \ArrayAccess, \Countable, \IteratorAggregate /** * Countable + * + * @todo Add int return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function count() { - return sizeof($this->activities); + return count($this->activities); } /** diff --git a/lib/classes/Config.class.php b/lib/classes/Config.class.php index f977bb9d5c365bf504172454fa1e4894cea3eb1b..4d57f0f3338a7b6825a40b54be0317ccf172ee1a 100644 --- a/lib/classes/Config.class.php +++ b/lib/classes/Config.class.php @@ -153,11 +153,15 @@ class Config implements ArrayAccess, Countable, IteratorAggregate /** * IteratorAggregate + * + * @todo Add Traversable return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function getIterator() { return new ArrayIterator($this->data); } + /** * magic method for dynamic properties */ @@ -165,6 +169,7 @@ class Config implements ArrayAccess, Countable, IteratorAggregate { return $this->getValue($field); } + /** * magic method for dynamic properties */ @@ -172,6 +177,7 @@ class Config implements ArrayAccess, Countable, IteratorAggregate { return $this->setValue($field, $value); } + /** * magic method for dynamic properties */ @@ -179,37 +185,57 @@ class Config implements ArrayAccess, Countable, IteratorAggregate { return isset($this->data[$field]); } + /** * ArrayAccess: Check whether the given offset exists. + * + * @todo Add bool return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetExists($offset) { return isset($this->$offset); } + /** * ArrayAccess: Get the value at the given offset. + * + * @todo Add mixed return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetGet($offset) { return $this->$offset; } + /** * ArrayAccess: Set the value at the given offset. + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->$offset = $value; } + /** * ArrayAccess: unset the value at the given offset (not applicable) + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetUnset($offset) { } + /** * Countable + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function count() { return count($this->data); diff --git a/lib/classes/I18NString.php b/lib/classes/I18NString.php index 63c8ba64766c9e25af8f757e1de2d7a87bdb8425..353062eebd0f8dd155fb14929f5efbae781db3cf 100644 --- a/lib/classes/I18NString.php +++ b/lib/classes/I18NString.php @@ -80,7 +80,10 @@ class I18NString implements JsonSerializable * Return the JSON representation of this i18n field in selected language. * * @return string + * + * @todo Add mixed return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function jsonSerialize() { return (string) $this; diff --git a/lib/classes/JsonApi/Middlewares/StudipMockNavigation.php b/lib/classes/JsonApi/Middlewares/StudipMockNavigation.php index 0bce8a41fd8226a5111f7da99b6a6e78c057e683..34225d4ad832e827a2d6c2cfe4a2cc26f37b45d4 100644 --- a/lib/classes/JsonApi/Middlewares/StudipMockNavigation.php +++ b/lib/classes/JsonApi/Middlewares/StudipMockNavigation.php @@ -18,7 +18,10 @@ class DummyNavigation extends \Navigation implements \ArrayAccess /** * ArrayAccess: Check whether the given offset exists. + * + * @todo Add bool return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetExists($offset) { return true; @@ -26,7 +29,10 @@ class DummyNavigation extends \Navigation implements \ArrayAccess /** * ArrayAccess: Get the value at the given offset. + * + * @todo Add mixed return type when Stud.IP requires PHP8 minimal */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this; @@ -34,21 +40,30 @@ class DummyNavigation extends \Navigation implements \ArrayAccess /** * ArrayAccess: Set the value at the given offset. + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { } /** * ArrayAccess: Delete the value at the given offset. + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[\ReturnTypeWillChange] public function offsetUnset($offset) { } /** * IteratorAggregate: Create interator for request parameters. + * + * @todo Add \Traversable return type when Stud.IP requires PHP8 minimal */ + #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator(); @@ -58,8 +73,8 @@ class DummyNavigation extends \Navigation implements \ArrayAccess class StudipMockNavigation { /** - * @param Request $request das PSR-7 Request-Objekt - * @param RequestHandlerInterface $handler das PSR-7 Response-Objekt + * @param Request $request das PSR-7 Request-Objekt + * @param RequestHandler $handler das PSR-7 Response-Objekt * * @return ResponseInterface die neue Response */ diff --git a/lib/classes/MultiDimArrayObject.class.php b/lib/classes/MultiDimArrayObject.class.php index 8af74a7ea74bbe35d5fab1d6e9ecf077c2c0a100..459578f5ca6af7dde990b2c2fbd6f0b655cf2f80 100644 --- a/lib/classes/MultiDimArrayObject.class.php +++ b/lib/classes/MultiDimArrayObject.class.php @@ -80,7 +80,10 @@ class MultiDimArrayObject extends StudipArrayObject * Create a new iterator from an ArrayObject instance * * @return \Iterator + * + * @todo Add Traversable return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function getIterator() { $class = $this->iteratorClass; @@ -94,7 +97,10 @@ class MultiDimArrayObject extends StudipArrayObject * @param mixed $key * @param mixed $value * @return void + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetSet($key, $value) { $new_value = $this->recursiveArrayToArrayObjects($value); @@ -103,9 +109,10 @@ class MultiDimArrayObject extends StudipArrayObject $new_value = new $class($new_value, $this->getFlags(), $this->getIteratorClass()); } if (is_null($key)) { - return $this->storage[] = $new_value; + $this->storage[] = $new_value; + } else { + $this->storage[$key] = $new_value; } - $this->storage[$key] = $new_value; } protected function recursiveArrayToArrayObjects($data) diff --git a/lib/classes/Request.class.php b/lib/classes/Request.class.php index 74b0a8a10f7fac7be0b7005d3def90aed1be8e81..27ed629595d7ca395687ff637c7eedd28a8e8bf7 100644 --- a/lib/classes/Request.class.php +++ b/lib/classes/Request.class.php @@ -45,7 +45,10 @@ class Request implements ArrayAccess, IteratorAggregate /** * ArrayAccess: Check whether the given offset exists. + * + * @todo Add bool return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetExists($offset) { return isset($this->params[$offset]); @@ -53,7 +56,10 @@ class Request implements ArrayAccess, IteratorAggregate /** * ArrayAccess: Get the value at the given offset. + * + * @todo Add mixed return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetGet($offset) { return $this->params[$offset] ?? null; @@ -61,7 +67,10 @@ class Request implements ArrayAccess, IteratorAggregate /** * ArrayAccess: Set the value at the given offset. + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->params[$offset] = $value; @@ -69,7 +78,10 @@ class Request implements ArrayAccess, IteratorAggregate /** * ArrayAccess: Delete the value at the given offset. + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetUnset($offset) { unset($this->params[$offset]); @@ -77,7 +89,10 @@ class Request implements ArrayAccess, IteratorAggregate /** * IteratorAggregate: Create interator for request parameters. + * + * @todo Add Traversable return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function getIterator() { return new ArrayIterator((array)$this->params); diff --git a/lib/classes/SemClass.class.php b/lib/classes/SemClass.class.php index b6ccb82e9903f67c12574f13a39ebc2d41e1e86b..862747f06964f2bbab49704d5d4db47c1cec5810 100644 --- a/lib/classes/SemClass.class.php +++ b/lib/classes/SemClass.class.php @@ -488,7 +488,10 @@ class SemClass implements ArrayAccess * deprecated, does nothing, should not be used * @param string $offset * @param mixed $value + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetSet($offset, $value) { } @@ -498,7 +501,10 @@ class SemClass implements ArrayAccess * new array-structure to the old boolean values. * @param integer $offset: name of attribute * @return boolean|(localized)string + * + * @todo Add mixed return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetGet($offset) { switch ($offset) { @@ -533,7 +539,10 @@ class SemClass implements ArrayAccess * ArrayAccess method to check if an attribute exists. * @param int $offset * @return bool + * + * @todo Add bool return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetExists($offset) { return isset($this->data[$offset]); @@ -542,7 +551,10 @@ class SemClass implements ArrayAccess /** * deprecated, does nothing, should not be used * @param string $offset + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetUnset($offset) { } diff --git a/lib/classes/SemType.class.php b/lib/classes/SemType.class.php index 0db463ac2b210470c822374b605bc1e49b350e7c..88244065edf6ded03812509b4aea8ebbf733f3f1 100644 --- a/lib/classes/SemType.class.php +++ b/lib/classes/SemType.class.php @@ -119,7 +119,10 @@ class SemType implements ArrayAccess * deprecated, does nothing, should not be used * @param string $offset * @param mixed $value + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetSet($offset, $value) { } @@ -129,7 +132,10 @@ class SemType implements ArrayAccess * new array-structure to the old boolean values. * @param integer $offset: name of attribute * @return boolean|(localized)string + * + * @todo Add mixed return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetGet($offset) { switch ($offset) { @@ -146,9 +152,12 @@ class SemType implements ArrayAccess /** * ArrayAccess method to check if an attribute exists. - * @param type $offset - * @return type + * @param mixed $offset + * @return bool + * + * @todo Add bool return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetExists($offset) { return isset($this->data[$offset]); @@ -157,7 +166,10 @@ class SemType implements ArrayAccess /** * deprecated, does nothing, should not be used * @param string $offset + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetUnset($offset) { } @@ -256,4 +268,3 @@ class SemType implements ArrayAccess } } - diff --git a/lib/classes/SessionDecoder.class.php b/lib/classes/SessionDecoder.class.php index c6715cd4265a11e62430932382a639eafc565303..8c0bc6b9c7d006b5cef5d4d1f8ae0b9ae937dbef 100644 --- a/lib/classes/SessionDecoder.class.php +++ b/lib/classes/SessionDecoder.class.php @@ -83,44 +83,98 @@ class SessionDecoder implements ArrayAccess, Countable, Iterator { return $this->var_names; } - public function rewind() { + /** + * @todo Add void return type when Stud.IP requires PHP8 minimal + */ + #[ReturnTypeWillChange] + public function rewind() + { reset($this->var_names); } - public function current() { + /** + * @todo Add mixed return type when Stud.IP requires PHP8 minimal + */ + #[ReturnTypeWillChange] + public function current() + { $current = current($this->var_names); return $current !== false ? $this->offsetGet($current) : false; } - public function key() { + /** + * @todo Add mixed return type when Stud.IP requires PHP8 minimal + */ + #[ReturnTypeWillChange] + public function key() + { return current($this->var_names); } - public function next() { - $next = next($this->var_names); - return $this->current(); + /** + * @todo Add void return type when Stud.IP requires PHP8 minimal + */ + #[ReturnTypeWillChange] + public function next() + { + next($this->var_names); } - public function valid() { + /** + * @todo Add bool return type when Stud.IP requires PHP8 minimal + */ + #[ReturnTypeWillChange] + public function valid() + { $current = current($this->var_names); return $current !== false; } - public function offsetExists($offset){ + /** + * @todo Add bool return type when Stud.IP requires PHP8 minimal + */ + #[ReturnTypeWillChange] + public function offsetExists($offset) + { return isset($this->encoded_session[$offset]); } - public function offsetGet($offset){ - if($this->offsetExists($offset) && !isset($this->decoded_session[$offset])){ + /** + * @param $offset + * @return mixed|null + * @todo Add mixed return type when Stud.IP requires PHP8 minimal + */ + #[ReturnTypeWillChange] + public function offsetGet($offset) + { + if($this->offsetExists($offset) && !isset($this->decoded_session[$offset])) { $this->decoded_session[$offset] = unserialize($this->encoded_session[$offset]); } - return isset($this->decoded_session[$offset]) ? $this->decoded_session[$offset] : null; + return $this->decoded_session[$offset] ?? null; } - public function offsetSet($offset, $value) {} - public function offsetUnset($offset) {} + /** + * @todo Add void return type when Stud.IP requires PHP8 minimal + */ + #[ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + } - public function count(){ + /** + * @todo Add void return type when Stud.IP requires PHP8 minimal + */ + #[ReturnTypeWillChange] + public function offsetUnset($offset) + { + } + + /** + * @todo Add int return type when Stud.IP requires PHP8 minimal + */ + #[ReturnTypeWillChange] + public function count() + { return count($this->var_names); } diff --git a/lib/classes/StudipArrayObject.class.php b/lib/classes/StudipArrayObject.class.php index f025ffbb8b889bed64128c8fdc73f32f83f48914..fe9aad1762262282fb929b0da5e0733a36dca177 100644 --- a/lib/classes/StudipArrayObject.class.php +++ b/lib/classes/StudipArrayObject.class.php @@ -159,7 +159,10 @@ class StudipArrayObject implements IteratorAggregate, ArrayAccess, Serializable, * Get the number of public properties in the ArrayObject * * @return int + * + * @todo Add int return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function count() { return count($this->storage); @@ -215,7 +218,10 @@ class StudipArrayObject implements IteratorAggregate, ArrayAccess, Serializable, * Create a new iterator from an ArrayObject instance * * @return \Iterator + * + * @todo Add Traversable return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function getIterator() { $class = $this->iteratorClass; @@ -268,7 +274,10 @@ class StudipArrayObject implements IteratorAggregate, ArrayAccess, Serializable, * * @param mixed $key * @return bool + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetExists($key) { return isset($this->storage[$key]); @@ -279,7 +288,10 @@ class StudipArrayObject implements IteratorAggregate, ArrayAccess, Serializable, * * @param mixed $key * @return mixed + * + * @todo Add mixed return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetGet($key) { $ret = null; @@ -297,7 +309,10 @@ class StudipArrayObject implements IteratorAggregate, ArrayAccess, Serializable, * @param mixed $key * @param mixed $value * @return void + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetSet($key, $value) { if (is_null($key)) { @@ -312,7 +327,10 @@ class StudipArrayObject implements IteratorAggregate, ArrayAccess, Serializable, * * @param mixed $key * @return void + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetUnset($key) { if ($this->offsetExists($key)) { diff --git a/lib/classes/StudipCachedArray.php b/lib/classes/StudipCachedArray.php index 830128dde4d4a23fbedb22b7c9915b1887d74201..18bb55b70868d87875eec974c4a8a25f12cff3ba 100644 --- a/lib/classes/StudipCachedArray.php +++ b/lib/classes/StudipCachedArray.php @@ -73,7 +73,10 @@ class StudipCachedArray implements ArrayAccess * @param string $offset Offset * * @return mixed + * + * @todo Add mixed return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetGet($offset) { $this->loadData($offset); diff --git a/lib/classes/StudipPDO.class.php b/lib/classes/StudipPDO.class.php index a758b1028df9a303826f227f4f8b07640aca5b4c..3fe07188efb152f50d033fe867e66166447d2852 100644 --- a/lib/classes/StudipPDO.class.php +++ b/lib/classes/StudipPDO.class.php @@ -123,8 +123,11 @@ class StudipPDO extends PDO * * @param mixed $value PHP value to quote * @param ?int $type parameter type (e.g. PDO::PARAM_STR) - * @return string quoted SQL string + * @return string|false quoted SQL string + * + * @todo Add string|false return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function quote($value, $type = null) { if (!isset($type)) { @@ -161,8 +164,11 @@ class StudipPDO extends PDO * Executes an SQL statement and returns the number of affected rows. * * @param string SQL statement - * @return int number of affected rows + * @return int|false number of affected rows + * + * @todo Add mixed return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function exec($statement) { $this->verify($statement); @@ -195,9 +201,12 @@ class StudipPDO extends PDO /** * Prepares a statement for execution and returns a statement object. * - * @param string SQL statement - * @return object PDOStatement object + * @param string $statement SQL statement + * @param array $driver_options + * + * @return StudipPDOStatement */ + #[ReturnTypeWillChange] public function prepare($statement, $driver_options = []) { $this->verify($statement); diff --git a/lib/classes/StudipPDOStatement.php b/lib/classes/StudipPDOStatement.php index 5aab1cc807e25b87810c097db5f85dd1e8d5d12c..4a3d0697de6acd983c622d98baa359a71baee3f1 100644 --- a/lib/classes/StudipPDOStatement.php +++ b/lib/classes/StudipPDOStatement.php @@ -99,7 +99,10 @@ class StudipPDOStatement implements IteratorAggregate /** * Forwards all Iterator methods to the actual statement object. + * + * @todo Add Traversable return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function getIterator() { return $this->stmt; diff --git a/lib/classes/UserDataAdapter.php b/lib/classes/UserDataAdapter.php index db9361919c708a0f4ea167db8377a9330de64ce5..0a0c3beab2b4393de9b0e7a5d8b2fdac97f88aeb 100644 --- a/lib/classes/UserDataAdapter.php +++ b/lib/classes/UserDataAdapter.php @@ -26,7 +26,10 @@ class UserDataAdapter implements ArrayAccess, Countable, IteratorAggregate /** * ArrayAccess: Check whether the given offset exists. + * + * @todo Add bool return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetExists($offset) { return $this->user->offsetExists($this->adaptOffset($offset)); @@ -34,7 +37,10 @@ class UserDataAdapter implements ArrayAccess, Countable, IteratorAggregate /** * ArrayAccess: Get the value at the given offset. + * + * @todo Add mixed return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetGet($offset) { return $this->user->offsetGet($this->adaptOffset($offset)); @@ -42,23 +48,32 @@ class UserDataAdapter implements ArrayAccess, Countable, IteratorAggregate /** * ArrayAccess: Set the value at the given offset. + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetSet($offset, $value) { - return $this->user->offsetSet($this->adaptOffset($offset), $value); + $this->user->offsetSet($this->adaptOffset($offset), $value); } /** * ArrayAccess: unset the value at the given offset. + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetUnset($offset) { - return $this->user->offsetUnset($this->adaptOffset($offset)); + $this->user->offsetUnset($this->adaptOffset($offset)); } /** * @see Countable::count() + * + * @todo Add int return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function count() { return $this->user->count(); @@ -66,7 +81,10 @@ class UserDataAdapter implements ArrayAccess, Countable, IteratorAggregate /** * @see IteratorAggregate::getIterator() + * + * @todo Add Traversable return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function getIterator() { return $this->user->getIterator(); diff --git a/lib/classes/restapi/Response.php b/lib/classes/restapi/Response.php index d8ee92038cfb46dad13c99712215f5d2e04c597d..08a23d4792d32aab48eb8abfb15da57017552f1e 100644 --- a/lib/classes/restapi/Response.php +++ b/lib/classes/restapi/Response.php @@ -122,21 +122,41 @@ class Response implements \ArrayAccess } // array access methods for headers + + /** + * @todo Add bool return type when Stud.IP requires PHP8 minimal + */ + #[ReturnTypeWillChange] public function offsetExists($offset) { return isset($this->headers[$offset]); } + /** + * @param $offset + * @return mixed + * + * @todo Add mixed return type when Stud.IP requires PHP8 minimal + */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return @$this->headers[$offset]; } + /** + * @todo Add void return type when Stud.IP requires PHP8 minimal + */ + #[ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->headers[$offset] = $value; } + /** + * @todo Add void return type when Stud.IP requires PHP8 minimal + */ + #[ReturnTypeWillChange] public function offsetUnset($offset) { unset($this->headers[$offset]); diff --git a/lib/classes/sidebar/LinkElement.php b/lib/classes/sidebar/LinkElement.php index 8b20dbea8f78da5d3c097e6c70635cc99ff60d44..8e3e2706e11d66c4b480211d6c64e6be035c6e69 100644 --- a/lib/classes/sidebar/LinkElement.php +++ b/lib/classes/sidebar/LinkElement.php @@ -247,21 +247,40 @@ class LinkElement extends WidgetElement implements ArrayAccess // Array access for attributes + /** + * @todo Add bool return type when Stud.IP requires PHP8 minimal + */ + #[ReturnTypeWillChange] public function offsetExists($offset) { return isset($this->attributes[$offset]); } + /** + * @param $offset + * @return mixed + * + * @todo Add mixed return type when Stud.IP requires PHP8 minimal + */ + #[ReturnTypeWillChange] public function offsetGet($offset) { return $this->attributes[$offset]; } + /** + * @todo Add void return type when Stud.IP requires PHP8 minimal + */ + #[ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->attributes[$offset] = $value; } + /** + * @todo Add void return type when Stud.IP requires PHP8 minimal + */ + #[ReturnTypeWillChange] public function offsetUnset($offset) { unset($this->attributes[$offset]); diff --git a/lib/filesystem/StandardFile.php b/lib/filesystem/StandardFile.php index c11541066be0f0b1cb28f6da23c156588a24fceb..371f041669159e4311cf47439ad55ea364fe7c94 100644 --- a/lib/filesystem/StandardFile.php +++ b/lib/filesystem/StandardFile.php @@ -112,7 +112,10 @@ class StandardFile implements FileType, ArrayAccess, StandardFileInterface /** * ArrayAccess: Check whether the given offset exists. + * + * @todo Add bool return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetExists($offset) { return $this->__isset($offset); @@ -120,7 +123,10 @@ class StandardFile implements FileType, ArrayAccess, StandardFileInterface /** * ArrayAccess: Get the value at the given offset. + * + * @todo Add mixed return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetGet($offset) { return $this->__get($offset); @@ -128,7 +134,10 @@ class StandardFile implements FileType, ArrayAccess, StandardFileInterface /** * ArrayAccess: Set the value at the given offset. + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->__set($offset, $value); @@ -136,7 +145,10 @@ class StandardFile implements FileType, ArrayAccess, StandardFileInterface /** * ArrayAccess: unset the value at the given offset (not applicable) + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetUnset($offset) { diff --git a/lib/filesystem/UnknownFileType.php b/lib/filesystem/UnknownFileType.php index 15c2b92e13f474c8c1b4446ff9b2813b4ebc22bc..bfd00ba119f17f92c397f22f7fbc43361df86e8d 100644 --- a/lib/filesystem/UnknownFileType.php +++ b/lib/filesystem/UnknownFileType.php @@ -51,7 +51,10 @@ class UnknownFileType implements FileType, ArrayAccess /** * ArrayAccess: Check whether the given offset exists. + * + * @todo Add bool return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetExists($offset) { return $this->__isset($offset); @@ -59,7 +62,10 @@ class UnknownFileType implements FileType, ArrayAccess /** * ArrayAccess: Get the value at the given offset. + * + * @todo Add mixed return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetGet($offset) { return $this->__get($offset); @@ -67,7 +73,10 @@ class UnknownFileType implements FileType, ArrayAccess /** * ArrayAccess: Set the value at the given offset. + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->__set($offset, $value); @@ -75,7 +84,10 @@ class UnknownFileType implements FileType, ArrayAccess /** * ArrayAccess: unset the value at the given offset (not applicable) + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetUnset($offset) { diff --git a/lib/models/DataField.class.php b/lib/models/DataField.class.php index 43a6bb3ae0513826c4c23c9c56abc9da0d1b8456..ae7b7ac5d63b77c69089734fa6299ba155113bbe 100644 --- a/lib/models/DataField.class.php +++ b/lib/models/DataField.class.php @@ -254,7 +254,10 @@ class DataField extends SimpleORMap implements PrivacyObject * Specialized count method that returns the number of concrete entries. * * @return int number of entries + * + * @todo Add int return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function count() { return DatafieldEntryModel::countBySQL('datafield_id = ?', [$this->id]); diff --git a/lib/models/SimpleCollection.class.php b/lib/models/SimpleCollection.class.php index 26439b233f04e23105d4d8786e2a0d40badfed1b..11dd29653017b3ce74aa068e5862ac18c8918777 100644 --- a/lib/models/SimpleCollection.class.php +++ b/lib/models/SimpleCollection.class.php @@ -292,9 +292,15 @@ class SimpleCollection extends StudipArrayObject * Sets the value at the specified index * ensures the value has ArrayAccess * + * @param mixed $index + * @param mixed $newval + * * @see ArrayObject::offsetSet() * @return void + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetSet($index, $newval) { if (is_numeric($index)) { @@ -309,7 +315,10 @@ class SimpleCollection extends StudipArrayObject * * @see ArrayObject::offsetUnset() * @throws InvalidArgumentException + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetUnset($index) { if ($this->offsetExists($index)) { diff --git a/lib/models/SimpleORMap.class.php b/lib/models/SimpleORMap.class.php index b210c399320dd05ce567ef376a986f33baa47a12..0488b0fd60f3febf6b893270f5e91d1886c60e59 100644 --- a/lib/models/SimpleORMap.class.php +++ b/lib/models/SimpleORMap.class.php @@ -1631,7 +1631,10 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate * * @param string $offset * @return bool + * + * @todo Add bool return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetExists($offset) { return $this->__isset($offset); @@ -1644,7 +1647,10 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate * @throws BadMethodCallException if getter for additional field could not be found * @param string $offset the column or additional field * @return null|string|SimpleORMapCollection + * + * @todo Add mixed return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetGet($offset) { return $this->getValue($offset); @@ -1658,7 +1664,10 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate * @param string $offset * @param mixed $value * @return void + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->setValue($offset, $value); @@ -1668,7 +1677,10 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate * * @param string $offset * @return void + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetUnset($offset) { @@ -1676,8 +1688,11 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate /** * IteratorAggregate * - * @return \ArrayIterator + * @return ArrayIterator + * + * @todo Add Traversable return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function getIterator() { return new ArrayIterator($this->toArray()); @@ -1686,7 +1701,10 @@ class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate * Countable * * @return int + * + * @todo Add int return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function count() { return count($this->known_slots()) - count($this->relations); diff --git a/lib/models/SimpleORMapCollection.class.php b/lib/models/SimpleORMapCollection.class.php index 94a52ecdfd8d2164b8c74509bfeb9fd80d595dc7..11d8a5ffdd1e88b94405d135a5d27c79ef079b99 100644 --- a/lib/models/SimpleORMapCollection.class.php +++ b/lib/models/SimpleORMapCollection.class.php @@ -90,7 +90,10 @@ class SimpleORMapCollection extends SimpleCollection * * @see ArrayObject::offsetSet() * @throws InvalidArgumentException if the given model does not fit (wrong type or id) + * + * @todo Add void return type when Stud.IP requires PHP8 minimal */ + #[ReturnTypeWillChange] public function offsetSet($index, $newval) { if (!is_null($index)) { diff --git a/lib/navigation/Navigation.php b/lib/navigation/Navigation.php index 8c30714b5d72ca961a316ebc557e270a225d0a08..b05cd1d3ed97437722d24d80f243d3d0b85de97a 100644 --- a/lib/navigation/Navigation.php +++ b/lib/navigation/Navigation.php @@ -568,7 +568,10 @@ class Navigation implements IteratorAggregate /** * IteratorAggregate: Create interator for request parameters. + * + * @todo Add Traversable return type when Stud.IP requires PHP8 minimal */ + #[\ReturnTypeWillChange] public function getIterator() { return new ArrayIterator($this->getSubNavigation());