From 045cc974f69e092fb4cf03c4e7b51f49c4b7252e Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Mon, 2 Sep 2024 15:27:36 +0200 Subject: [PATCH] valuestore class: php8 only; added variable types; short array syntax --- .../valuestore/classes/valuestore.class.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/public_html/valuestore/classes/valuestore.class.php b/public_html/valuestore/classes/valuestore.class.php index cb7b5b39..7a31931c 100644 --- a/public_html/valuestore/classes/valuestore.class.php +++ b/public_html/valuestore/classes/valuestore.class.php @@ -29,7 +29,7 @@ * * Axel: <axel.hahn@unibe.ch> * (...) - * 2024-08-29 Axel php8 only; added variable types; short array syntax + * 2024-09-02 Axel php8 only; added variable types; short array syntax */ class valuestore { @@ -402,7 +402,7 @@ class valuestore * @param string $sHost optional: hostname (for place deployed) * @return string */ - public function setPackage(string $sPackage, string $sPhase, string $sPlace = '', string $sHost = ''): string + public function setPackage(string $sPackage, string $sPhase, string $sPlace = '', string $sHost = ''): string { $this->sPackage = preg_replace('/[^a-z\-\_0-9]/', '', $sPackage); $this->setPhase($sPhase, $sPlace, $sHost); @@ -418,7 +418,7 @@ class valuestore * @param string $sHost optional: hostname (for place deployed) * @return type string */ - public function setPhase(string $sPhase, string $sPlace = '', string $sHost = ''): string + public function setPhase(string $sPhase, string $sPlace = '', string $sHost = ''): string { if (!$this->sProject && !$this->sPackage) { $this->_quit(__FUNCTION__, "ERROR: you need to set a project. Use the setProject() method to do so."); @@ -583,11 +583,15 @@ class valuestore ); } /** - * update a version value - * @param type $sVersioninfos - * @return boolean + * update a version value. It returns the return value of updateVar(). + * It returns a PDO result object. + * It aborts if project and package are not set + * It returns false on database query error + * + * @param string $sVersioninfos json of ci build data + * @return boolean|object */ - public function updateVersion($sVersioninfos) + public function updateVersion($sVersioninfos): bool|object { return $this->updateVar('version', $sVersioninfos); } -- GitLab