diff --git a/lib/Github/Api/PullRequest.php b/lib/Github/Api/PullRequest.php index a47509197c3..b4099eaf43d 100644 --- a/lib/Github/Api/PullRequest.php +++ b/lib/Github/Api/PullRequest.php @@ -5,6 +5,7 @@ use Github\Api\PullRequest\Comments; use Github\Api\PullRequest\Review; use Github\Api\PullRequest\ReviewRequest; +use Github\Exception\InvalidArgumentException; use Github\Exception\MissingArgumentException; /** @@ -28,7 +29,7 @@ class PullRequest extends AbstractApi */ public function configure($bodyType = null, $apiVersion = null) { - if (!in_array($apiVersion, array('polaris-preview'))) { + if (!in_array($apiVersion, array())) { $apiVersion = $this->client->getApiVersion(); } @@ -40,7 +41,7 @@ public function configure($bodyType = null, $apiVersion = null) $bodyType .= '+json'; } - $this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s', $this->client->getApiVersion(), $bodyType); + $this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s', $apiVersion, $bodyType); return $this; } @@ -163,6 +164,10 @@ public function merge($username, $repository, $id, $message, $sha, $mergeMethod $mergeMethod = $mergeMethod ? 'squash' : 'merge'; } + if (!in_array($mergeMethod, array('merge', 'squash', 'rebase'), true)) { + throw new InvalidArgumentException(sprintf('"$mergeMethod" must be one of ["merge", "squash", "rebase"] ("%s" given).', $mergeMethod)); + } + $params = array( 'commit_message' => $message, 'sha' => $sha,