diff --git a/api/src/Db/CallbackIterator.php b/api/src/Db/CallbackIterator.php index e86d169a09..21fbe97389 100644 --- a/api/src/Db/CallbackIterator.php +++ b/api/src/Db/CallbackIterator.php @@ -118,9 +118,9 @@ class CallbackIterator implements \Iterator /** * Return the current element * - * @return array + * @return mixed */ - public function current() + public function current(): mixed { if (is_a($this->rs,'iterator')) { @@ -136,7 +136,7 @@ class CallbackIterator implements \Iterator * * @return int */ - public function key() + public function key(): int { if (is_a($this->rs,'iterator')) { @@ -150,22 +150,22 @@ class CallbackIterator implements \Iterator /** * Move forward to next element (called after each foreach loop) */ - public function next() + public function next(): void { if (is_a($this->rs,'iterator')) { - return $this->rs->next(); + $this->rs->next(); } } /** * Rewind the Iterator to the first element (called at beginning of foreach loop) */ - public function rewind() + public function rewind(): void { if (is_a($this->rs,'iterator')) { - return $this->rs->rewind(); + $this->rs->rewind(); } } @@ -174,7 +174,7 @@ class CallbackIterator implements \Iterator * * @return boolean */ - public function valid () + public function valid (): bool { if (is_a($this->rs,'iterator')) { @@ -182,4 +182,4 @@ class CallbackIterator implements \Iterator } return false; } -} +} \ No newline at end of file diff --git a/api/src/Mail/Account.php b/api/src/Mail/Account.php index 65add695b2..6cb8815024 100644 --- a/api/src/Mail/Account.php +++ b/api/src/Mail/Account.php @@ -908,7 +908,7 @@ class Account implements \ArrayAccess * @param string $offset * @return mixed */ - public function offsetGet($offset) + public function offsetGet($offset): mixed { return $this->__get($offset); } @@ -919,7 +919,7 @@ class Account implements \ArrayAccess * @param string $offset * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return $this->__isset($offset); } @@ -933,7 +933,7 @@ class Account implements \ArrayAccess * @param mixed $value * @throws Api\Exception\WrongParameter */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { throw new Api\Exception\WrongParameter(__METHOD__."($offset, $value) No write access through ArrayAccess interface of Account!"); } @@ -946,7 +946,7 @@ class Account implements \ArrayAccess * @param string $offset * @throws Api\Exception\WrongParameter */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { throw new Api\Exception\WrongParameter(__METHOD__."($offset) No write access through ArrayAccess interface of Account!"); } diff --git a/api/src/Storage/Customfields.php b/api/src/Storage/Customfields.php old mode 100755 new mode 100644 index fafa460512..29f2e2437c --- a/api/src/Storage/Customfields.php +++ b/api/src/Storage/Customfields.php @@ -94,7 +94,7 @@ class Customfields implements \IteratorAggregate * * @return Api\Db\CallbackIterator */ - function getIterator() + function getIterator(): Api\Db\CallbackIterator { return new Api\Db\CallbackIterator($this->iterator, function($_row) { diff --git a/calendar/inc/class.calendar_boupdate.inc.php b/calendar/inc/class.calendar_boupdate.inc.php index 52a7fcd690..b8302a077a 100644 --- a/calendar/inc/class.calendar_boupdate.inc.php +++ b/calendar/inc/class.calendar_boupdate.inc.php @@ -1401,7 +1401,7 @@ class calendar_boupdate extends calendar_bo $rrule->next_no_exception(); $occurrence = $rrule->current(); } - while ($rrule->valid($event['whole_day']) && ($enddate = $occurrence)); + while ($rrule->validDate($event['whole_day']) && ($enddate = $occurrence)); $enddate->modify(($event['end'] - $event['start']).' second'); $event['recur_enddate'] = $save_event['recur_enddate'] = $enddate->format('ts'); //error_log(__METHOD__."($event[title]) start=".Api\DateTime::to($event['start'],'string').', end='.Api\DateTime::to($event['end'],'string').', range_end='.Api\DateTime::to($event['recur_enddate'],'string')); @@ -3180,4 +3180,4 @@ class calendar_boupdate extends calendar_bo return $status_reset; } -} +} \ No newline at end of file diff --git a/calendar/inc/class.calendar_rrule.inc.php b/calendar/inc/class.calendar_rrule.inc.php index d14055a015..e28f6ace1e 100644 --- a/calendar/inc/class.calendar_rrule.inc.php +++ b/calendar/inc/class.calendar_rrule.inc.php @@ -385,9 +385,9 @@ class calendar_rrule implements Iterator /** * Return the current element * - * @return DateTime + * @return Api\DateTime */ - public function current() + public function current(): Api\DateTime { return clone $this->current; } @@ -397,7 +397,7 @@ class calendar_rrule implements Iterator * * @return int */ - public function key() + public function key(): int { return (int)$this->current->format('Ymd'); } @@ -476,9 +476,9 @@ class calendar_rrule implements Iterator } /** - * Move forward to next recurence, taking into account exceptions + * Move forward to next recurrence, taking into account exceptions */ - public function next() + public function next(): void { do { @@ -555,7 +555,7 @@ class calendar_rrule implements Iterator /** * Rewind the Iterator to the first element (called at beginning of foreach loop) */ - public function rewind() + public function rewind(): void { $this->current = clone $this->time; while ($this->valid() && @@ -569,20 +569,30 @@ class calendar_rrule implements Iterator /** * Checks if current position is valid * - * @param boolean $use_just_date =false default use also time + * @param boolean? $use_just_date true: use just date, false|null: use also time * @return boolean */ - public function valid($use_just_date=false) + public function validDate(bool $use_just_date=null): bool { if ($use_just_date) { return $this->current->format('Ymd') <= $this->enddate_ymd; } + return $this->valid(); + } + + /** + * Checks if current position is valid + * + * @return boolean + */ + public function valid(): bool + { return $this->current->format('ts') < $this->enddate_ts; } /** - * Return string represenation of RRule + * Return string representation of RRule * * @return string */ @@ -592,7 +602,7 @@ class calendar_rrule implements Iterator // Repeated Events if($this->type != self::NONE) { - $str = lang(self::$types[$this->type]); + $str = (string)lang(self::$types[$this->type]); $str_extra = array(); switch ($this->type) @@ -1186,6 +1196,7 @@ if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE_ $rrule = new calendar_rrule($time,$_REQUEST['type'],$_REQUEST['interval'],$enddate,$weekdays,$exceptions); echo "