Skip to content

Commit 0967b52

Browse files
committed
Merge branch 'v2.x' into support-redmine-4.2
2 parents b755f29 + ca87f14 commit 0967b52

File tree

122 files changed

+514
-513
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+514
-513
lines changed

.php-cs-fixer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
'linebreak_after_opening_tag' => true,
1616
'ordered_imports' => true,
1717
'phpdoc_order' => true,
18+
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['arguments', 'arrays']], // Remove this rule after dropping support for PHP 7.4
1819
])
1920
->setFinder($finder)
2021
->setRiskyAllowed(true)

src/Redmine/Api/AbstractApi.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct($client)
4949
__METHOD__,
5050
Client::class,
5151
HttpClient::class,
52-
(is_object($client)) ? get_class($client) : gettype($client)
52+
(is_object($client)) ? get_class($client) : gettype($client),
5353
));
5454
}
5555

@@ -117,7 +117,7 @@ protected function get($path, $decodeIfJson = true)
117117
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeRequest(
118118
'GET',
119119
strval($path),
120-
$this->getContentTypeFromPath(strval($path))
120+
$this->getContentTypeFromPath(strval($path)),
121121
));
122122

123123
$body = $this->lastResponse->getContent();
@@ -158,7 +158,7 @@ protected function post($path, $data)
158158
'POST',
159159
strval($path),
160160
$this->getContentTypeFromPath(strval($path)),
161-
$data
161+
$data,
162162
));
163163

164164
$body = $this->lastResponse->getContent();
@@ -191,7 +191,7 @@ protected function put($path, $data)
191191
'PUT',
192192
strval($path),
193193
$this->getContentTypeFromPath(strval($path)),
194-
$data
194+
$data,
195195
));
196196

197197
$body = $this->lastResponse->getContent();
@@ -222,7 +222,7 @@ protected function delete($path)
222222
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeRequest(
223223
'DELETE',
224224
strval($path),
225-
$this->getContentTypeFromPath(strval($path))
225+
$this->getContentTypeFromPath(strval($path)),
226226
));
227227

228228
return $this->lastResponse->getContent();
@@ -251,7 +251,7 @@ protected function sanitizeParams(array $defaults, array $params)
251251
{
252252
return array_filter(
253253
array_merge($defaults, $params),
254-
[$this, 'isNotNull']
254+
[$this, 'isNotNull'],
255255
);
256256
}
257257

@@ -301,7 +301,7 @@ protected function retrieveData(string $endpoint, array $params = []): array
301301
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeRequest(
302302
'GET',
303303
strval($endpoint),
304-
$this->getContentTypeFromPath(strval($endpoint))
304+
$this->getContentTypeFromPath(strval($endpoint)),
305305
));
306306

307307
return $this->getResponseAsArray($this->lastResponse);
@@ -312,7 +312,7 @@ protected function retrieveData(string $endpoint, array $params = []): array
312312
'limit' => 25,
313313
'offset' => 0,
314314
],
315-
$params
315+
$params,
316316
);
317317

318318
$returnData = [];
@@ -334,7 +334,7 @@ protected function retrieveData(string $endpoint, array $params = []): array
334334
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeRequest(
335335
'GET',
336336
PathSerializer::create($endpoint, $params)->getPath(),
337-
$this->getContentTypeFromPath($endpoint)
337+
$this->getContentTypeFromPath($endpoint),
338338
));
339339

340340
$newDataSet = $this->getResponseAsArray($this->lastResponse);
@@ -457,7 +457,7 @@ public function request(Request $request): Response
457457
return HttpFactory::makeResponse(
458458
$this->client->getLastResponseStatusCode(),
459459
$this->client->getLastResponseContentType(),
460-
$this->client->getLastResponseBody()
460+
$this->client->getLastResponseBody(),
461461
);
462462
}
463463
};

src/Redmine/Api/Attachment.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ final public function update(int $id, array $params): bool
7070
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeJsonRequest(
7171
'PUT',
7272
'/attachments/' . $id . '.json',
73-
JsonSerializer::createFromArray(['attachment' => $params])->getEncoded()
73+
JsonSerializer::createFromArray(['attachment' => $params])->getEncoded(),
7474
));
7575

7676
if ($this->lastResponse->getStatusCode() !== 204) {
@@ -91,7 +91,7 @@ public function download($id)
9191
{
9292
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeRequest(
9393
'GET',
94-
'/attachments/download/' . urlencode(strval($id))
94+
'/attachments/download/' . urlencode(strval($id)),
9595
));
9696

9797
if (200 !== $this->lastResponse->getStatusCode()) {
@@ -119,7 +119,7 @@ public function upload($attachment, $params = [])
119119
'POST',
120120
PathSerializer::create('/uploads.json', $params)->getPath(),
121121
'application/octet-stream',
122-
$attachment
122+
$attachment,
123123
));
124124

125125
return $this->lastResponse->getContent();
@@ -138,7 +138,7 @@ public function remove($id)
138138
{
139139
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
140140
'DELETE',
141-
'/attachments/' . urlencode(strval($id)) . '.xml'
141+
'/attachments/' . urlencode(strval($id)) . '.xml',
142142
));
143143

144144
return $this->lastResponse->getContent();

src/Redmine/Api/Group.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function create(array $params = [])
151151
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
152152
'POST',
153153
'/groups.xml',
154-
XmlSerializer::createFromArray(['group' => $params])->getEncoded()
154+
XmlSerializer::createFromArray(['group' => $params])->getEncoded(),
155155
));
156156

157157
$body = $this->lastResponse->getContent();
@@ -185,7 +185,7 @@ public function update(int $id, array $params = [])
185185
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
186186
'PUT',
187187
'/groups/' . $id . '.xml',
188-
XmlSerializer::createFromArray(['group' => $params])->getEncoded()
188+
XmlSerializer::createFromArray(['group' => $params])->getEncoded(),
189189
));
190190

191191
return $this->lastResponse->getContent();
@@ -207,7 +207,7 @@ public function show($id, array $params = [])
207207
{
208208
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeJsonRequest(
209209
'GET',
210-
PathSerializer::create('/groups/' . urlencode(strval($id)) . '.json', $params)->getPath()
210+
PathSerializer::create('/groups/' . urlencode(strval($id)) . '.json', $params)->getPath(),
211211
));
212212

213213
$body = $this->lastResponse->getContent();
@@ -236,7 +236,7 @@ public function remove($id)
236236
{
237237
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
238238
'DELETE',
239-
'/groups/' . $id . '.xml'
239+
'/groups/' . $id . '.xml',
240240
));
241241

242242
return $this->lastResponse->getContent();
@@ -257,7 +257,7 @@ public function addUser($id, $userId)
257257
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
258258
'POST',
259259
'/groups/' . $id . '/users.xml',
260-
XmlSerializer::createFromArray(['user_id' => $userId])->getEncoded()
260+
XmlSerializer::createFromArray(['user_id' => $userId])->getEncoded(),
261261
));
262262

263263
$body = $this->lastResponse->getContent();
@@ -283,7 +283,7 @@ public function removeUser($id, $userId)
283283
{
284284
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
285285
'DELETE',
286-
'/groups/' . $id . '/users/' . $userId . '.xml'
286+
'/groups/' . $id . '/users/' . $userId . '.xml',
287287
));
288288

289289
return $this->lastResponse->getContent();

src/Redmine/Api/Issue.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public function show($id, array $params = [])
163163

164164
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeJsonRequest(
165165
'GET',
166-
PathSerializer::create('/issues/' . urlencode(strval($id)) . '.json', $params)->getPath()
166+
PathSerializer::create('/issues/' . urlencode(strval($id)) . '.json', $params)->getPath(),
167167
));
168168

169169
$body = $this->lastResponse->getContent();
@@ -217,7 +217,7 @@ public function create(array $params = [])
217217
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
218218
'POST',
219219
'/issues.xml',
220-
XmlSerializer::createFromArray(['issue' => $params])->getEncoded()
220+
XmlSerializer::createFromArray(['issue' => $params])->getEncoded(),
221221
));
222222

223223
$body = $this->lastResponse->getContent();
@@ -263,7 +263,7 @@ public function update($id, array $params)
263263
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
264264
'PUT',
265265
'/issues/' . urlencode(strval($id)) . '.xml',
266-
XmlSerializer::createFromArray(['issue' => $sanitizedParams])->getEncoded()
266+
XmlSerializer::createFromArray(['issue' => $sanitizedParams])->getEncoded(),
267267
));
268268

269269
return $this->lastResponse->getContent();
@@ -280,7 +280,7 @@ public function addWatcher($id, $watcherUserId)
280280
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
281281
'POST',
282282
'/issues/' . urlencode(strval($id)) . '/watchers.xml',
283-
XmlSerializer::createFromArray(['user_id' => urlencode(strval($watcherUserId))])->getEncoded()
283+
XmlSerializer::createFromArray(['user_id' => urlencode(strval($watcherUserId))])->getEncoded(),
284284
));
285285

286286
$body = $this->lastResponse->getContent();
@@ -302,7 +302,7 @@ public function removeWatcher($id, $watcherUserId)
302302
{
303303
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
304304
'DELETE',
305-
'/issues/' . urlencode(strval($id)) . '/watchers/' . urlencode(strval($watcherUserId)) . '.xml'
305+
'/issues/' . urlencode(strval($id)) . '/watchers/' . urlencode(strval($watcherUserId)) . '.xml',
306306
));
307307

308308
return $this->lastResponse->getContent();
@@ -428,7 +428,7 @@ public function attachMany($id, array $attachments)
428428
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeJsonRequest(
429429
'PUT',
430430
'/issues/' . urlencode(strval($id)) . '.json',
431-
JsonSerializer::createFromArray(['issue' => $params])->getEncoded()
431+
JsonSerializer::createFromArray(['issue' => $params])->getEncoded(),
432432
));
433433

434434
return $this->lastResponse->getContent();
@@ -445,7 +445,7 @@ public function remove($id)
445445
{
446446
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
447447
'DELETE',
448-
'/issues/' . urlencode(strval($id)) . '.xml'
448+
'/issues/' . urlencode(strval($id)) . '.xml',
449449
));
450450

451451
return $this->lastResponse->getContent();

src/Redmine/Api/IssueCategory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ final public function listByProject($projectIdentifier, array $params = []): arr
4242
if (! is_int($projectIdentifier) && ! is_string($projectIdentifier)) {
4343
throw new InvalidParameterException(sprintf(
4444
'%s(): Argument #1 ($projectIdentifier) must be of type int or string',
45-
__METHOD__
45+
__METHOD__,
4646
));
4747
}
4848

@@ -182,7 +182,7 @@ public function create($project, array $params = [])
182182
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
183183
'POST',
184184
'/projects/' . $project . '/issue_categories.xml',
185-
XmlSerializer::createFromArray(['issue_category' => $params])->getEncoded()
185+
XmlSerializer::createFromArray(['issue_category' => $params])->getEncoded(),
186186
));
187187

188188
$body = $this->lastResponse->getContent();
@@ -214,7 +214,7 @@ public function update($id, array $params)
214214
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
215215
'PUT',
216216
'/issue_categories/' . urlencode(strval($id)) . '.xml',
217-
XmlSerializer::createFromArray(['issue_category' => $params])->getEncoded()
217+
XmlSerializer::createFromArray(['issue_category' => $params])->getEncoded(),
218218
));
219219

220220
return $this->lastResponse->getContent();
@@ -236,7 +236,7 @@ public function remove($id, array $params = [])
236236
{
237237
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
238238
'DELETE',
239-
PathSerializer::create('/issue_categories/' . urlencode(strval($id)) . '.xml', $params)->getPath()
239+
PathSerializer::create('/issue_categories/' . urlencode(strval($id)) . '.xml', $params)->getPath(),
240240
));
241241

242242
return $this->lastResponse->getContent();

src/Redmine/Api/IssueRelation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function remove($id)
124124
{
125125
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
126126
'DELETE',
127-
'/relations/' . $id . '.xml'
127+
'/relations/' . $id . '.xml',
128128
));
129129

130130
return $this->lastResponse->getContent();
@@ -164,7 +164,7 @@ public function create($issueId, array $params = [])
164164
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeJsonRequest(
165165
'POST',
166166
'/issues/' . urlencode(strval($issueId)) . '/relations.json',
167-
JsonSerializer::createFromArray(['relation' => $params])->getEncoded()
167+
JsonSerializer::createFromArray(['relation' => $params])->getEncoded(),
168168
));
169169

170170
$body = $this->lastResponse->getContent();

src/Redmine/Api/Membership.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ final public function listByProject($projectIdentifier, array $params = []): arr
4040
if (! is_int($projectIdentifier) && ! is_string($projectIdentifier)) {
4141
throw new InvalidParameterException(sprintf(
4242
'%s(): Argument #1 ($projectIdentifier) must be of type int or string',
43-
__METHOD__
43+
__METHOD__,
4444
));
4545
}
4646

@@ -112,7 +112,7 @@ public function create($project, array $params = [])
112112
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
113113
'POST',
114114
'/projects/' . $project . '/memberships.xml',
115-
XmlSerializer::createFromArray(['membership' => $params])->getEncoded()
115+
XmlSerializer::createFromArray(['membership' => $params])->getEncoded(),
116116
));
117117

118118
$body = $this->lastResponse->getContent();
@@ -150,7 +150,7 @@ public function update($id, array $params = [])
150150
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
151151
'PUT',
152152
'/memberships/' . $id . '.xml',
153-
XmlSerializer::createFromArray(['membership' => $params])->getEncoded()
153+
XmlSerializer::createFromArray(['membership' => $params])->getEncoded(),
154154
));
155155

156156
return $this->lastResponse->getContent();
@@ -169,7 +169,7 @@ public function remove($id)
169169
{
170170
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
171171
'DELETE',
172-
'/memberships/' . $id . '.xml'
172+
'/memberships/' . $id . '.xml',
173173
));
174174

175175
return $this->lastResponse->getContent();

src/Redmine/Api/News.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ final public function listByProject($projectIdentifier, array $params = []): arr
3434
if (! is_int($projectIdentifier) && ! is_string($projectIdentifier)) {
3535
throw new InvalidParameterException(sprintf(
3636
'%s(): Argument #1 ($projectIdentifier) must be of type int or string',
37-
__METHOD__
37+
__METHOD__,
3838
));
3939
}
4040

0 commit comments

Comments
 (0)