Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/Github/Api/PullRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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();
}

Expand All @@ -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;
}
Expand Down Expand Up @@ -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,
Expand Down