Skip to content

Commit a58deea

Browse files
authored
Merge pull request #21 from coderflexx/laravel-10-support
Laravel 10 support
2 parents caf5c11 + 6d9da76 commit a58deea

12 files changed

+12
-66
lines changed

.github/workflows/run-tests.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@ jobs:
1313
fail-fast: true
1414
matrix:
1515
os: [ubuntu-latest, windows-latest]
16-
php: [8.1]
17-
laravel: [9.*]
16+
php: [8.1, 8.2]
17+
laravel: [9.*, 10.*]
1818
stability: [prefer-lowest, prefer-stable]
1919
include:
2020
- laravel: 9.*
2121
testbench: 7.*
22+
- laravel: 10.*
23+
testbench: 8.*
24+
exclude:
25+
- laravel: 9.*
26+
php: 8.2
2227

2328
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2429

composer.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@
1818
],
1919
"require": {
2020
"php": "^8.1",
21-
"illuminate/contracts": "^9.0",
21+
"illuminate/contracts": "^9.0|^10.0",
2222
"league/csv": "^9.8",
2323
"livewire/livewire": "^2.10",
2424
"spatie/laravel-package-tools": "^1.9.2"
2525
},
2626
"require-dev": {
2727
"laravel/pint": "^1.0",
28-
"nunomaduro/collision": "^6.0",
28+
"nunomaduro/collision": "^6.0|^7.0",
2929
"nunomaduro/larastan": "^2.0.1",
30-
"orchestra/testbench": "^7.0",
31-
"pestphp/pest": "^1.21",
30+
"orchestra/testbench": "^7.0|^8.0",
31+
"pestphp/pest": "^1.22",
3232
"pestphp/pest-plugin-laravel": "^1.1",
3333
"pestphp/pest-plugin-livewire": "^1.0",
3434
"phpstan/extension-installer": "^1.1",
3535
"phpstan/phpstan-deprecation-rules": "^1.0",
3636
"phpstan/phpstan-phpunit": "^1.0",
37-
"phpunit/phpunit": "^9.5"
37+
"phpunit/phpunit": "^9.5|^10.0"
3838
},
3939
"autoload": {
4040
"files": [

src/Concerns/HasCsvProperties.php

-6
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ trait HasCsvProperties
2020

2121
/**
2222
* Read CSV Property
23-
*
24-
* @return Reader
2523
*/
2624
public function getReadCsvProperty(): Reader
2725
{
@@ -30,8 +28,6 @@ public function getReadCsvProperty(): Reader
3028

3129
/**
3230
* Get CSV Records Property
33-
*
34-
* @return TabularDataReader
3531
*/
3632
public function getCsvRecordsProperty(): TabularDataReader
3733
{
@@ -40,8 +36,6 @@ public function getCsvRecordsProperty(): TabularDataReader
4036

4137
/**
4238
* Handle CSV Information properties from the given file
43-
*
44-
* @return array|\Illuminate\Support\MessageBag
4539
*/
4640
public function handleCsvProperties(): array|MessageBag
4741
{

src/Concerns/InteractsWithColumns.php

-6
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ trait InteractsWithColumns
66
{
77
/**
88
* Converts the columnsToMap property into an associative array.
9-
*
10-
* @return array
119
*/
1210
protected function mapThroughColumns(): array
1311
{
@@ -22,8 +20,6 @@ protected function mapThroughColumns(): array
2220

2321
/**
2422
* Maps requiredColumns property into columnsToMap required state.
25-
*
26-
* @return array
2723
*/
2824
protected function mapThroughRequiredColumns(): array
2925
{
@@ -39,8 +35,6 @@ protected function mapThroughRequiredColumns(): array
3935

4036
/**
4137
* Maps columnLabels property into columnsToMap label state.
42-
*
43-
* @return array
4438
*/
4539
protected function mapThroughColumnLabels(): array
4640
{

src/Concerns/InteractsWithCsvFiles.php

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ trait InteractsWithCsvFiles
88
{
99
/**
1010
* Read CSV File.
11-
*
12-
* @param string $path
13-
* @return Reader
1411
*/
1512
protected function readCSV(string $path): Reader
1613
{

src/Http/Livewire/CsvImporter.php

-6
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,19 @@ class CsvImporter extends Component
2222
/** @var string */
2323
public $model;
2424

25-
/** @var bool */
2625
public bool $open = false;
2726

2827
/** @var object */
2928
public $file;
3029

31-
/** @var array */
3230
public array $columnsToMap = [];
3331

34-
/** @var array */
3532
public array $requiredColumns = [];
3633

37-
/** @var array */
3834
public array $columnLabels = [];
3935

40-
/** @var array */
4136
public array $fileHeaders = [];
4237

43-
/** @var int */
4438
public int $fileRowCount = 0;
4539

4640
/** @var array */

src/LaravelCsvDirectives.php

-4
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ public static function csvStyles(): string|null
2020

2121
/**
2222
* Get CSV Scripts
23-
*
24-
* @return string
2523
*/
2624
public static function csvScripts(): string
2725
{
@@ -32,8 +30,6 @@ public static function csvScripts(): string
3230

3331
/**
3432
* Get Tailwind Style Path
35-
*
36-
* @return string
3733
*/
3834
protected static function getTailwindStyle(): string
3935
{

src/LaravelCsvManager.php

-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ class LaravelCsvManager
66
{
77
/**
88
* Get the given size and formated it.
9-
*
10-
* @param int $size
11-
* @param int $precision
12-
* @return string|int
139
*/
1410
public function formatFileSize(int $size, int $precision = 2): string|int
1511
{

src/LaravelCsvServiceProvider.php

-7
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ public function registeringPackage()
4343

4444
/**
4545
* Configure Laravel CSV Blade components
46-
*
47-
* @return void
4846
*/
4947
protected function configureComponents(): void
5048
{
@@ -55,8 +53,6 @@ protected function configureComponents(): void
5553

5654
/**
5755
* Register livewire components
58-
*
59-
* @return void
6056
*/
6157
protected function registerLivewireComponents(): void
6258
{
@@ -69,9 +65,6 @@ protected function registerLivewireComponents(): void
6965

7066
/**
7167
* Register given component.
72-
*
73-
* @param string $component
74-
* @return void
7568
*/
7669
protected function registerComponent(string $component): void
7770
{

src/Scopes/ImportScope.php

-12
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ trait ImportScope
99
{
1010
/**
1111
* Completed Status Scope
12-
*
13-
* @return \Illuminate\Database\Eloquent\Builder
1412
*/
1513
public function scopeCompleted(Builder $builder): Builder
1614
{
@@ -19,8 +17,6 @@ public function scopeCompleted(Builder $builder): Builder
1917

2018
/**
2119
* Not Completed Status Scope
22-
*
23-
* @return \Illuminate\Database\Eloquent\Builder
2420
*/
2521
public function scopeUnCompleted(Builder $builder): Builder
2622
{
@@ -29,8 +25,6 @@ public function scopeUnCompleted(Builder $builder): Builder
2925

3026
/**
3127
* Get the percentage of the model completion
32-
*
33-
* @return int|float
3428
*/
3529
public function percentageComplete(): int|float
3630
{
@@ -39,9 +33,6 @@ public function percentageComplete(): int|float
3933

4034
/**
4135
* Fetch imports based on the given model
42-
*
43-
* @param string $model
44-
* @return \Illuminate\Database\Eloquent\Builder
4536
*/
4637
public function scopeForModel(Builder $builder, string $model): Builder
4738
{
@@ -50,9 +41,6 @@ public function scopeForModel(Builder $builder, string $model): Builder
5041

5142
/**
5243
* Fetch imports on the user id
53-
*
54-
* @param int $user
55-
* @return \Illuminate\Database\Eloquent\Builder
5644
*/
5745
public function scopeForUser(Builder $builder, int $user): Builder
5846
{

src/Utilities/ChunkIterator.php

-8
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,8 @@
1818
*/
1919
class ChunkIterator
2020
{
21-
/**
22-
* @var Iterator
23-
*/
2421
protected Iterator $iterator;
2522

26-
/**
27-
* @var int
28-
*/
2923
protected int $chunkSize;
3024

3125
public function __construct(Iterator $iterator, int $chunkSize)
@@ -36,8 +30,6 @@ public function __construct(Iterator $iterator, int $chunkSize)
3630

3731
/**
3832
* Chunk the given data
39-
*
40-
* @return Generator
4133
*/
4234
public function get(): Generator
4335
{

src/helpers.php

-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
if (! function_exists('Coderflex\LaravelCsv\csv_view_path')) {
66
/**
77
* Get the evaluated view content from the livewire view
8-
*
9-
* @param string|null $view
10-
* @return string
118
*/
129
function csv_view_path(string|null $view): string
1310
{

0 commit comments

Comments
 (0)