Skip to content

Fix CS errors #402

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

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'linebreak_after_opening_tag' => true,
'ordered_imports' => true,
'phpdoc_order' => true,
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['arguments', 'arrays']], // Remove this rule after dropping support for PHP 7.4
])
->setFinder($finder)
->setRiskyAllowed(true)
Expand Down
20 changes: 10 additions & 10 deletions src/Redmine/Api/AbstractApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct($client)
__METHOD__,
Client::class,
HttpClient::class,
(is_object($client)) ? get_class($client) : gettype($client)
(is_object($client)) ? get_class($client) : gettype($client),
));
}

Expand Down Expand Up @@ -117,7 +117,7 @@ protected function get($path, $decodeIfJson = true)
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeRequest(
'GET',
strval($path),
$this->getContentTypeFromPath(strval($path))
$this->getContentTypeFromPath(strval($path)),
));

$body = $this->lastResponse->getContent();
Expand Down Expand Up @@ -158,7 +158,7 @@ protected function post($path, $data)
'POST',
strval($path),
$this->getContentTypeFromPath(strval($path)),
$data
$data,
));

$body = $this->lastResponse->getContent();
Expand Down Expand Up @@ -191,7 +191,7 @@ protected function put($path, $data)
'PUT',
strval($path),
$this->getContentTypeFromPath(strval($path)),
$data
$data,
));

$body = $this->lastResponse->getContent();
Expand Down Expand Up @@ -222,7 +222,7 @@ protected function delete($path)
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeRequest(
'DELETE',
strval($path),
$this->getContentTypeFromPath(strval($path))
$this->getContentTypeFromPath(strval($path)),
));

return $this->lastResponse->getContent();
Expand Down Expand Up @@ -251,7 +251,7 @@ protected function sanitizeParams(array $defaults, array $params)
{
return array_filter(
array_merge($defaults, $params),
[$this, 'isNotNull']
[$this, 'isNotNull'],
);
}

Expand Down Expand Up @@ -301,7 +301,7 @@ protected function retrieveData(string $endpoint, array $params = []): array
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeRequest(
'GET',
strval($endpoint),
$this->getContentTypeFromPath(strval($endpoint))
$this->getContentTypeFromPath(strval($endpoint)),
));

return $this->getResponseAsArray($this->lastResponse);
Expand All @@ -312,7 +312,7 @@ protected function retrieveData(string $endpoint, array $params = []): array
'limit' => 25,
'offset' => 0,
],
$params
$params,
);

$returnData = [];
Expand All @@ -334,7 +334,7 @@ protected function retrieveData(string $endpoint, array $params = []): array
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeRequest(
'GET',
PathSerializer::create($endpoint, $params)->getPath(),
$this->getContentTypeFromPath($endpoint)
$this->getContentTypeFromPath($endpoint),
));

$newDataSet = $this->getResponseAsArray($this->lastResponse);
Expand Down Expand Up @@ -457,7 +457,7 @@ public function request(Request $request): Response
return HttpFactory::makeResponse(
$this->client->getLastResponseStatusCode(),
$this->client->getLastResponseContentType(),
$this->client->getLastResponseBody()
$this->client->getLastResponseBody(),
);
}
};
Expand Down
8 changes: 4 additions & 4 deletions src/Redmine/Api/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ final public function update(int $id, array $params): bool
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeJsonRequest(
'PUT',
'/attachments/' . $id . '.json',
JsonSerializer::createFromArray(['attachment' => $params])->getEncoded()
JsonSerializer::createFromArray(['attachment' => $params])->getEncoded(),
));

if ($this->lastResponse->getStatusCode() !== 204) {
Expand All @@ -91,7 +91,7 @@ public function download($id)
{
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeRequest(
'GET',
'/attachments/download/' . urlencode(strval($id))
'/attachments/download/' . urlencode(strval($id)),
));

if (200 !== $this->lastResponse->getStatusCode()) {
Expand Down Expand Up @@ -119,7 +119,7 @@ public function upload($attachment, $params = [])
'POST',
PathSerializer::create('/uploads.json', $params)->getPath(),
'application/octet-stream',
$attachment
$attachment,
));

return $this->lastResponse->getContent();
Expand All @@ -138,7 +138,7 @@ public function remove($id)
{
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
'DELETE',
'/attachments/' . urlencode(strval($id)) . '.xml'
'/attachments/' . urlencode(strval($id)) . '.xml',
));

return $this->lastResponse->getContent();
Expand Down
12 changes: 6 additions & 6 deletions src/Redmine/Api/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function create(array $params = [])
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
'POST',
'/groups.xml',
XmlSerializer::createFromArray(['group' => $params])->getEncoded()
XmlSerializer::createFromArray(['group' => $params])->getEncoded(),
));

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

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

$body = $this->lastResponse->getContent();
Expand Down Expand Up @@ -236,7 +236,7 @@ public function remove($id)
{
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
'DELETE',
'/groups/' . $id . '.xml'
'/groups/' . $id . '.xml',
));

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

$body = $this->lastResponse->getContent();
Expand All @@ -283,7 +283,7 @@ public function removeUser($id, $userId)
{
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
'DELETE',
'/groups/' . $id . '/users/' . $userId . '.xml'
'/groups/' . $id . '/users/' . $userId . '.xml',
));

return $this->lastResponse->getContent();
Expand Down
14 changes: 7 additions & 7 deletions src/Redmine/Api/Issue.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function show($id, array $params = [])

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

$body = $this->lastResponse->getContent();
Expand Down Expand Up @@ -217,7 +217,7 @@ public function create(array $params = [])
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
'POST',
'/issues.xml',
XmlSerializer::createFromArray(['issue' => $params])->getEncoded()
XmlSerializer::createFromArray(['issue' => $params])->getEncoded(),
));

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

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

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

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

return $this->lastResponse->getContent();
Expand All @@ -445,7 +445,7 @@ public function remove($id)
{
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
'DELETE',
'/issues/' . urlencode(strval($id)) . '.xml'
'/issues/' . urlencode(strval($id)) . '.xml',
));

return $this->lastResponse->getContent();
Expand Down
8 changes: 4 additions & 4 deletions src/Redmine/Api/IssueCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ final public function listByProject($projectIdentifier, array $params = []): arr
if (! is_int($projectIdentifier) && ! is_string($projectIdentifier)) {
throw new InvalidParameterException(sprintf(
'%s(): Argument #1 ($projectIdentifier) must be of type int or string',
__METHOD__
__METHOD__,
));
}

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

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

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

return $this->lastResponse->getContent();
Expand Down
4 changes: 2 additions & 2 deletions src/Redmine/Api/IssueRelation.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function remove($id)
{
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
'DELETE',
'/relations/' . $id . '.xml'
'/relations/' . $id . '.xml',
));

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

$body = $this->lastResponse->getContent();
Expand Down
8 changes: 4 additions & 4 deletions src/Redmine/Api/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ final public function listByProject($projectIdentifier, array $params = []): arr
if (! is_int($projectIdentifier) && ! is_string($projectIdentifier)) {
throw new InvalidParameterException(sprintf(
'%s(): Argument #1 ($projectIdentifier) must be of type int or string',
__METHOD__
__METHOD__,
));
}

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

$body = $this->lastResponse->getContent();
Expand Down Expand Up @@ -150,7 +150,7 @@ public function update($id, array $params = [])
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
'PUT',
'/memberships/' . $id . '.xml',
XmlSerializer::createFromArray(['membership' => $params])->getEncoded()
XmlSerializer::createFromArray(['membership' => $params])->getEncoded(),
));

return $this->lastResponse->getContent();
Expand All @@ -169,7 +169,7 @@ public function remove($id)
{
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
'DELETE',
'/memberships/' . $id . '.xml'
'/memberships/' . $id . '.xml',
));

return $this->lastResponse->getContent();
Expand Down
2 changes: 1 addition & 1 deletion src/Redmine/Api/News.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final public function listByProject($projectIdentifier, array $params = []): arr
if (! is_int($projectIdentifier) && ! is_string($projectIdentifier)) {
throw new InvalidParameterException(sprintf(
'%s(): Argument #1 ($projectIdentifier) must be of type int or string',
__METHOD__
__METHOD__,
));
}

Expand Down
Loading
Loading