Skip to content

Commit af435f6

Browse files
committed
throw invalidargumentexception when trying to use invalid merge method
1 parent 38bd1a4 commit af435f6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/Github/Api/PullRequest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ public function merge($username, $repository, $id, $message, $sha, $mergeMethod
163163
$mergeMethod = $mergeMethod ? 'squash' : 'merge';
164164
}
165165

166+
if (!in_array($mergeMethod, array('merge', 'squash', 'rebase'), true)) {
167+
throw new InvalidArgumentException(sprintf('"$mergeMethod" must be one of ["merge", "squash", "rebase"] ("%s" given).', $mergeMethod));
168+
}
169+
166170
$params = array(
167171
'commit_message' => $message,
168172
'sha' => $sha,

0 commit comments

Comments
 (0)