Skip to content

Commit

Permalink
Merge 2.x into 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI committed Jan 4, 2022
2 parents 5c1657b + bea28f5 commit 75ff542
Show file tree
Hide file tree
Showing 19 changed files with 66 additions and 62 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
extensions: mongodb

- name: Install Composer dependencies (highest)
uses: ramsey/composer-install@v1
uses: ramsey/composer-install@v2
with:
dependency-versions: highest
composer-options: --prefer-dist --prefer-stable
Expand All @@ -57,7 +57,7 @@ jobs:
extensions: mongodb

- name: Install Composer dependencies (highest)
uses: ramsey/composer-install@v1
uses: ramsey/composer-install@v2
with:
dependency-versions: highest
composer-options: --prefer-dist --prefer-stable
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
run: composer config minimum-stability dev

- name: Install Composer dependencies (${{ matrix.dependencies }})
uses: ramsey/composer-install@v1
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: --prefer-dist --prefer-stable
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [2.10.1](https://github.com/sonata-project/exporter/compare/2.10.0...2.10.1) - 2022-01-03
### Fixed
- [[#567](https://github.com/sonata-project/exporter/pull/567)] SourceIteratorInterface unresolvable generics ([@VincentLanglet](https://github.com/VincentLanglet))

## [2.10.0](https://github.com/sonata-project/exporter/compare/2.9.1...2.10.0) - 2022-01-02
### Added
- [[#560](https://github.com/sonata-project/exporter/pull/560)] Added class `XlsxWriter` that uses "phpoffice/phpspreadsheet" as suggested package. ([@willemverspyck](https://github.com/willemverspyck))
- [[#560](https://github.com/sonata-project/exporter/pull/560)] Default the XLSX export is not enabled. You can enable it by adding "xlsx" to "default_writers" in configuration. ([@willemverspyck](https://github.com/willemverspyck))
- [[#560](https://github.com/sonata-project/exporter/pull/560)] Added tests for the `XlsxWriter` class. ([@willemverspyck](https://github.com/willemverspyck))

### Deprecated
- [[#565](https://github.com/sonata-project/exporter/pull/565)] AbstractTypedWriterTestCase ([@VincentLanglet](https://github.com/VincentLanglet))

### Fixed
- [[#562](https://github.com/sonata-project/exporter/pull/562)] DBAL v3 compatibility ([@VincentLanglet](https://github.com/VincentLanglet))

## [2.9.1](https://github.com/sonata-project/exporter/compare/2.9.0...2.9.1) - 2021-11-12
### Fixed
- [[#550](https://github.com/sonata-project/exporter/pull/550)] Fixed compatibility with doctrine/dbal ^2.13 ([@jordisala1991](https://github.com/jordisala1991))
Expand Down
19 changes: 0 additions & 19 deletions UPGRADE-1.x.md

This file was deleted.

20 changes: 0 additions & 20 deletions UPGRADE-2.0.md

This file was deleted.

9 changes: 6 additions & 3 deletions UPGRADE-2.x.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# UPGRADE 2.x

### `Sonata\Exporter\Bridge\Symfony\Bundle\SonataExporterBundle`
UPGRADE FROM 2.3 to 2.4
=======================

Deprecated `Sonata\Exporter\Bridge\Symfony\Bundle\SonataExporterBundle`. Use `Sonata\Exporter\Bridge\Symfony\SonataExporterBundle`
instead.
## `Sonata\Exporter\Bridge\Symfony\Bundle\SonataExporterBundle`

Deprecated `Sonata\Exporter\Bridge\Symfony\Bundle\SonataExporterBundle`.
Use `Sonata\Exporter\Bridge\Symfony\SonataExporterBundle` instead.
6 changes: 4 additions & 2 deletions src/Source/AbstractXmlSourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ abstract class AbstractXmlSourceIterator implements SourceIteratorInterface
protected $currentColumnIndex = 0;

/**
* @var mixed
* @var array<mixed>|null
*/
protected $currentRow;

Expand Down Expand Up @@ -105,11 +105,13 @@ abstract public function tagEnd($parser, string $name);
abstract public function tagContent($parser, string $data);

/**
* @return mixed
* @return array<mixed>
*/
#[\ReturnTypeWillChange]
final public function current()
{
\assert(\is_array($this->currentRow));

return $this->currentRow;
}

Expand Down
13 changes: 10 additions & 3 deletions src/Source/ChainSourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
final class ChainSourceIterator implements SourceIteratorInterface
{
/**
* @var \ArrayIterator
* @var \ArrayIterator<array-key, SourceIteratorInterface>
*/
private $sources;

/**
* @param array<SourceIteratorInterface> $sources
*/
public function __construct(array $sources = [])
{
$this->sources = new \ArrayIterator();
Expand All @@ -35,7 +38,7 @@ public function addSource(SourceIteratorInterface $source): void
}

/**
* @return mixed
* @return array<mixed>
*/
#[\ReturnTypeWillChange]
public function current()
Expand All @@ -59,6 +62,10 @@ public function key()

public function valid(): bool
{
if (!$this->sources->valid()) {
return false;
}

while (!$this->sources->current()->valid()) {
$this->sources->next();

Expand All @@ -74,7 +81,7 @@ public function valid(): bool

public function rewind(): void
{
if ($this->sources->current()) {
if ($this->sources->valid()) {
$this->sources->current()->rewind();
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/Source/CsvSourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ public function __construct(
}

/**
* @return array|false
* @return array
*/
#[\ReturnTypeWillChange]
public function current()
{
\assert(\is_array($this->currentLine));

return $this->currentLine;
}

Expand Down
4 changes: 3 additions & 1 deletion src/Source/DoctrineDBALConnectionSourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ public function __construct(Connection $connection, string $query, array $parame
}

/**
* @return array<string, mixed>|false
* @return array<string, mixed>
*/
#[\ReturnTypeWillChange]
public function current()
{
\assert(\is_array($this->current));

return $this->current;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Source/DoctrineODMQuerySourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

use Doctrine\ODM\MongoDB\Query\Query;

final class DoctrineODMQuerySourceIterator extends AbstractPropertySourceIterator implements SourceIteratorInterface
final class DoctrineODMQuerySourceIterator extends AbstractPropertySourceIterator
{
/**
* @var Query
Expand Down
2 changes: 1 addition & 1 deletion src/Source/DoctrineORMQuerySourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* @final since sonata-project/exporter 2.4.
*/
class DoctrineORMQuerySourceIterator extends AbstractPropertySourceIterator implements SourceIteratorInterface
class DoctrineORMQuerySourceIterator extends AbstractPropertySourceIterator
{
/**
* @var Query
Expand Down
2 changes: 1 addition & 1 deletion src/Source/IteratorCallbackSourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(\Iterator $iterator, \Closure $transformer)
}

/**
* @return mixed
* @return array<mixed>
*/
public function current()
{
Expand Down
6 changes: 3 additions & 3 deletions src/Source/IteratorSourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
class IteratorSourceIterator implements SourceIteratorInterface
{
/**
* @var \Iterator
* @var \Iterator<mixed, array<mixed>>
*/
protected $iterator;

/**
* @param \Iterator $iterator Iterator with string array elements
* @param \Iterator<mixed, array<mixed>> $iterator Iterator with string array elements
*/
public function __construct(\Iterator $iterator)
{
Expand All @@ -37,7 +37,7 @@ final public function getIterator(): \Iterator
}

/**
* @return mixed
* @return array<mixed>
*/
#[\ReturnTypeWillChange]
public function current()
Expand Down
2 changes: 1 addition & 1 deletion src/Source/PDOStatementSourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(\PDOStatement $statement)
}

/**
* @return mixed
* @return array<mixed>
*/
#[\ReturnTypeWillChange]
public function current()
Expand Down
2 changes: 1 addition & 1 deletion src/Source/PropelCollectionSourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @author Kévin Gomez <contact@kevingomez.fr>
*/
final class PropelCollectionSourceIterator extends AbstractPropertySourceIterator implements SourceIteratorInterface
final class PropelCollectionSourceIterator extends AbstractPropertySourceIterator
{
/**
* @var \PropelCollection
Expand Down
2 changes: 1 addition & 1 deletion src/Source/SourceIteratorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* @deprecated since sonata-project/exporter 2.9 use \Iterator instead.
*
* @phpstan-extends \Iterator<mixed>
* @phpstan-extends \Iterator<array<mixed>>
*/
interface SourceIteratorInterface extends \Iterator
{
Expand Down
2 changes: 1 addition & 1 deletion src/Test/AbstractTypedWriterTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* NEXT_MAJOR: Remove this class.
*
* @deprecated since sonata-project/exporter 2.x, to be removed in version 3.0.
* @deprecated since sonata-project/exporter 2.10, to be removed in version 3.0.
*/
abstract class AbstractTypedWriterTestCase extends TestCase
{
Expand Down
11 changes: 11 additions & 0 deletions tests/Source/ChainSourceIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,15 @@ public function testIterator(): void
foreach ($iterator as $data) {
}
}

/**
* @doesNotPerformAssertions
*/
public function testEmptyIterator(): void
{
$iterator = new ChainSourceIterator([]);

foreach ($iterator as $data) {
}
}
}

0 comments on commit 75ff542

Please sign in to comment.