From 5e6e3babf43ac993d9b663709f68d7c8af2ffdaf Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Mon, 20 Feb 2017 16:17:28 +0800 Subject: [PATCH] MDL-57730 core_calendar: fixed incompatibility with PHP 5.x Also removed unused function and fixed PHPDocs. Part of MDL-55611 epic. --- .../local/event/data_access/event_vault.php | 29 +++++-------------- .../interfaces/event_vault_interface.php | 10 +++---- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/calendar/classes/local/event/data_access/event_vault.php b/calendar/classes/local/event/data_access/event_vault.php index 019d491a8c0..2ff377ad674 100644 --- a/calendar/classes/local/event/data_access/event_vault.php +++ b/calendar/classes/local/event/data_access/event_vault.php @@ -59,10 +59,10 @@ class event_vault implements event_vault_interface { /** * Retrieve an event for the given id. * - * @param in $id The event id + * @param int $id The event id * @return event_interface */ - public function get_event_by_id(int $id) { + public function get_event_by_id($id) { global $DB; if ($record = $DB->get_record('event', ['id' => $id])) { @@ -80,14 +80,16 @@ class event_vault implements event_vault_interface { * @param int|null $timesortto Events with timesort until this value (inclusive) * @param event_interface|null $afterevent Only return events after this one * @param int $limitnum Return at most this number of events + * @throws timesort_invalid_parameter_exception + * @throws limit_invalid_parameter_exception * @return action_event_interface */ public function get_action_events_by_timesort( \stdClass $user, - int $timesortfrom = null, - int $timesortto = null, + $timesortfrom = null, + $timesortto = null, event_interface $afterevent = null, - int $limitnum = 20 + $limitnum = 20 ) { global $DB; @@ -154,21 +156,4 @@ class event_vault implements event_vault_interface { private function transform_from_database_record(\stdClass $record) { return $this->factory->create_instance($record); } - - /** - * Create an array of events from an array of database records. - * - * @param array $records The database records - * @return array - */ - private function transform_from_database_records(array $records) { - $events = []; - foreach ($records as $record) { - if ($event = $this->transform_from_database_record($record)) { - $events[] = $event; - } - } - - return $events; - } } diff --git a/calendar/classes/local/interfaces/event_vault_interface.php b/calendar/classes/local/interfaces/event_vault_interface.php index 0f2c107f16a..754a55cf2f0 100644 --- a/calendar/classes/local/interfaces/event_vault_interface.php +++ b/calendar/classes/local/interfaces/event_vault_interface.php @@ -34,10 +34,10 @@ interface event_vault_interface { /** * Retrieve an event for the given id. * - * @param in $id The event id + * @param int $id The event id * @return event_interface|false */ - public function get_event_by_id(int $id); + public function get_event_by_id($id); /** * Retrieve an array of events for the given user and time constraints. @@ -51,9 +51,9 @@ interface event_vault_interface { */ public function get_action_events_by_timesort( \stdClass $user, - int $timesortfrom, - int $timesortto, + $timesortfrom, + $timesortto, event_interface $afterevent, - int $limitnum + $limitnum ); }