Skip to content

Commit 72dbf34

Browse files
author
Artur Weigandt
committed
refactor: fix code with code quality prepared sets
1 parent db15e3e commit 72dbf34

29 files changed

+63
-69
lines changed

.rector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
->withPhp74Sets()
1515
->withPhpVersion(70400)
1616
->withTypeCoverageLevel(1)
17-
->withCodeQualityLevel(0)
1817
->withPreparedSets(
18+
true,
1919
true
2020
)
2121
;

src/Redmine/Api/AbstractApi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ protected function retrieveAll($endpoint, array $params = [])
300300
*/
301301
protected function retrieveData(string $endpoint, array $params = []): array
302302
{
303-
if (empty($params)) {
303+
if ($params === []) {
304304
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeRequest(
305305
'GET',
306306
strval($endpoint),
@@ -366,7 +366,7 @@ protected function retrieveData(string $endpoint, array $params = []): array
366366
$offset += $realLimit;
367367

368368
if (
369-
empty($newDataSet)
369+
$newDataSet === []
370370
|| !isset($newDataSet['limit'])
371371
|| (
372372
isset($newDataSet['offset'])

src/Redmine/Api/CustomField.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function all(array $params = [])
9292
return false;
9393
}
9494

95-
if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) {
95+
if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) {
9696
$e = $e->getPrevious();
9797
}
9898

@@ -151,7 +151,7 @@ public function getIdByName($name, array $params = [])
151151
*/
152152
private function doListing(bool $forceUpdate, array $params): array
153153
{
154-
if (empty($this->customFields) || $forceUpdate) {
154+
if ($this->customFields === [] || $forceUpdate) {
155155
$this->customFields = $this->list($params);
156156
}
157157

src/Redmine/Api/Group.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function all(array $params = [])
9494
return false;
9595
}
9696

97-
if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) {
97+
if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) {
9898
$e = $e->getPrevious();
9999
}
100100

@@ -118,7 +118,7 @@ public function listing($forceUpdate = false)
118118
{
119119
@trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . self::class . '::listNames()` instead.', E_USER_DEPRECATED);
120120

121-
if (empty($this->groups) || $forceUpdate) {
121+
if ($this->groups === [] || $forceUpdate) {
122122
$this->groups = $this->list();
123123
}
124124
$ret = [];

src/Redmine/Api/Issue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function all(array $params = [])
135135
return false;
136136
}
137137

138-
if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) {
138+
if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) {
139139
$e = $e->getPrevious();
140140
}
141141

src/Redmine/Api/IssueCategory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function all($project, array $params = [])
120120
return false;
121121
}
122122

123-
if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) {
123+
if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) {
124124
$e = $e->getPrevious();
125125
}
126126

@@ -296,7 +296,7 @@ public function remove($id, array $params = [])
296296
*/
297297
private function doListing($projectIdentifier, bool $forceUpdate): array
298298
{
299-
if (true === $forceUpdate || empty($this->issueCategories)) {
299+
if ($forceUpdate || $this->issueCategories === []) {
300300
$this->issueCategories = $this->listByProject($projectIdentifier);
301301
}
302302

src/Redmine/Api/IssuePriority.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function all(array $params = [])
6363
return false;
6464
}
6565

66-
if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) {
66+
if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) {
6767
$e = $e->getPrevious();
6868
}
6969

src/Redmine/Api/IssueRelation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function all($issueId, array $params = [])
6868
return false;
6969
}
7070

71-
if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) {
71+
if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) {
7272
$e = $e->getPrevious();
7373
}
7474

src/Redmine/Api/IssueStatus.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function all(array $params = [])
9292
return false;
9393
}
9494

95-
if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) {
95+
if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) {
9696
$e = $e->getPrevious();
9797
}
9898

@@ -147,7 +147,7 @@ public function getIdByName($name)
147147
*/
148148
private function doListing(bool $forceUpdate): array
149149
{
150-
if (empty($this->issueStatuses) || $forceUpdate) {
150+
if ($this->issueStatuses === [] || $forceUpdate) {
151151
$this->issueStatuses = $this->list();
152152
}
153153

src/Redmine/Api/Membership.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function all($project, array $params = [])
7878
return false;
7979
}
8080

81-
if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) {
81+
if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) {
8282
$e = $e->getPrevious();
8383
}
8484

0 commit comments

Comments
 (0)