Skip to content

Commit 14720c8

Browse files
committed
Fix CS with php-cs-fixer
1 parent ad5c0b9 commit 14720c8

22 files changed

+35
-61
lines changed

src/Redmine/Api/AbstractApi.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Redmine\Api;
44

5-
use JsonException;
65
use Redmine\Api;
76
use Redmine\Client\Client;
87
use Redmine\Exception\SerializerException;
@@ -165,7 +164,7 @@ protected function sanitizeParams(array $defaults, array $params)
165164
* Retrieves all the elements of a given endpoint (even if the
166165
* total number of elements is greater than 100).
167166
*
168-
* @deprecated the `retrieveAll()` method is deprecated, use `retrieveData()` instead.
167+
* @deprecated the `retrieveAll()` method is deprecated, use `retrieveData()` instead
169168
*
170169
* @param string $endpoint API end point
171170
* @param array $params optional parameters to be passed to the api (offset, limit, ...)
@@ -297,7 +296,7 @@ protected function attachCustomFieldXML(SimpleXMLElement $xml, array $fields)
297296
}
298297

299298
/**
300-
* returns the last response body as array
299+
* returns the last response body as array.
301300
*
302301
* @throws SerializerException if response body could not be converted into array
303302
*/
@@ -310,14 +309,12 @@ private function getLastResponseBodyAsArray(): array
310309
// parse XML
311310
if (0 === strpos($contentType, 'application/xml')) {
312311
$returnData = XmlSerializer::createFromString($body)->getNormalized();
313-
} else if (0 === strpos($contentType, 'application/json')) {
312+
} elseif (0 === strpos($contentType, 'application/json')) {
314313
$returnData = JsonSerializer::createFromString($body)->getNormalized();
315314
}
316315

317-
if (! is_array($returnData)) {
318-
throw new SerializerException(
319-
'Could not convert response body into array: ' . $body
320-
);
316+
if (!is_array($returnData)) {
317+
throw new SerializerException('Could not convert response body into array: '.$body);
321318
}
322319

323320
return $returnData;

src/Redmine/Api/Issue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public function update($id, array $params)
167167
$sanitizedParams = $this->sanitizeParams($defaults, $params);
168168

169169
// Allow assigned_to_id to be `` (empty string) to unassign a user from an issue
170-
if (array_key_exists('assigned_to_id', $params) && $params['assigned_to_id'] === '') {
170+
if (array_key_exists('assigned_to_id', $params) && '' === $params['assigned_to_id']) {
171171
$sanitizedParams['assigned_to_id'] = '';
172172
}
173173

src/Redmine/Api/Wiki.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function show($project, $page, $version = null)
5050
'include' => 'attachments',
5151
];
5252

53-
if ($version === null) {
53+
if (null === $version) {
5454
$path = '/projects/'.$project.'/wiki/'.$page.'.json';
5555
} else {
5656
$path = '/projects/'.$project.'/wiki/'.$page.'/'.$version.'.json';

src/Redmine/Exception/SerializerException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Redmine\Exception;
44

5-
use RuntimeException;
65
use Redmine\Exception as RedmineException;
6+
use RuntimeException;
77

88
class SerializerException extends RuntimeException implements RedmineException
99
{

src/Redmine/Serializer/JsonSerializer.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Redmine\Exception\SerializerException;
77

88
/**
9-
* JsonSerializer
9+
* JsonSerializer.
1010
*
1111
* @internal
1212
*/
@@ -25,7 +25,7 @@ public static function createFromString(string $data): self
2525

2626
private string $encoded;
2727

28-
/** @var mixed $normalized */
28+
/** @var mixed */
2929
private $normalized;
3030

3131
private function __construct()
@@ -53,11 +53,7 @@ private function decode(string $encoded): void
5353
\JSON_THROW_ON_ERROR
5454
);
5555
} catch (JsonException $e) {
56-
throw new SerializerException(
57-
'Catched error "' . $e->getMessage() . '" while decoding JSON: ' . $encoded,
58-
$e->getCode(),
59-
$e
60-
);
56+
throw new SerializerException('Catched error "'.$e->getMessage().'" while decoding JSON: '.$encoded, $e->getCode(), $e);
6157
}
6258
}
6359
}

src/Redmine/Serializer/PathSerializer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Redmine\Serializer;
44

55
/**
6-
* PathSerializer
6+
* PathSerializer.
77
*
88
* @internal
99
*/
@@ -31,13 +31,13 @@ public function getPath(): string
3131
{
3232
$queryString = '';
3333

34-
if (! empty($this->queryParams)) {
35-
$queryString = '?' . \http_build_query($this->queryParams);
34+
if (!empty($this->queryParams)) {
35+
$queryString = '?'.\http_build_query($this->queryParams);
3636

3737
// @see #154: replace every encoded array (`foo[0]=`, `foo[1]=`, etc with `foo[]=`)
3838
$queryString = preg_replace('/%5B[0-9]+%5D/simU', '%5B%5D', $queryString);
3939
}
4040

41-
return $this->path . $queryString;
41+
return $this->path.$queryString;
4242
}
4343
}

src/Redmine/Serializer/XmlSerializer.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use SimpleXMLElement;
88

99
/**
10-
* XmlSerializer
10+
* XmlSerializer.
1111
*
1212
* @internal
1313
*/
@@ -26,7 +26,7 @@ public static function createFromString(string $data): self
2626

2727
private string $encoded;
2828

29-
/** @var mixed $normalized */
29+
/** @var mixed */
3030
private $normalized;
3131

3232
private SimpleXMLElement $deserialized;
@@ -51,11 +51,7 @@ private function deserialize(string $encoded): void
5151
try {
5252
$this->deserialized = new SimpleXMLElement($encoded);
5353
} catch (Exception $e) {
54-
throw new SerializerException(
55-
'Catched error "' . $e->getMessage() . '" while decoding XML: ' . $encoded,
56-
$e->getCode(),
57-
$e
58-
);
54+
throw new SerializerException('Catched error "'.$e->getMessage().'" while decoding XML: '.$encoded, $e->getCode(), $e);
5955
}
6056

6157
$this->normalize($this->deserialized);
@@ -66,11 +62,7 @@ private function normalize(SimpleXMLElement $deserialized): void
6662
try {
6763
$serialized = json_encode($deserialized, \JSON_THROW_ON_ERROR);
6864
} catch (JsonException $e) {
69-
throw new SerializerException(
70-
'Catched error "' . $e->getMessage() . '" while encoding SimpleXMLElement',
71-
$e->getCode(),
72-
$e
73-
);
65+
throw new SerializerException('Catched error "'.$e->getMessage().'" while encoding SimpleXMLElement', $e->getCode(), $e);
7466
}
7567

7668
$this->normalized = JsonSerializer::createFromString($serialized)->getNormalized();

tests/Integration/IssueCategoryXmlTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Redmine\Tests\Integration;
44

55
use DOMDocument;
6-
use Exception;
76
use PHPUnit\Framework\TestCase;
87
use Redmine\Exception\MissingParameterException;
98
use Redmine\Tests\Fixtures\MockClient;

tests/Integration/MembershipXmlTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Redmine\Tests\Integration;
44

55
use DOMDocument;
6-
use Exception;
76
use PHPUnit\Framework\TestCase;
87
use Redmine\Exception\MissingParameterException;
98
use Redmine\Tests\Fixtures\MockClient;

tests/Integration/ProjectXmlTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Redmine\Tests\Integration;
44

55
use DOMDocument;
6-
use Exception;
76
use PHPUnit\Framework\TestCase;
87
use Redmine\Exception\MissingParameterException;
98
use Redmine\Tests\Fixtures\MockClient;

0 commit comments

Comments
 (0)