Skip to content

Commit 3fba9f3

Browse files
committed
Fix regular-expression exception.
1 parent 700f5b7 commit 3fba9f3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/PhpGitHooks/Application/Config/ConfigFile.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,16 @@ public function getMessageCommitConfiguration()
5454
{
5555
$data = $this->getConfigurationData();
5656

57-
if (!isset($data['commit-msg']) ||
58-
!isset($data['commit-msg']['enabled']) ||
59-
!isset($data['commit-msg']['regular-expression'])
60-
) {
57+
if (!isset($data['commit-msg']) || !isset($data['commit-msg']['enabled'])) {
6158
throw new InvalidConfigStructureException();
6259
}
6360

61+
if (true === $data['commit-msg']['enabled']) {
62+
if (!isset($data['commit-msg']['regular-expression'])) {
63+
throw new InvalidConfigStructureException();
64+
}
65+
}
66+
6467
return $data['commit-msg'];
6568
}
6669
}

0 commit comments

Comments
 (0)