Skip to content

Commit 7fbaff9

Browse files
authored
Integrate rector and upgrade codebase to php 82 (#1339)
* Configure rector for src and tests * Upgraded codebase to php 8.2
1 parent 68e22ad commit 7fbaff9

File tree

253 files changed

+777
-649
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

253 files changed

+777
-649
lines changed

bin/docs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function execute(InputInterface $input, OutputInterface $output) : int
6363
$normalizedFunctions[] = $function->normalize();
6464
}
6565

66-
\file_put_contents(__DIR__ . '/../' . \ltrim($input->getArgument('output'), '/'), \json_encode($normalizedFunctions));
66+
\file_put_contents(__DIR__ . '/../' . \ltrim((string) $input->getArgument('output'), '/'), \json_encode($normalizedFunctions));
6767

6868
return Command::SUCCESS;
6969
}

rector.src.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
use Rector\Config\RectorConfig;
4+
use Rector\Set\ValueObject\LevelSetList;
5+
6+
return RectorConfig::configure()
7+
->withPaths([
8+
__DIR__ . '/bin',
9+
__DIR__ . '/examples',
10+
__DIR__ . '/src/core/etl/src',
11+
__DIR__ . '/src/cli/src',
12+
__DIR__ . '/src/adapter/*/src',
13+
__DIR__ . '/src/bridge/*/*/src',
14+
__DIR__ . '/src/tools/*/*/src',
15+
])
16+
->withSets([
17+
LevelSetList::UP_TO_PHP_82
18+
]);

rector.tests.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
use Rector\Config\RectorConfig;
4+
use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
5+
use Rector\Set\ValueObject\LevelSetList;
6+
7+
return RectorConfig::configure()
8+
->withPaths([
9+
__DIR__ . '/src/core/etl/tests',
10+
__DIR__ . '/src/cli/tests',
11+
__DIR__ . '/src/adapter/*/tests',
12+
__DIR__ . '/src/bridge/*/*/tests',
13+
__DIR__ . '/src/tools/*/*/tests',
14+
])
15+
->withSets([
16+
LevelSetList::UP_TO_PHP_82
17+
])
18+
->withSkip([
19+
RemoveParentCallWithoutParentRector::class
20+
]);

src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/AvroLoader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
use Flow\ETL\{Exception\RuntimeException, FlowContext, Loader, Rows};
1010
use Flow\Filesystem\Path;
1111

12-
final class AvroLoader implements Closure, Loader, Loader\FileLoader
12+
final readonly class AvroLoader implements Closure, Loader, Loader\FileLoader
1313
{
1414
public function __construct(
15-
private readonly Path $path,
16-
private readonly ?Schema $schema = null,
15+
private Path $path,
16+
private ?Schema $schema = null,
1717
) {
1818
throw new RuntimeException('Avro integration was abandoned due to lack of availability of good Avro libraries.');
1919
}

src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/CSVDetector.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,11 @@
1111

1212
final class CSVDetector
1313
{
14-
private ?Option $fallback;
15-
1614
private Options $options;
1715

18-
private SourceStream $stream;
19-
20-
public function __construct(SourceStream $stream, ?Option $fallback = new Option(',', '"', '\\'), ?Options $options = null)
16+
public function __construct(private readonly SourceStream $stream, private readonly ?Option $fallback = new Option(',', '"', '\\'), ?Options $options = null)
2117
{
22-
$this->stream = $stream;
2318
$this->options = $options ?? Options::all();
24-
$this->fallback = $fallback;
2519
}
2620

2721
/**

src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/Detector/Options.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,13 @@
66

77
use Flow\ETL\Adapter\CSV\Exception\CantDetectCSVOptions;
88

9-
final class Options
9+
final readonly class Options
1010
{
11-
/**
12-
* @var array<Option>
13-
*/
14-
private array $options;
15-
1611
/**
1712
* @param array<Option> $options
1813
*/
19-
public function __construct(array $options)
14+
public function __construct(private array $options)
2015
{
21-
$this->options = $options;
2216
}
2317

2418
public static function all() : self

src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/RowsNormalizer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
use Flow\ETL\Adapter\CSV\RowsNormalizer\EntryNormalizer;
88
use Flow\ETL\Rows;
99

10-
final class RowsNormalizer
10+
final readonly class RowsNormalizer
1111
{
12-
public function __construct(private readonly EntryNormalizer $entryNormalizer)
12+
public function __construct(private EntryNormalizer $entryNormalizer)
1313
{
1414
}
1515

src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/RowsNormalizer/EntryNormalizer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
use Flow\ETL\PHP\Type\Caster;
99
use Flow\ETL\Row\Entry;
1010

11-
final class EntryNormalizer
11+
final readonly class EntryNormalizer
1212
{
1313
public function __construct(
14-
private readonly Caster $caster,
15-
private readonly string $dateTimeFormat = \DateTimeInterface::ATOM,
14+
private Caster $caster,
15+
private string $dateTimeFormat = \DateTimeInterface::ATOM,
1616
) {
1717
}
1818

src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Benchmark/CSVExtractorBench.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
use PhpBench\Attributes\Groups;
1010

1111
#[Groups(['extractor'])]
12-
final class CSVExtractorBench
12+
final readonly class CSVExtractorBench
1313
{
14-
private readonly FlowContext $context;
14+
private FlowContext $context;
1515

1616
public function __construct()
1717
{

src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalDataFrameFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ final class DbalDataFrameFactory implements DataFrameFactory
1515
/**
1616
* @var array<QueryParameter>
1717
*/
18-
private array $parameters;
18+
private readonly array $parameters;
1919

2020
private ?Schema $schema = null;
2121

0 commit comments

Comments
 (0)