Skip to content

Commit

Permalink
Merge branch '1.x' into dependabot/composer/tools/cs-fixer/friendsofp…
Browse files Browse the repository at this point in the history
…hp/php-cs-fixer-3.18.0
  • Loading branch information
norberttech authored Aug 29, 2023
2 parents 1bd2ae4 + 8c704b1 commit 7b98102
Show file tree
Hide file tree
Showing 32 changed files with 883 additions and 656 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## [Unreleased] - 2023-06-20
## [Unreleased] - 2023-08-29

### Added
- [#450](https://github.com/flow-php/flow/pull/450) - **Add new `ulid()` expression based on Symfony Uid** - [@stloyd](https://github.com/stloyd)
- [#445](https://github.com/flow-php/flow/pull/445) - **Add `fig/log-test` package for mock logger** - [@stloyd](https://github.com/stloyd)
- [#440](https://github.com/flow-php/flow/pull/440) - **Add MariaDB to supported platforms for Doctrine adapter** - [@stloyd](https://github.com/stloyd)
- [#438](https://github.com/flow-php/flow/pull/438) - **triggers always execute on clone instead of using original instance** - [@norberttech](https://github.com/norberttech)
Expand Down Expand Up @@ -90,11 +91,13 @@
- [b33143](https://github.com/flow-php/flow/commit/b33143c05aea73c1eb96ef8cd41fdcf6f80d42c3) - **parameter types in Dbal DSL** - [@norberttech](https://github.com/norberttech)

### Updated
- [939cf0](https://github.com/flow-php/flow/commit/939cf0a618fefc31b45379eef9bb89fe24448ab3) - **dependencies** - [@norberttech](https://github.com/norberttech)
- [10550b](https://github.com/flow-php/flow/commit/10550b193e1283bc04e8b86d3352085acd8d71e8) - **dependencies** - [@norberttech](https://github.com/norberttech)
- [5ee4d6](https://github.com/flow-php/flow/commit/5ee4d609badd8546c3e8d180ea804e89230fb50d) - **monorepo-split.yml** - [@norberttech](https://github.com/norberttech)
- [8eb674](https://github.com/flow-php/flow/commit/8eb6744e7ca69ecd75d09a2263e586c0fbd0472f) - **README.md** - [@norberttech](https://github.com/norberttech)

### Removed
- [#446](https://github.com/flow-php/flow/pull/446) - **Drop non-stable version of `halaxa/json-machine`** - [@stloyd](https://github.com/stloyd)
- [#445](https://github.com/flow-php/flow/pull/445) - **Remove Monolog v2 from allowed dependencies** - [@stloyd](https://github.com/stloyd)
- [#424](https://github.com/flow-php/flow/pull/424) - **Remove support for not maintained Symfony & Doctrine dependencies** - [@stloyd](https://github.com/stloyd)
- [#424](https://github.com/flow-php/flow/pull/424) - **Remove BC code from Doctrine adapter** - [@stloyd](https://github.com/stloyd)
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"rector/rector": "^0.13.8 || ^0.14.0 || ^0.15.0",
"symfony/cache": "^6.2",
"symfony/dotenv": "^6.2",
"symfony/uid": "^6.3",
"symfony/validator": "^5.4 || ^6.2"
},
"autoload": {
Expand Down
868 changes: 475 additions & 393 deletions composer.lock

Large diffs are not rendered by default.

122 changes: 58 additions & 64 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,66 +1,60 @@
<?xml version="1.0"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="tools/phpunit/vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
cacheResultFile="./var/phpunit/phpunit.cache"
>
<coverage cacheDirectory="./var/phpunit/">
<include>
<directory suffix=".php">src/adapter/**/src</directory>
<directory suffix=".php">src/core/**/src</directory>
<directory suffix=".php">src/lib/**/src</directory>
</include>
<report>
<html outputDirectory="var/phpunit/coverage/html" lowUpperBound="95" highLowerBound="100"/>
</report>
</coverage>
<php>
<env name="PGSQL_DATABASE_URL" value="postgresql://postgres:[email protected]:5432/postgres?serverVersion=11%26charset=utf8" />
<env name="MYSQL_DATABASE_URL" value="mysql://mysql:[email protected]:3306/mysql" />
<env name="SQLITE_DATABASE_URL" value="sqlite:///:memory:" />
<env name="ELASTICSEARCH_URL" value="localhost:9200" />
<env name="MEILISEARCH_URL" value="http://localhost:7700" />
<env name="MEILISEARCH_API_KEY" value="masterKey" />
<env name="FLOW_LOCAL_FILESYSTEM_CACHE_DIR" value="./var/cache" />
</php>
<testsuites>
<testsuite name="unit">
<directory>src/core/etl/tests/Flow/ETL/Tests/Unit</directory>
<directory>src/lib/array-dot/tests/Flow/ArrayDot/Tests/Unit</directory>
<directory>src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-amphp/tests/Flow/ETL/Async/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/FlixTech/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-chartjs/tests/Flow/ETL/Adapter/ChartJS/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-http/tests/Flow/ETL/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-logger/tests/Flow/ETL/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-reactphp/tests/Flow/ETL/Async/Tests/Unit</directory>
</testsuite>

<testsuite name="integration-io">
<directory>src/core/etl/tests/Flow/ETL/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-amphp/tests/Flow/ETL/Async/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/FlixTech/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-chartjs/tests/Flow/ETL/Adapter/ChartJS/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-json/tests/Flow/ETL/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-reactphp/tests/Flow/ETL/Async/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-xml/tests/Flow/ETL/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-http/tests/Flow/ETL/Tests/Integration</directory>
</testsuite>

<testsuite name="integration-services">
<directory>src/core/etl/tests/Flow/ETL/Tests/Integration</directory>
<directory>src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration</directory>
</testsuite>
</testsuites>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" cacheResultFile="./var/phpunit/phpunit.cache">
<coverage cacheDirectory="./var/phpunit/">
<report>
<html outputDirectory="var/phpunit/coverage/html" lowUpperBound="95" highLowerBound="100"/>
</report>
</coverage>
<php>
<env name="PGSQL_DATABASE_URL" value="postgresql://postgres:[email protected]:5432/postgres?serverVersion=11%26charset=utf8"/>
<env name="MYSQL_DATABASE_URL" value="mysql://mysql:[email protected]:3306/mysql"/>
<env name="SQLITE_DATABASE_URL" value="sqlite:///:memory:"/>
<env name="ELASTICSEARCH_URL" value="localhost:9200"/>
<env name="MEILISEARCH_URL" value="http://localhost:7700"/>
<env name="MEILISEARCH_API_KEY" value="masterKey"/>
<env name="FLOW_LOCAL_FILESYSTEM_CACHE_DIR" value="./var/cache"/>
</php>
<testsuites>
<testsuite name="unit">
<directory>src/core/etl/tests/Flow/ETL/Tests/Unit</directory>
<directory>src/lib/array-dot/tests/Flow/ArrayDot/Tests/Unit</directory>
<directory>src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-amphp/tests/Flow/ETL/Async/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/FlixTech/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-chartjs/tests/Flow/ETL/Adapter/ChartJS/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-http/tests/Flow/ETL/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-logger/tests/Flow/ETL/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit</directory>
<directory>src/adapter/etl-adapter-reactphp/tests/Flow/ETL/Async/Tests/Unit</directory>
</testsuite>
<testsuite name="integration-io">
<directory>src/core/etl/tests/Flow/ETL/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-amphp/tests/Flow/ETL/Async/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/FlixTech/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-chartjs/tests/Flow/ETL/Adapter/ChartJS/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-json/tests/Flow/ETL/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-reactphp/tests/Flow/ETL/Async/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-xml/tests/Flow/ETL/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-http/tests/Flow/ETL/Tests/Integration</directory>
</testsuite>
<testsuite name="integration-services">
<directory>src/core/etl/tests/Flow/ETL/Tests/Integration</directory>
<directory>src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration</directory>
<directory>src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">src/adapter/**/src</directory>
<directory suffix=".php">src/core/**/src</directory>
<directory suffix=".php">src/lib/**/src</directory>
</include>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion src/adapter/etl-adapter-amphp/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"amphp/process": "^2",
"amphp/socket": "^2",
"flow-php/etl": "^0.2 || 1.x-dev",
"monolog/monolog": "^2.0 || ^3.0"
"monolog/monolog": "^3.0"
},
"config": {
"optimize-autoloader": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,8 @@ public function load(Rows $rows, FlowContext $context) : void
* @psalm-suppress MixedAssignment
*/
$rowData[$entry->name()] = match (\get_class($entry)) {
/** @phpstan-ignore-next-line */
Row\Entry\ListEntry::class => $this->listEntryToValues($entry),
/** @phpstan-ignore-next-line */
DateTimeEntry::class => (int) $entry->value()->format('Uu'),
/** @phpstan-ignore-next-line */
Row\Entry\EnumEntry::class => $entry->value()->name,
default => $entry->value(),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function write($arg)
$len = \fwrite($this->file_handle, $arg);

if (false === $len) {
throw new \AvroIOException(\sprintf('Could not write to file'));
throw new \AvroIOException('Could not write to file');
}

return $len;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function extract(FlowContext $context) : \Generator
/**
* @psalm-suppress UndefinedClass
* @psalm-suppress PossiblyInvalidArgument
* @psalm-suppress MixedArgumentTypeCoercion
*/
$pit = \is_array($this->pointInTimeParams)
/**
Expand All @@ -66,6 +67,7 @@ public function extract(FlowContext $context) : \Generator
/**
* @psalm-suppress UndefinedClass
* @psalm-suppress PossiblyInvalidArgument
* @psalm-suppress MixedArgumentTypeCoercion
*
* @phpstan-ignore-next-line
*/
Expand All @@ -89,6 +91,7 @@ public function extract(FlowContext $context) : \Generator
/**
* @psalm-suppress UndefinedClass
* @psalm-suppress PossiblyInvalidArgument
* @psalm-suppress MixedArgumentTypeCoercion
*
* @phpstan-ignore-next-line
*/
Expand Down Expand Up @@ -128,6 +131,7 @@ public function extract(FlowContext $context) : \Generator
/**
* @psalm-suppress UndefinedClass
* @psalm-suppress PossiblyInvalidArgument
* @psalm-suppress MixedArgumentTypeCoercion
*
* @phpstan-ignore-next-line
*/
Expand Down Expand Up @@ -172,6 +176,8 @@ private function closePointInTime(?PointInTime $pit) : void
if ($pit) {
/**
* @psalm-suppress UndefinedClass
* @psalm-suppress MixedArgumentTypeCoercion
* @psalm-suppress InvalidArgument
*
* @phpstan-ignore-next-line
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ function (Row\Entry $entry) : Row\Entry {

/**
* @psalm-suppress UndefinedClass
* @psalm-suppress InvalidArgument
*
* @phpstan-ignore-next-line
*/
Expand Down
2 changes: 1 addition & 1 deletion src/adapter/etl-adapter-json/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"php": "~8.1 || ~8.2",
"ext-json": "*",
"flow-php/etl": "^0.2 || 1.x-dev",
"halaxa/json-machine": "^0.8.0 || ^1.0.0"
"halaxa/json-machine": "^1.0"
},
"config": {
"optimize-autoloader": true,
Expand Down
2 changes: 1 addition & 1 deletion src/adapter/etl-adapter-reactphp/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"require": {
"php": "~8.1 || ~8.2",
"flow-php/etl": "^0.2 || 1.x-dev",
"monolog/monolog": "^2.0 || ^3.0",
"monolog/monolog": "^3.0",
"react/child-process": "^0.6.4",
"react/socket": "^1.11"
},
Expand Down
1 change: 1 addition & 0 deletions src/core/etl/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"league/flysystem-azure-blob-storage": "^3.0",
"moneyphp/money": "^4",
"ramsey/uuid": "^4.5",
"symfony/uid": "^6.3",
"symfony/validator": "^5.4 || ^6.2"
},
"config": {
Expand Down
11 changes: 8 additions & 3 deletions src/core/etl/src/Flow/ETL/DSL/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,17 @@ function size(Expression $expression) : Expression

function uuid_v4() : Expression
{
return Expression\Uuid::uuid4();
return Expression\Uuid::uuid4();
}

function uuid_v7(?Expression $expression=null) : Expression
function uuid_v7(?Expression $expression = null) : Expression
{
return Expression\Uuid::uuid7($expression);
return Expression\Uuid::uuid7($expression);
}

function ulid(?Expression $expression = null) : Expression
{
return new Expression\Ulid($expression);
}

function lower(Expression $expression) : Expression
Expand Down
18 changes: 9 additions & 9 deletions src/core/etl/src/Flow/ETL/DataFrame.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public function groupBy(string|Reference ...$entries) : self
/**
* @lazy
*
* @psalm-param "left"|"left_anti"|"right"|"inner"|Join $type
* @psalm-param string|Join $type
*/
public function join(self $dataFrame, Expression $on, string|Join $type = Join::left) : self
{
Expand All @@ -325,13 +325,12 @@ public function join(self $dataFrame, Expression $on, string|Join $type = Join::
}

/** @psalm-suppress ParadoxicalCondition */
$transformer = match (\strtolower($type)) {
$transformer = match ($type) {
Join::left->value => JoinRowsTransformer::left($dataFrame, $on),
Join::left_anti->value => JoinRowsTransformer::leftAnti($dataFrame, $on),
Join::right->value => JoinRowsTransformer::right($dataFrame, $on),
Join::inner->value => JoinRowsTransformer::inner($dataFrame, $on),
/** @phpstan-ignore-next-line */
default => throw new InvalidArgumentException("Unsupported join type: {$type}")
default => throw new InvalidArgumentException('Unsupported join type')
};

$this->pipeline->add($transformer);
Expand All @@ -342,22 +341,23 @@ public function join(self $dataFrame, Expression $on, string|Join $type = Join::
/**
* @lazy
*
* @psalm-param "left"|"left_anti"|"right"|"inner"|Join $type
* @psalm-param string|Join $type
*/
public function joinEach(DataFrameFactory $factory, Expression $on, string|Join $type = Join::left) : self
{
if ($type instanceof Join) {
$type = $type->name;
}

/** @psalm-suppress ParadoxicalCondition */
$transformer = match (\strtolower($type)) {
/**
* @psalm-suppress ParadoxicalCondition
*/
$transformer = match ($type) {
Join::left->value => JoinEachRowsTransformer::left($factory, $on),
Join::left_anti->value => JoinEachRowsTransformer::leftAnti($factory, $on),
Join::right->value => JoinEachRowsTransformer::right($factory, $on),
Join::inner->value => JoinEachRowsTransformer::inner($factory, $on),
/** @phpstan-ignore-next-line */
default => throw new InvalidArgumentException("Unsupported join type: {$type}")
default => throw new InvalidArgumentException('Unsupported join type')
};
$this->pipeline->add($transformer);

Expand Down
1 change: 0 additions & 1 deletion src/core/etl/src/Flow/ETL/Formatter/ASCII/ASCIIValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ private function stringValue() : string
'boolean' => ($val) ? 'true' : 'false',
'double', 'integer' => (string) $val,
'array' => \json_encode($val, JSON_THROW_ON_ERROR),
default => '',
};
} catch (\JsonException $e) {
$this->stringValue = '{...}';
Expand Down
1 change: 0 additions & 1 deletion src/core/etl/src/Flow/ETL/Pipeline/GroupByPipeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ final class GroupByPipeline implements Pipeline

public function __construct(private readonly GroupBy $groupBy, Pipeline $pipeline)
{
/** @phpstan-ignore-next-line */
$existingPipeline = $pipeline instanceof self ? $pipeline->pipeline : $pipeline;

$this->pipeline = $existingPipeline;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public function eval(Row $row) : mixed

try {
return \json_decode($value, true, 512, $this->flags);
/** @phpstan-ignore-next-line */
} catch (\JsonException $e) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public function eval(Row $row) : mixed

try {
return \json_encode($value, $this->flags);
/** @phpstan-ignore-next-line */
} catch (\JsonException $e) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public function __construct(

public function eval(Row $row) : ?bool
{
/** @var array<array-key, non-empty-string>|non-empty-string $pattern */
$pattern = $this->pattern->eval($row);
$subject = $this->subject->eval($row);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public function __construct(

public function eval(Row $row) : array
{
/** @var array<array-key, non-empty-string>|non-empty-string $pattern */
$pattern = $this->pattern->eval($row);
$subject = $this->subject->eval($row);
$flags = $this->flags ? $this->flags->eval($row) : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function __construct(

public function eval(Row $row) : ?string
{
/** @var mixed $pattern */
/** @var array<array-key, non-empty-string>|non-empty-string $pattern */
$pattern = $this->pattern->eval($row);
/** @var mixed $replacement */
$replacement = $this->replacement->eval($row);
Expand Down
Loading

0 comments on commit 7b98102

Please sign in to comment.