Skip to content

Commit 80691a1

Browse files
Dominik MeyerDominik Meyer
authored andcommitted
fix some type-cast issues
1 parent 44b4a9b commit 80691a1

6 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/Message/Handler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function downloadMessage(string $filePath, int $messageId): bool
4747
&& $reader->depth === 1
4848
&& $reader->name == 'MESSAGE'
4949
) {
50-
$filePut = file_put_contents($filePath, $reader->readOuterXml());
50+
$filePut = (bool)file_put_contents($filePath, $reader->readOuterXml());
5151
$reader->close();
5252
return $filePut;
5353
}

src/Order/Handler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct(Client $client)
2222
$this->client = $client;
2323
}
2424

25-
public function getOrder(int $orderId): Order
25+
public function getOrder(int $orderId): ?Order
2626
{
2727
$catalog = new Tborderlist($this->client, 'orders/' . (int)$orderId, []);
2828
$orderIterator = $catalog->getOrders();
@@ -42,15 +42,15 @@ public function getOrderFromFile(string $filePath): Order
4242

4343
public function downloadOrder(string $filePath, int $orderId): bool
4444
{
45-
$reader = $this->client->getRestClient()->getXML('orders/' . (int)$orderId, []);
45+
$reader = $this->client->getRestClient()->getXML('orders/' . $orderId);
4646

4747
while ($reader->read()) {
4848
if (
4949
$reader->nodeType == XMLReader::ELEMENT
5050
&& $reader->depth === 1
5151
&& $reader->name == 'ORDER'
5252
) {
53-
$filePut = file_put_contents($filePath, $reader->readOuterXml());
53+
$filePut = (bool)file_put_contents($filePath, $reader->readOuterXml());
5454
$reader->close();
5555
return $filePut;
5656
}

src/Order/Tborder/Iterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Iterator extends Base\Iterator implements \Iterator
1313
{
1414
private ?Order $current = null;
1515

16-
public function current(): Order
16+
public function current(): ?Order
1717
{
1818
return $this->current;
1919
}

src/Product/Handler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function __construct(Client $client)
2121
$this->client = $client;
2222
}
2323

24-
public function getProduct(int $productId, int $channelId): Product
24+
public function getProduct(int $productId, int $channelId): ?Product
2525
{
2626
$catalog = new Tbcat($this->client, 'products/', ['p_id' => $productId, 'channel' => $channelId]);
2727
$productIterator = $catalog->getProducts();
@@ -52,7 +52,7 @@ public function downloadProduct(string $filePath, int $productId, int $channelId
5252
&& $reader->depth === 2
5353
&& $reader->name == 'PRODUCT'
5454
) {
55-
$filePut = file_put_contents($filePath, $reader->readOuterXml());
55+
$filePut = (bool)file_put_contents($filePath, $reader->readOuterXml());
5656
$reader->close();
5757
return $filePut;
5858
}

src/Product/Tbcat/Iterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function getSupplierName(): ?string
2424
return $this->supplierName;
2525
}
2626

27-
public function current(): Product
27+
public function current(): ?Product
2828
{
2929
return $this->current;
3030
}

src/Stock/Tbstock/Iterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function getChangeDate(): ?string
2323
return $this->changeDate;
2424
}
2525

26-
public function current(): Stock
26+
public function current(): ?Stock
2727
{
2828
return $this->current;
2929
}

0 commit comments

Comments
 (0)