Skip to content

Commit f4aba39

Browse files
authored
Merge pull request #25 from justbetter/feature/enumerable-skus
Enumerable skus instead of Collection
2 parents 745314c + 0099789 commit f4aba39

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ namespace App\Integrations\MagentoStock;
126126

127127
use JustBetter\MagentoStock\Repositories\Repository;
128128
use Illuminate\Support\Carbon;
129-
use Illuminate\Support\Collection;
129+
use Illuminate\Support\Enumerable;
130130

131131
class MyStockRepository extends Repository
132132
{
133-
public function skus(?Carbon $from = null): ?Collection
133+
public function skus(?Carbon $from = null): ?Enumerable
134134
{
135135
return collect(['sku_1', 'sku_2']);
136136
}

src/Repositories/BaseRepository.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace JustBetter\MagentoStock\Repositories;
44

55
use Illuminate\Support\Carbon;
6-
use Illuminate\Support\Collection;
6+
use Illuminate\Support\Enumerable;
77
use JustBetter\MagentoStock\Data\StockData;
88

99
abstract class BaseRepository
@@ -63,8 +63,8 @@ public static function resolve(): BaseRepository
6363
return $instance;
6464
}
6565

66-
/** @return Collection<int, string> */
67-
abstract public function skus(?Carbon $from = null): Collection;
66+
/** @return Enumerable<int, string> */
67+
abstract public function skus(?Carbon $from = null): Enumerable;
6868

6969
abstract public function retrieve(string $sku): ?StockData;
7070
}

src/Repositories/Repository.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace JustBetter\MagentoStock\Repositories;
44

55
use Illuminate\Support\Carbon;
6-
use Illuminate\Support\Collection;
6+
use Illuminate\Support\Enumerable;
77
use JustBetter\MagentoProducts\Models\MagentoProduct;
88
use JustBetter\MagentoStock\Data\StockData;
99
use JustBetter\MagentoStock\Exceptions\NotImplementedException;
@@ -15,9 +15,9 @@ public function retrieve(string $sku): ?StockData
1515
throw new NotImplementedException;
1616
}
1717

18-
public function skus(?Carbon $from = null): Collection
18+
public function skus(?Carbon $from = null): Enumerable
1919
{
20-
/** @var Collection<int, string> $skus */
20+
/** @var Enumerable<int, string> $skus */
2121
$skus = MagentoProduct::query()
2222
->where('exists_in_magento', '=', true)
2323
->select(['sku'])

0 commit comments

Comments
 (0)