Skip to content

Commit

Permalink
Merge branch '2.x' into 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed May 22, 2022
2 parents aab32e0 + 2e3f311 commit 7d42174
Show file tree
Hide file tree
Showing 45 changed files with 191 additions and 408 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,28 @@ jobs:

- name: Psalm
run: vendor/bin/psalm --no-progress --show-info=false --stats --output-format=github --threads=$(nproc) --shepherd --php-version=8.1

rector:
name: Rector

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
coverage: none
tools: composer:v2

- name: Install Composer dependencies (highest)
uses: ramsey/composer-install@v2
with:
dependency-versions: highest
composer-options: --prefer-dist --prefer-stable

- name: Rector
run: vendor/bin/rector --no-progress-bar --dry-run
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,7 @@ phpstan:
psalm:
vendor/bin/psalm --php-version=8.1
.PHONY: psalm

rector:
vendor/bin/rector
.PHONY: rector
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
],
"homepage": "https://docs.sonata-project.org/projects/exporter",
"require": {
"php": "^7.3 || ^8.0"
"php": "^7.4 || ^8.0"
},
"require-dev": {
"doctrine/annotations": "^1.13",
Expand All @@ -42,6 +42,7 @@
"propel/propel1": "^1.6",
"psalm/plugin-phpunit": "^0.16",
"psalm/plugin-symfony": "^3.0",
"rector/rector": "^0.12",
"symfony/config": "^4.4 || ^5.3 || ^6.0",
"symfony/dependency-injection": "^4.4 || ^5.3 || ^6.0",
"symfony/http-foundation": "^4.4 || ^5.3 || ^6.0",
Expand Down
41 changes: 41 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

/*
* DO NOT EDIT THIS FILE!
*
* It's auto-generated by sonata-project/dev-kit package.
*/

use Rector\Config\RectorConfig;
use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector;
use Rector\Php71\Rector\FuncCall\CountOnNullRector;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__.'/src',
__DIR__.'/tests',
]);

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_74,
]);

$rectorConfig->importNames();
$rectorConfig->disableImportShortClasses();
$rectorConfig->skip([
CountOnNullRector::class,
ExceptionHandlerTypehintRector::class,
]);
};
2 changes: 1 addition & 1 deletion src/Exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class Exporter
/**
* @var array<TypedWriterInterface>
*/
private $writers;
private array $writers;

/**
* @param array<TypedWriterInterface> $writers an array of allowed typed writers, indexed by format name
Expand Down
12 changes: 3 additions & 9 deletions src/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,9 @@

final class Handler
{
/**
* @var \Iterator
*/
private $source;

/**
* @var WriterInterface
*/
private $writer;
private \Iterator $source;

private WriterInterface $writer;

public function __construct(\Iterator $source, WriterInterface $writer)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Source/ChainSourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final class ChainSourceIterator implements SourceIteratorInterface
/**
* @var \ArrayIterator<array-key, \Iterator>
*/
private $sources;
private \ArrayIterator $sources;

/**
* @param array<\Iterator> $sources
Expand Down
32 changes: 7 additions & 25 deletions src/Source/CsvSourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
*/
final class CsvSourceIterator implements SourceIteratorInterface
{
/**
* @var string
*/
private $filename;
private string $filename;

/**
* @var resource|null
Expand All @@ -32,35 +29,20 @@ final class CsvSourceIterator implements SourceIteratorInterface
*/
private $file;

/**
* @var string
*/
private $delimiter;
private string $delimiter;

/**
* @var string
*/
private $enclosure;
private string $enclosure;

/**
* @var string
*/
private $escape;
private string $escape;

/**
* @var bool
*/
private $hasHeaders;
private bool $hasHeaders;

/**
* @var array<string|null>
*/
private $columns = [];
private array $columns = [];

/**
* @var int
*/
private $position = 0;
private int $position = 0;

/**
* @var array<string|null>|false
Expand Down
17 changes: 4 additions & 13 deletions src/Source/DoctrineDBALConnectionSourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,21 @@

final class DoctrineDBALConnectionSourceIterator implements SourceIteratorInterface
{
/**
* @var Connection
*/
private $connection;
private Connection $connection;

/**
* @var string
*/
private $query;
private string $query;

/**
* @var mixed[]
*/
private $parameters;
private array $parameters;

/**
* @var array<string, mixed>|false
*/
private $current;

/**
* @var int
*/
private $position = 0;
private int $position = 0;

/**
* @var Result
Expand Down
10 changes: 2 additions & 8 deletions src/Source/DoctrineODMQuerySourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,9 @@

final class DoctrineODMQuerySourceIterator extends AbstractPropertySourceIterator
{
/**
* @var Query
*/
private $query;
private Query $query;

/**
* @var int
*/
private $batchSize;
private int $batchSize;

/**
* @param array<string> $fields Fields to export
Expand Down
10 changes: 2 additions & 8 deletions src/Source/DoctrineORMQuerySourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,9 @@
*/
class DoctrineORMQuerySourceIterator extends AbstractPropertySourceIterator
{
/**
* @var Query
*/
protected $query;
protected Query $query;

/**
* @var int
*/
private $batchSize;
private int $batchSize;

/**
* @param array<string> $fields Fields to export
Expand Down
15 changes: 3 additions & 12 deletions src/Source/PDOStatementSourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,16 @@

final class PDOStatementSourceIterator implements SourceIteratorInterface
{
/**
* @var \PDOStatement
*/
private $statement;
private \PDOStatement $statement;

/**
* @var mixed
*/
private $current;

/**
* @var int
*/
private $position = 0;
private int $position = 0;

/**
* @var bool
*/
private $rewinded = false;
private bool $rewinded = false;

public function __construct(\PDOStatement $statement)
{
Expand Down
7 changes: 2 additions & 5 deletions src/Source/PropelCollectionSourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
*/
final class PropelCollectionSourceIterator extends AbstractPropertySourceIterator
{
/**
* @var \PropelCollection
*/
private $collection;
private \PropelCollection $collection;

/**
* @param array<string> $fields Fields to export
Expand All @@ -36,7 +33,7 @@ public function __construct(\PropelCollection $collection, array $fields, string
{
@trigger_error(sprintf(
'The %s class is deprecated since sonata-project/exporter 2.x, to be removed in version 3.0.',
__CLASS__,
self::class,
), \E_USER_DEPRECATED);

$this->collection = clone $collection;
Expand Down
17 changes: 4 additions & 13 deletions src/Source/SymfonySitemapSourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,16 @@

final class SymfonySitemapSourceIterator implements SourceIteratorInterface
{
/**
* @var RouterInterface
*/
private $router;
private RouterInterface $router;

/**
* @var \Iterator
*/
private $source;
private \Iterator $source;

/**
* @var string
*/
private $routeName;
private string $routeName;

/**
* @var array<string, mixed>
*/
private $parameters;
private array $parameters;

/**
* @param array<string, mixed> $parameters
Expand Down
10 changes: 2 additions & 8 deletions src/Source/XmlSourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,9 @@
*/
final class XmlSourceIterator extends AbstractXmlSourceIterator
{
/**
* @var string
*/
private $mainTag;
private string $mainTag;

/**
* @var string
*/
private $dataTag;
private string $dataTag;

public function __construct(string $filename, string $mainTag = 'datas', string $dataTag = 'data')
{
Expand Down
5 changes: 1 addition & 4 deletions src/Test/AbstractTypedWriterTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@
*/
abstract class AbstractTypedWriterTestCase extends TestCase
{
/**
* @var TypedWriterInterface
*/
private $writer;
private TypedWriterInterface $writer;

protected function setUp(): void
{
Expand Down

0 comments on commit 7d42174

Please sign in to comment.