From 9eb3fbee01f7e8717be67aaa5199bd51c7a17030 Mon Sep 17 00:00:00 2001 From: Marco Cesarato Date: Wed, 10 Feb 2021 14:50:51 +0100 Subject: [PATCH] fix: conventional commit wakeup class parse Closes: #3 --- src/Git/ConventionalCommit.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Git/ConventionalCommit.php b/src/Git/ConventionalCommit.php index 4bfab27..880f8f6 100644 --- a/src/Git/ConventionalCommit.php +++ b/src/Git/ConventionalCommit.php @@ -58,17 +58,6 @@ class ConventionalCommit extends Commit public function __construct(?string $commit = null) { parent::__construct($commit); - - // New commit or empty commit - if (empty($commit)) { - return; - } - - // Not parsable - if (!$this->isValid()) { - return; - } - $this->__wakeup(); } @@ -240,6 +229,16 @@ public function setFooters(array $footers): self public function __wakeup() { + // Empty + if (empty($this->raw)) { + return; + } + + // Not parsable + if (!$this->isValid()) { + return; + } + $rows = explode("\n", $this->raw); $header = $rows[0]; $message = '';