Skip to content

Commit 32563ff

Browse files
Merge pull request #131 from plesk/dependabot/composer/vimeo/psalm-5.15.0
TECH Bump vimeo/psalm from 5.14.1 to 5.15.0
2 parents 4a2ec7c + 5c6317f commit 32563ff

30 files changed

+101
-65
lines changed

composer.lock

Lines changed: 15 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Api/AbstractStruct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __set(string $property, $value)
2424
*
2525
* @throws \Exception
2626
*/
27-
protected function initScalarProperties($apiResponse, array $properties): void
27+
protected function initScalarProperties(\SimpleXMLElement $apiResponse, array $properties): void
2828
{
2929
foreach ($properties as $property) {
3030
if (is_array($property)) {

src/Api/Operator/DatabaseServer.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ private function getBy($field = null, $value = null): array
6060
if (!$xmlResult) {
6161
continue;
6262
}
63-
$item = new Struct\Info($xmlResult->data);
64-
$item->id = (int) $xmlResult->id;
65-
$items[] = $item;
63+
if (!is_null($xmlResult->data)) {
64+
$item = new Struct\Info($xmlResult->data);
65+
$item->id = (int) $xmlResult->id;
66+
$items[] = $item;
67+
}
6668
}
6769

6870
return $items;

src/Api/Operator/Dns.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,11 @@ public function getAll(string $field, $value): array
8282
if (!$xmlResult) {
8383
continue;
8484
}
85-
$item = new Struct\Info($xmlResult->data);
86-
$item->id = (int) $xmlResult->id;
87-
$items[] = $item;
85+
if (!is_null($xmlResult->data)) {
86+
$item = new Struct\Info($xmlResult->data);
87+
$item->id = (int) $xmlResult->id;
88+
$items[] = $item;
89+
}
8890
}
8991

9092
return $items;

src/Api/Operator/DnsTemplate.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ public function getAll($field = null, $value = null): array
6363
if (!$xmlResult) {
6464
continue;
6565
}
66-
$item = new Struct\Info($xmlResult->data);
67-
$item->id = (int) $xmlResult->id;
68-
$items[] = $item;
66+
if (!is_null($xmlResult->data)) {
67+
$item = new Struct\Info($xmlResult->data);
68+
$item->id = (int) $xmlResult->id;
69+
$items[] = $item;
70+
}
6971
}
7072

7173
return $items;

src/Api/Operator/EventLog.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function get(): array
1717
$records = [];
1818
$response = $this->request('get');
1919

20-
foreach ($response->event as $eventInfo) {
20+
foreach ($response->event ?? [] as $eventInfo) {
2121
$records[] = new Struct\Event($eventInfo);
2222
}
2323

@@ -32,7 +32,7 @@ public function getDetailedLog(): array
3232
$records = [];
3333
$response = $this->request('get_events');
3434

35-
foreach ($response->event as $eventInfo) {
35+
foreach ($response->event ?? [] as $eventInfo) {
3636
$records[] = new Struct\DetailedEvent($eventInfo);
3737
}
3838

src/Api/Operator/Ip.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function get(): array
1717
$packet->addChild($this->wrapperTag)->addChild('get');
1818
$response = $this->client->request($packet);
1919

20-
foreach ($response->addresses->ip_info as $ipInfo) {
20+
foreach ($response->addresses->ip_info ?? [] as $ipInfo) {
2121
$ips[] = new Struct\Info($ipInfo);
2222
}
2323

src/Api/Operator/Locale.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ public function get($id = null)
2424

2525
$response = $this->client->request($packet, \PleskX\Api\Client::RESPONSE_FULL);
2626

27-
foreach ($response->locale->get->result as $localeInfo) {
28-
$locales[(string) $localeInfo->info->id] = new Struct\Info($localeInfo->info);
27+
foreach ($response->locale->get->result ?? [] as $localeInfo) {
28+
if (!is_null($localeInfo->info)) {
29+
$locales[(string) $localeInfo->info->id] = new Struct\Info($localeInfo->info);
30+
}
2931
}
3032

3133
return !is_null($id) ? reset($locales) : $locales;

src/Api/Operator/Mail.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ public function create(string $name, int $siteId, bool $mailbox = false, string
2222
$mailname->addChild('mailbox')->addChild('enabled', 'true');
2323
}
2424
if (!empty($password)) {
25+
/** @psalm-suppress UndefinedPropertyAssignment */
2526
$mailname->addChild('password')->value = $password;
2627
}
2728

2829
$response = $this->client->request($packet);
2930

31+
/** @psalm-suppress PossiblyNullArgument */
3032
return new Struct\Info($response->mailname);
3133
}
3234

src/Api/Operator/ProtectedDirectory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public function getAll(string $field, $value): array
7373
* @param string $password
7474
*
7575
* @return Struct\UserInfo
76+
* @psalm-suppress UndefinedPropertyAssignment
7677
*/
7778
public function addUser($protectedDirectory, $login, $password)
7879
{

0 commit comments

Comments
 (0)