From: eileen Date: Mon, 1 Aug 2016 23:05:02 +0000 (+1200) Subject: CRM-19164 use exception rather than assert (for HHVM) X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0dbbb8e7dc8cf616ffe40d51c211ec0e9c4b06ac;p=civicrm-core.git CRM-19164 use exception rather than assert (for HHVM) --- diff --git a/Civi/Core/Transaction/Frame.php b/Civi/Core/Transaction/Frame.php index f3ad3fc4cf..d12de55fa0 100644 --- a/Civi/Core/Transaction/Frame.php +++ b/Civi/Core/Transaction/Frame.php @@ -117,8 +117,16 @@ class Frame { $this->doCommit = FALSE; } + /** + * Begin frame processing. + * + * @throws \CRM_Core_Exception + */ public function begin() { - assert('$this->state === self::F_NEW'); + if ($this->state !== self::F_NEW) { + throw new \CRM_Core_Exception('State is not F_NEW'); + }; + $this->state = self::F_ACTIVE; if ($this->beginStmt) { $this->dao->query($this->beginStmt); @@ -126,14 +134,20 @@ class Frame { } /** + * Finish frame processing. + * * @param int $newState - * @void + * + * @throws \CRM_Core_Exception */ public function finish($newState = self::F_DONE) { if ($this->state == self::F_FORCED) { return; } - assert('$this->state === self::F_ACTIVE'); + if ($this->state !== self::F_ACTIVE) { + throw new \CRM_Core_Exception('State is not F_ACTIVE'); + }; + $this->state = $newState; if ($this->doCommit) {