Skip to content

Commit ee1bf7f

Browse files
Removed deprecated code
1 parent 8dc4049 commit ee1bf7f

26 files changed

+57
-887
lines changed

doc/rate_limits.md

-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Get rate limit wrappers from [GitHub Rate Limit API](http://developer.github.com
55

66
#### Get All Rate Limits
77

8-
##### new way
98
```php
109
/** @var \Github\Api\RateLimit\RateLimitResource[] $rateLimits */
1110
$rateLimits = $client->api('rate_limit')->getResources();
@@ -61,14 +60,6 @@ array(4) {
6160
}
6261
```
6362

64-
65-
##### deprecated way
66-
67-
```php
68-
/** @var array $rateLimits */
69-
$rateLimits = $client->api('rate_limit')->getRateLimits();
70-
```
71-
7263
#### Get Core Rate Limit
7364

7465
```php

doc/security.md

+7-25
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ properties on Repositories and some others. Therefore this step is facultative.
66

77
### Authenticate
88

9-
GitHub provides some different ways of authentication. This API implementation implements three of them which are handled by one function:
9+
GitHub provides some different ways of authentication. This API implementation implements three of them which are
10+
handled by one function:
1011

1112
```php
1213
$client->authenticate($usernameOrToken, $password, $method);
@@ -15,38 +16,19 @@ $client->authenticate($usernameOrToken, $password, $method);
1516
`$usernameOrToken` is, of course, the username (or in some cases token/client ID, more details you can find below),
1617
and guess what should contain `$password`. The `$method` can contain one of the five allowed values:
1718

18-
#### Deprecated methods
19-
* `Github\Client::AUTH_URL_TOKEN` use `Github\Client::AUTH_ACCESS_TOKEN` instead.
20-
* `Github\Client::AUTH_URL_CLIENT_ID` use `Github\Client::AUTH_CLIENT_ID` instead.
21-
* `Github\Client::AUTH_HTTP_TOKEN` use `Github\Client::AUTH_ACCESS_TOKEN` instead.
22-
* `Github\Client::AUTH_HTTP_PASSWORD` use `Github\Client::AUTH_ACCESS_TOKEN` instead.
23-
2419
#### Supported methods
2520
* `Github\Client::AUTH_CLIENT_ID` - https://developer.github.com/v3/#oauth2-keysecret
2621
* `Github\Client::AUTH_ACCESS_TOKEN` - https://developer.github.com/v3/#oauth2-token-sent-in-a-header
2722
* `Github\Client::AUTH_JWT` - https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app
2823

29-
The required value of `$password` depends on the chosen `$method`. For `Github\Client::AUTH_URL_TOKEN`,
30-
`Github\Client::AUTH_HTTP_TOKEN` and `Github\Client::JWT` methods you should provide the API token in
31-
`$usernameOrToken` variable (`$password` is omitted in this particular case). For the
32-
`Github\Client::AUTH_HTTP_PASSWORD`, you should provide the password of the account. When using `Github\Client::AUTH_URL_CLIENT_ID`
33-
`$usernameOrToken` should contain your client ID, and `$password` should contain client secret.
34-
35-
After executing the `$client->authenticate($usernameOrToken, $secret, $method);` method using correct credentials,
36-
all further requests are done as the given user.
24+
The required value of `$password` depends on the chosen `$method`. For `Github\Client::AUTH_ACCESS_TOKEN` and
25+
`Github\Client::JWT` methods you should provide the API token in `$usernameOrToken` variable (`$password` is omitted in
26+
this particular case).
3727

38-
### About authentication methods
39-
40-
The `Github\Client::AUTH_URL_TOKEN` authentication method sends the API token in URL parameters.
41-
The `Github\Client::AUTH_URL_CLIENT_ID` authentication method sends the client ID and secret in URL parameters.
42-
The `Github\Client::AUTH_HTTP_*` authentication methods send their values to GitHub using HTTP Basic Authentication.
4328
The `Github\Client::AUTH_JWT` authentication method sends the specified JSON Web Token in an Authorization header.
4429

45-
`Github\Client::AUTH_URL_TOKEN` used to be the only available authentication method. To prevent existing applications
46-
from changing their behavior in case of an API upgrade, this method is chosen as the default for this API implementation.
47-
48-
Note however that GitHub describes this method as deprecated. In most case you should use the
49-
`Github\Client::AUTH_HTTP_TOKEN` instead.
30+
After executing the `$client->authenticate($usernameOrToken, $secret, $method);` method using correct credentials, all
31+
further requests are done as the given user.
5032

5133
### Authenticating as an Integration
5234

lib/Github/Api/Authorizations.php

-132
Original file line numberDiff line numberDiff line change
@@ -13,98 +13,6 @@ class Authorizations extends AbstractApi
1313
{
1414
use AcceptHeaderTrait;
1515

16-
private function configurePreviewHeader()
17-
{
18-
$this->acceptHeaderValue = 'application/vnd.github.doctor-strange-preview+json';
19-
}
20-
21-
/**
22-
* List all authorizations.
23-
*
24-
* @return array
25-
*
26-
* @deprecated GitHub will remove this endpoint on 13th November 2020. No replacement will be offered. The "web application flow" should be used instead.
27-
*/
28-
public function all()
29-
{
30-
return $this->get('/authorizations');
31-
}
32-
33-
/**
34-
* Show a single authorization.
35-
*
36-
* @param string $clientId
37-
*
38-
* @return array
39-
*
40-
* @deprecated GitHub will remove this endpoint on 13th November 2020. No replacement will be offered. The "web application flow" should be used instead.
41-
*/
42-
public function show($clientId)
43-
{
44-
return $this->get('/authorizations/'.rawurlencode($clientId));
45-
}
46-
47-
/**
48-
* Create an authorization.
49-
*
50-
* @param array $params
51-
* @param string|null $OTPCode
52-
*
53-
* @return array
54-
*
55-
* @deprecated GitHub will remove this endpoint on 13th November 2020. No replacement will be offered. The "web application flow" should be used instead.
56-
*/
57-
public function create(array $params, $OTPCode = null)
58-
{
59-
$headers = null === $OTPCode ? [] : ['X-GitHub-OTP' => $OTPCode];
60-
61-
return $this->post('/authorizations', $params, $headers);
62-
}
63-
64-
/**
65-
* Update an authorization.
66-
*
67-
* @param string $clientId
68-
* @param array $params
69-
*
70-
* @return array
71-
*
72-
* @deprecated GitHub will remove this endpoint on 13th November 2020. No replacement will be offered. The "web application flow" should be used instead.
73-
*/
74-
public function update($clientId, array $params)
75-
{
76-
return $this->patch('/authorizations/'.rawurlencode($clientId), $params);
77-
}
78-
79-
/**
80-
* Remove an authorization.
81-
*
82-
* @param string $clientId
83-
*
84-
* @return array
85-
*
86-
* @deprecated GitHub will remove this endpoint on 13th November 2020. No replacement will be offered. The "web application flow" should be used instead.
87-
*/
88-
public function remove($clientId)
89-
{
90-
return $this->delete('/authorizations/'.rawurlencode($clientId));
91-
}
92-
93-
/**
94-
* Check an authorization.
95-
*
96-
* @param string $clientId
97-
* @param string $token
98-
*
99-
* @return array
100-
*
101-
* @deprecated GitHub will remove this endpoint on 1st July 2020. Use self::checkToken() instead.
102-
*/
103-
public function check($clientId, $token)
104-
{
105-
return $this->get('/applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token));
106-
}
107-
10816
/**
10917
* Check an application token.
11018
*
@@ -120,21 +28,6 @@ public function checkToken($clientId, $token = null)
12028
return $this->post('/applications/'.rawurlencode($clientId).'/token', $token ? ['access_token' => $token] : []);
12129
}
12230

123-
/**
124-
* Reset an authorization.
125-
*
126-
* @param string $clientId
127-
* @param string $token
128-
*
129-
* @return array
130-
*
131-
* @deprecated GitHub will remove this endpoint on 1st July 2020. Use self::resetToken() instead.
132-
*/
133-
public function reset($clientId, $token)
134-
{
135-
return $this->post('/applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token));
136-
}
137-
13831
/**
13932
* Reset an application token.
14033
*
@@ -150,31 +43,6 @@ public function resetToken($clientId, $token = null)
15043
return $this->patch('/applications/'.rawurlencode($clientId).'/token', $token ? ['access_token' => $token] : []);
15144
}
15245

153-
/**
154-
* Remove an authorization.
155-
*
156-
* @param string $clientId
157-
* @param string $token
158-
*
159-
* @deprecated GitHub will remove this endpoint on 1st July 2020. Use self::deleteToken() instead.
160-
*/
161-
public function revoke($clientId, $token)
162-
{
163-
$this->delete('/applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token));
164-
}
165-
166-
/**
167-
* Revoke all authorizations.
168-
*
169-
* @param string $clientId
170-
*
171-
* @deprecated GitHub will remove this endpoint on 1st July 2020. Use self::deleteGrant() instead.
172-
*/
173-
public function revokeAll($clientId)
174-
{
175-
$this->delete('/applications/'.rawurlencode($clientId).'/tokens');
176-
}
177-
17846
/**
17947
* Revoke an application token.
18048
*

lib/Github/Api/CurrentUser.php

-20
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,6 @@ public function watchers()
150150
return new Watchers($this->client);
151151
}
152152

153-
/**
154-
* @deprecated Use watchers() instead
155-
*/
156-
public function watched($page = 1)
157-
{
158-
return $this->get('/user/watched', [
159-
'page' => $page,
160-
]);
161-
}
162-
163153
/**
164154
* @return Starring
165155
*/
@@ -168,16 +158,6 @@ public function starring()
168158
return new Starring($this->client);
169159
}
170160

171-
/**
172-
* @deprecated Use starring() instead
173-
*/
174-
public function starred($page = 1)
175-
{
176-
return $this->get('/user/starred', [
177-
'page' => $page,
178-
]);
179-
}
180-
181161
/**
182162
* @link https://developer.github.com/v3/activity/watching/#list-repositories-being-watched
183163
*/

lib/Github/Api/Integrations.php

-26
This file was deleted.

lib/Github/Api/Issue.php

-22
Original file line numberDiff line numberDiff line change
@@ -58,28 +58,6 @@ public function all($username, $repository, array $params = [])
5858
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues', array_merge(['page' => 1], $params));
5959
}
6060

61-
/**
62-
* Search issues by username, repo, state and keyword.
63-
*
64-
* @deprecated This method is deprecated use the Search api instead. See https://developer.github.com/v3/search/legacy/#legacy-search-api-is-deprecated
65-
* @link http://developer.github.com/v3/search/#search-issues
66-
*
67-
* @param string $username the username
68-
* @param string $repository the repository
69-
* @param string $state the issue state, can be open or closed
70-
* @param string $keyword the keyword to filter issues by
71-
*
72-
* @return array list of issues found
73-
*/
74-
public function find($username, $repository, $state, $keyword)
75-
{
76-
if (!in_array($state, ['open', 'closed'])) {
77-
$state = 'open';
78-
}
79-
80-
return $this->get('/legacy/issues/search/'.rawurlencode($username).'/'.rawurlencode($repository).'/'.rawurlencode($state).'/'.rawurlencode($keyword));
81-
}
82-
8361
/**
8462
* List issues by organization.
8563
*

lib/Github/Api/Issue/Assignees.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Github\Api\Issue;
44

55
use Github\Api\AbstractApi;
6+
use Github\Exception\InvalidArgumentException;
67
use Github\Exception\MissingArgumentException;
78

89
class Assignees extends AbstractApi
@@ -47,6 +48,7 @@ public function check($username, $repository, $assignee)
4748
* @param string $issue
4849
* @param array $parameters
4950
*
51+
* @throws InvalidArgumentException
5052
* @throws MissingArgumentException
5153
*
5254
* @return string
@@ -58,9 +60,7 @@ public function add($username, $repository, $issue, array $parameters)
5860
}
5961

6062
if (!is_array($parameters['assignees'])) {
61-
@trigger_error(sprintf('Passing the "assignees" parameter as a string in "%s" is deprecated and will throw an exception in php-github-api version 3.0. Pass an array of strings instead', __METHOD__), E_USER_DEPRECATED);
62-
63-
$parameters['assignees'] = [$parameters['assignees']];
63+
throw new InvalidArgumentException('The assignees parameter should be an array of assignees');
6464
}
6565

6666
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/assignees', $parameters);

lib/Github/Api/Issue/Comments.php

+6-15
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,16 @@ public function configure($bodyType = null)
4141
*
4242
* @link https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue
4343
*
44-
* @param string $username
45-
* @param string $repository
46-
* @param int $issue
47-
* @param int|array $page Passing integer is deprecated and will throw an exception in php-github-api version 3.0. Pass an array instead.
44+
* @param string $username
45+
* @param string $repository
46+
* @param int $issue
47+
* @param array $params
4848
*
4949
* @return array
5050
*/
51-
public function all($username, $repository, $issue, $page = 1)
51+
public function all($username, $repository, $issue, array $params = [])
5252
{
53-
if (is_array($page)) {
54-
$parameters = $page;
55-
} else {
56-
@trigger_error(sprintf('Passing integer to the "page" argument in "%s" is deprecated and will throw an exception in php-github-api version 3.0. Pass an array instead.', __METHOD__), E_USER_DEPRECATED);
57-
$parameters = [
58-
'page' => $page,
59-
];
60-
}
61-
62-
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$issue.'/comments', $parameters);
53+
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.$issue.'/comments', $params);
6354
}
6455

6556
/**

0 commit comments

Comments
 (0)