From aa49154e5a9ee135c3f0286ddda8a01a5290b1ed Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 15 Nov 2023 17:53:47 +0100 Subject: Fix more type errors, stricter typing --- modules-available/roomplanner/page.inc.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'modules-available/roomplanner/page.inc.php') diff --git a/modules-available/roomplanner/page.inc.php b/modules-available/roomplanner/page.inc.php index 53e8bf0b..6708cd8a 100644 --- a/modules-available/roomplanner/page.inc.php +++ b/modules-available/roomplanner/page.inc.php @@ -4,14 +4,14 @@ class Page_Roomplanner extends Page { /** - * @var int locationid of location we're editing + * @var ?int locationid of location we're editing, or null if unknown/not set */ - private $locationid = false; + private $locationid = null; /** * @var array location data from location table */ - private $location = false; + private $location = null; /** * @var string action to perform @@ -25,8 +25,8 @@ class Page_Roomplanner extends Page private function loadRequestedLocation() { - $this->locationid = Request::get('locationid', false, 'integer'); - if ($this->locationid !== false) { + $this->locationid = Request::get('locationid', null, 'integer'); + if ($this->locationid !== null) { $locs = Location::getLocationsAssoc(); if (isset($locs[$this->locationid])) { $this->location = $locs[$this->locationid]; @@ -46,11 +46,11 @@ class Page_Roomplanner extends Page $this->action = Request::any('action', 'show', 'string'); $this->loadRequestedLocation(); - if ($this->locationid === false) { + if ($this->locationid === null) { Message::addError('need-locationid'); Util::redirect('?do=locations'); } - if ($this->location === false) { + if ($this->location === null) { Message::addError('locations.invalid-location-id', $this->locationid); Util::redirect('?do=locations'); } @@ -204,10 +204,10 @@ class Page_Roomplanner extends Page } elseif ($this->action === 'save') { // Save roomplan - give feedback if it failed so the window can stay open $this->loadRequestedLocation(); - if ($this->locationid === false) { + if ($this->locationid === null) { die('Missing locationid in save data'); } - if ($this->location === false) { + if ($this->location === null) { die('Location with id ' . $this->locationid . ' does not exist.'); } $this->handleSaveRequest(true); -- cgit v1.2.3-55-g7522