Skip to content

Commit 3afdc68

Browse files
IbrahimhizeouiNyholm
authored andcommitted
change item no to string (#36)
* change item no to string * cs fix
1 parent b39fe35 commit 3afdc68

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

src/Api/Item.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ public function search(array $param = [])
3636
}
3737

3838
/**
39-
* @param int $itemNo
40-
* @param array $param
39+
* @param string $itemNo
40+
* @param array $param
4141
*
4242
* @return mixed|\Psr\Http\Message\ResponseInterface
4343
*
4444
* @see https://billogram.com/api/documentation#items_fetch
4545
*/
46-
public function fetch(int $itemNo, array $param = [])
46+
public function fetch(string $itemNo, array $param = [])
4747
{
4848
$response = $this->httpGet('/item/'.$itemNo, $param);
4949
if (!$this->hydrator) {

src/Model/Item/BaseItem.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
abstract class BaseItem implements CreatableFromArray
1313
{
1414
/**
15-
* @var int
15+
* @var string
1616
*/
1717
protected $itemNo;
1818

@@ -57,19 +57,19 @@ abstract class BaseItem implements CreatableFromArray
5757
protected $updatedAt;
5858

5959
/**
60-
* @return int
60+
* @return string
6161
*/
62-
public function getItemNo(): int
62+
public function getItemNo()
6363
{
6464
return $this->itemNo;
6565
}
6666

6767
/**
68-
* @param int $itemNo
68+
* @param string $itemNo
6969
*
7070
* @return Item
7171
*/
72-
public function withItemNo(int $itemNo)
72+
public function withItemNo(string $itemNo)
7373
{
7474
$new = clone $this;
7575
$new->itemNo = $itemNo;

tests/Api/InvoiceTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function testCreate()
3030
$customer = new Customer();
3131
$customer = $customer->withCustomerNo(23);
3232
$item2 = new Item();
33-
$item2 = $item2->withItemNo(25);
33+
$item2 = $item2->withItemNo('25');
3434
$item2 = $item2->withCount(5);
3535
$item2 = $item2->withDiscount(0);
3636
$invoice = new Invoice();
@@ -50,11 +50,11 @@ public function testPut()
5050
$customer = new Customer();
5151
$customer = $customer->withCustomerNo(25);
5252
$item1 = new Item();
53-
$item1 = $item1->withItemNo(3);
53+
$item1 = $item1->withItemNo('3');
5454
$item1 = $item1->withCount(5);
5555
$item1 = $item1->withDiscount(0);
5656
$item2 = new Item();
57-
$item2 = $item2->withItemNo(2);
57+
$item2 = $item2->withItemNo('2');
5858
$item2 = $item2->withCount(2);
5959
$item2 = $item2->withDiscount(1);
6060
$apiClient = BillogramClient::create('20561-3vhGtAxH', '4eddc2ab063bdd53dc64836ff3a0c7bc');

tests/Api/ItemTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function testCreate()
4646
public function testUpdate()
4747
{
4848
$bookkeeping = Bookkeeping::createFromArray(['income_account' => '302', 'vat_account' => '303']);
49-
$item = $this->testFetch(3);
49+
$item = $this->testFetch('3');
5050
$item = $item->withTitle('cc');
5151
$item = $item->withDescription('cc');
5252
$item = $item->withPrice(12);
@@ -71,7 +71,7 @@ public function testDelete(int $itemNo = 9)
7171
$this->assertInstanceOf(Item::class, $customerDeleted);
7272
}
7373

74-
public function testFetch(int $itemNo = 10)
74+
public function testFetch(string $itemNo = '10')
7575
{
7676
$cacheClient = $this->getHttpClient();
7777
$httpClientConfigurator = new HttpClientConfigurator($cacheClient);

0 commit comments

Comments
 (0)