-
-
Notifications
You must be signed in to change notification settings - Fork 599
The Merge methods API is now official #562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
d66c81e
75c8f6c
5045173
38bd1a4
af435f6
574a927
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,16 +22,11 @@ class PullRequest extends AbstractApi | |
* | ||
* @link https://developer.github.com/v3/pulls/#custom-media-types | ||
* @param string|null $bodyType | ||
* @param string|null $apiVersion | ||
* | ||
* @return self | ||
*/ | ||
public function configure($bodyType = null, $apiVersion = null) | ||
public function configure($bodyType = null) | ||
{ | ||
if (!in_array($apiVersion, array('polaris-preview'))) { | ||
$apiVersion = $this->client->getApiVersion(); | ||
} | ||
|
||
if (!in_array($bodyType, array('text', 'html', 'full', 'diff', 'patch'))) { | ||
$bodyType = 'raw'; | ||
} | ||
|
@@ -163,6 +158,10 @@ public function merge($username, $repository, $id, $message, $sha, $mergeMethod | |
$mergeMethod = $mergeMethod ? 'squash' : 'merge'; | ||
} | ||
|
||
if (!in_array($mergeMethod, array('squash', 'rebase'))) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👎 We should let GitHub's API throw an error. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's fine but there are several other places throughout the codebase that behave in this way already, just do a search for in_array to see what I mean. Should an issue be opened to remove all of those checks in the next major version for consistency? |
||
$mergeMethod = 'merge'; | ||
} | ||
|
||
$params = array( | ||
'commit_message' => $message, | ||
'sha' => $sha, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though removing this is not breaking BC, I think we should keep it. Because if we remove it and then later adds another optional parameter to this function, that WILL be BC and it is really hard to keep track of.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case I'll need to fix it since I realized when I was removing it that I never actually used the $apiVersion variable when setting the accept header value. :(