aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Comments/Comment.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Comments/Comment.php')
-rw-r--r--lib/private/Comments/Comment.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/Comments/Comment.php b/lib/private/Comments/Comment.php
index af2c73c770b..35e88c74438 100644
--- a/lib/private/Comments/Comment.php
+++ b/lib/private/Comments/Comment.php
@@ -304,9 +304,13 @@ class Comment implements IComment {
*
* If not explicitly set, it shall default to the time of initialization.
* @since 9.0.0
+ * @throw \LogicException if creation date time is not set yet
*/
public function getCreationDateTime(): \DateTime {
- return $this->data['creationDT'] ?? new \DateTime();
+ if (!isset($this->data['creationDT'])) {
+ throw new \LogicException('Cannot get creation date before setting one or writting to database');
+ }
+ return $this->data['creationDT'];
}
/**