Skip to content

Commit

Permalink
Laravel 10 support
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigopedra committed Feb 15, 2023
1 parent e72031a commit 3ed0a3e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
}
],
"require": {
"php": "^8.0",
"rodrigopedra/record-processor": "^2.1",
"illuminate/contracts": "^9.0",
"illuminate/database": "^9.0",
"illuminate/support": "^9.0"
"php": "^8.1",
"rodrigopedra/record-processor": "^3.0",
"illuminate/contracts": "^10.0",
"illuminate/database": "^10.0",
"illuminate/support": "^10.0"
},
"require-dev": {
"symfony/console": "^6.0",
"symfony/http-foundation": "^6.0",
"symfony/process": "^6.0",
"symfony/var-dumper": "^6.0"
"symfony/console": "^6.2.5",
"symfony/http-foundation": "^6.2.6",
"symfony/process": "^6.2.5",
"symfony/var-dumper": "^6.2.5"
},
"autoload": {
"psr-4": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class EloquentSerializerConfigurator extends SerializerConfigurator
{
public function __construct(EloquentSerializer $serializer)
{
parent::__construct($serializer, false, false);
parent::__construct($serializer);
}

public function builder(): Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class QueryBuilderSerializerConfigurator extends SerializerConfigurator
{
public function __construct(QueryBuilderSerializer $serializer)
{
parent::__construct($serializer, false, false);
parent::__construct($serializer);
}

public function queryBuilder(): Builder
Expand Down
9 changes: 8 additions & 1 deletion src/Readers/EloquentReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ public function __construct(Builder $eloquentBuilder)
public function open()
{
$this->lineCount = 0;
$this->withInnerIterator($this->builder->cursor()->getIterator());

$iterator = $this->builder->cursor()->getIterator();
$iterator = match (true) {
$iterator instanceof \Iterator => $iterator,
default => new \IteratorIterator($iterator),
};

$this->withInnerIterator($iterator);
}

public function close()
Expand Down
8 changes: 7 additions & 1 deletion src/Readers/QueryBuilderReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ public function open()
{
$this->lineCount = 0;

$this->withInnerIterator($this->queryBuilder->cursor()->getIterator());
$iterator = $this->queryBuilder->cursor()->getIterator();
$iterator = match (true) {
$iterator instanceof \Iterator => $iterator,
default => new \IteratorIterator($iterator),
};

$this->withInnerIterator($iterator);
}

public function close()
Expand Down

0 comments on commit 3ed0a3e

Please sign in to comment.