Skip to content

Commit

Permalink
Remove ArrayPushTransformer & CallbackEntryTransformer
Browse files Browse the repository at this point in the history
  • Loading branch information
stloyd committed Oct 6, 2023
1 parent 766856f commit ef9563a
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 325 deletions.
1 change: 0 additions & 1 deletion src/core/etl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ Adapters might also define some custom transformers.
* [array keys style converter](src/Flow/ETL/Transformer/ArrayKeysStyleConverterTransformer.php) - [tests](tests/Flow/ETL/Tests/Unit/Transformer/ArrayKeysStyleConverterTransformerTest.php)
* [array sort](src/Flow/ETL/Transformer/ArraySortTransformer.php) - [tests](tests/Flow/ETL/Tests/Unit/Transformer/ArraySortTransformerTest.php)
* **Callback** - *Might come with performance degradation*
* [callback entry](src/Flow/ETL/Transformer/CallbackEntryTransformer.php) - [tests](tests/Flow/ETL/Tests/Unit/Transformer/CallbackEntryTransformerTest.php)
* [callback row](src/Flow/ETL/Transformer/CallbackRowTransformer.php) - [tests](tests/Flow/ETL/Tests/Unit/Transformer/CallbackRowTransformerTest.php)

Some transformers come with complex configuration, please find more details [here](/docs/complex_transformers.md).
Expand Down
32 changes: 2 additions & 30 deletions src/core/etl/src/Flow/ETL/DSL/Transform.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Flow\ETL\Exception\RuntimeException;
use Flow\ETL\Row;
use Flow\ETL\Row\Entries;
use Flow\ETL\Row\Entry;
use Flow\ETL\Row\Factory\NativeEntryFactory;
use Flow\ETL\Row\Reference;
use Flow\ETL\Row\Schema;
Expand Down Expand Up @@ -46,8 +45,6 @@ final public static function add_json_object(string $name, array $data) : Transf
}

/**
* @param string $array_column
* @param string $style
* @param ?Schema $schema Desired schema of unpacked elements. Elements not found in schema will be auto detected.
* It is allowed to provide definitions only for selected elements, like for example
* when converting enum string value into specific Enum.
Expand All @@ -67,35 +64,16 @@ final public static function array_convert_keys(string $array_column, string $st
);
}

/**
* Pushes static values into existing array entry, if array entry does not exist, this transformer
* will create one.
*
* @param string $array_entry
* @param array<mixed> $values
*
* @return Transformer
*/
final public static function array_push(string $array_entry, array $values = []) : Transformer
final public static function array_reverse(string $array_name) : Transformer

Check failure on line 67 in src/core/etl/src/Flow/ETL/DSL/Transform.php

View workflow job for this annotation

GitHub Actions / Static Analyze (locked, 8.1, ubuntu-latest)

MixedInferredReturnType

src/core/etl/src/Flow/ETL/DSL/Transform.php:67:70: MixedInferredReturnType: Could not verify return type 'Flow\ETL\Transformer' for Flow\ETL\DSL\Transform::array_reverse (see https://psalm.dev/047)
{
return new Transformer\ArrayPushTransformer($array_entry, $values);
return new Transformer\ArrayReverseTransformer($array_name);

Check failure on line 69 in src/core/etl/src/Flow/ETL/DSL/Transform.php

View workflow job for this annotation

GitHub Actions / Static Analyze (locked, 8.1, ubuntu-latest)

MixedReturnStatement

src/core/etl/src/Flow/ETL/DSL/Transform.php:69:16: MixedReturnStatement: Could not infer a return type (see https://psalm.dev/138)

Check failure on line 69 in src/core/etl/src/Flow/ETL/DSL/Transform.php

View workflow job for this annotation

GitHub Actions / Static Analyze (locked, 8.1, ubuntu-latest)

UndefinedClass

src/core/etl/src/Flow/ETL/DSL/Transform.php:69:20: UndefinedClass: Class, interface or enum named Flow\ETL\Transformer\ArrayReverseTransformer does not exist (see https://psalm.dev/019)
}

final public static function array_sort(string $array_name, int $sort_flag = \SORT_REGULAR) : Transformer
{
return new Transformer\ArraySortTransformer($array_name, $sort_flag);
}

/**
* @psalm-param callable(Entry $entry) : Entry ...$callables
*
* @param callable(Entry $entry) : Entry ...$callables
*/
final public static function callback_entry(callable ...$callables) : Transformer
{
return new Transformer\CallbackEntryTransformer(...$callables);
}

/**
* @param callable(Row) : Row $callable
*/
Expand Down Expand Up @@ -151,12 +129,6 @@ public static function rename_all_case(bool $upper = false, bool $lower = false,
return new Transformer\RenameAllCaseTransformer($upper, $lower, $ucfirst, $ucwords);
}

/**
* @param string $search
* @param string $replace
*
* @return Transformer
*/
public static function rename_str_replace_all(string $search, string $replace) : Transformer
{
return new Transformer\RenameStrReplaceAllEntriesTransformer($search, $replace);
Expand Down
63 changes: 0 additions & 63 deletions src/core/etl/src/Flow/ETL/Transformer/ArrayPushTransformer.php

This file was deleted.

90 changes: 0 additions & 90 deletions src/core/etl/src/Flow/ETL/Transformer/CallbackEntryTransformer.php

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit ef9563a

Please sign in to comment.