From 395c07231462f7362a865cb17506bdc88468151f Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 15 Oct 2024 18:02:55 +1300 Subject: [PATCH] API Strongly type return types --- src/Templates/WorkflowTemplate.php | 22 ++++++++++--------- tests/behat/features/workflow-history.feature | 1 + 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Templates/WorkflowTemplate.php b/src/Templates/WorkflowTemplate.php index 2ff85dfd..b3df7f72 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; } /** diff --git a/tests/behat/features/workflow-history.feature b/tests/behat/features/workflow-history.feature index 2ff88130..14384635 100644 --- a/tests/behat/features/workflow-history.feature +++ b/tests/behat/features/workflow-history.feature @@ -14,6 +14,7 @@ Feature: Workflow Actions history And I go to "/admin/pages" Then I should see "About Us" in the tree +@sboyd Scenario: I can see page edits as a diff in the Workflow Actions tab When I click on "About Us" in the tree Then I should see an edit page form