From 5aab70f8ebf3fc5ee906f0b0bb47ea9fa45a9dfe Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 15 Oct 2024 18:04:23 +1300 Subject: [PATCH] API Strongly type return types --- src/Templates/WorkflowTemplate.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Templates/WorkflowTemplate.php b/src/Templates/WorkflowTemplate.php index 2ff85dfd..730f8e92 100644 --- a/src/Templates/WorkflowTemplate.php +++ b/src/Templates/WorkflowTemplate.php @@ -70,6 +70,8 @@ */ class WorkflowTemplate { + // These are loosely typed to allow for easy conversion from YAML and backwards compatibility + // e.g. version is likely to be an int, though the DB column it goes into is a Varchar protected $name; protected $description; protected $version; @@ -92,29 +94,29 @@ public function __construct($name, $description = '', $version = '0.0', $remindD $this->sort = $sort; } - public function getName() + public function getName(): string { - return $this->name; + return (string) $this->name; } - public function getVersion() + public function getVersion(): string { - return $this->version; + return (string) $this->version; } - public function getDescription() + public function getDescription(): string { - return $this->description; + return (string) $this->description; } - public function getRemindDays() + public function getRemindDays(): int { - return $this->remindDays; + return (int) $this->remindDays; } - public function getSort() + public function getSort(): int { - return $this->sort; + return (int) $this->sort; } /**