diff --git a/composer.json b/composer.json index 60c16cb8a..d4154d0ca 100644 --- a/composer.json +++ b/composer.json @@ -423,7 +423,8 @@ "test:monorepo": "tools/monorepo/vendor/bin/monorepo-builder validate", "static:analyze": [ "./tools/monorepo/vendor/bin/monorepo-builder validate", - "@static:analyze:cs-fixer", + "./tools/mago/vendor/bin/mago lint", + "./tools/mago/vendor/bin/mago fmt --dry-run", "@static:analyze:phpstan", "@static:analyze:rector" ], @@ -434,13 +435,10 @@ "tools/rector/vendor/bin/rector -c ./rector.tests.php --dry-run", "tools/rector/vendor/bin/rector -c ./rector.src.php --dry-run" ], - "static:analyze:cs-fixer": [ - "tools/cs-fixer/vendor/bin/php-cs-fixer fix --dry-run" - ], "cs:php:fix": [ - "tools/cs-fixer/vendor/bin/php-cs-fixer fix", "./tools/rector/vendor/bin/rector -c ./rector.src.php", - "./tools/rector/vendor/bin/rector -c ./rector.tests.php" + "./tools/rector/vendor/bin/rector -c ./rector.tests.php", + "./tools/mago/vendor/bin/mago fmt" ], "build:phar": [ "bin/build-phar.sh", @@ -519,7 +517,8 @@ "composer install --working-dir=./tools/phpstan", "composer install --working-dir=./tools/phpunit", "composer install --working-dir=./tools/rector", - "composer install --working-dir=./tools/phpdocumentor" + "composer install --working-dir=./tools/phpdocumentor", + "composer install --working-dir=./tools/mago" ], "tools:update": [ "composer update --working-dir=./tools/blackfire", @@ -531,7 +530,8 @@ "composer update --working-dir=./tools/phpstan", "composer update --working-dir=./tools/phpunit", "composer update --working-dir=./tools/rector", - "composer update --working-dir=./tools/phpdocumentor" + "composer update --working-dir=./tools/phpdocumentor", + "composer update --working-dir=./tools/mago" ] } } diff --git a/mago-bugs.md b/mago-bugs.md new file mode 100644 index 000000000..4e110d2ad --- /dev/null +++ b/mago-bugs.md @@ -0,0 +1,162 @@ +# Mago Analyzer Bugs + +This document tracks potential bugs found in the Mago PHP static analyzer. + +## Bug 1: False positive for unused-template-parameter when used in @implements + +**File:** `src/lib/types/src/Flow/Types/Type/Logical/ClassStringType.php:16:22` + +**Error:** `warning[unused-template-parameter]: Template parameter `T` is never used in class `Flow\Types\Type\Logical\ClassStringType`.` + +**Code:** +```php +/** + * @template T of object + * + * @implements Type> + */ +final readonly class ClassStringType implements Type +{ + /** + * @param null|class-string $class + */ + public function __construct( + public null|string $class = null, + ) { +``` + +**Why it's a bug:** +The template parameter `T` is clearly used in two places: +1. `@implements Type>` - The class implements `Type` with a generic parameter that uses `T` +2. `@param null|class-string $class` - The constructor parameter uses `T` + +Mago incorrectly reports this template parameter as unused when it's being used in the `@implements` annotation to specify the type parameter for the implemented interface. + +--- + +## Bug 2: False positive never-return in conditional control flow + +**File:** `src/lib/types/src/Flow/Types/Type/Native/UnionType.php:78:20` + +**Error:** `error[never-return]: Cannot return value with type 'never' from this function.` + +**Code:** +```php +#[\Override] +public function assert(mixed $value): mixed +{ + if ($this->left->isValid($value)) { + return $value; + } + + if ($this->right->isValid($value)) { + return $value; // ERROR: Mago claims $value is 'never' here + } + + throw InvalidTypeException::value($value, $this); +} +``` + +**Why it's a bug:** +Mago incorrectly infers that `$value` has type `never` at line 78. This is incorrect control flow analysis. The function receives `mixed $value` as a parameter, and if the first condition is false, the control flows to the second condition. The value `$value` should still be of type `mixed` (or narrowed based on the `isValid` check), not `never`. + +The `never` type should only appear when no value is possible (e.g., after a function that always throws), but here `$value` is simply a parameter that hasn't been modified. + +--- + +## Bug 3: False positive never type in sequential conditional checks + +**File:** `src/lib/types/src/Flow/Types/Type/TypeDetector.php:50:38` + +**Error:** `error[no-value]: Argument #1 passed to method `Flow\Types\Type::isvalid` has type `never`, meaning it cannot produce a value.` + +**Code:** +```php +if (\is_string($value)) { + if (type_json()->isValid($value)) { + return type_json(); + } + + if (type_uuid()->isValid($value)) { // ERROR: $value is 'never' + return type_uuid(); + } + + return type_string(); +} +``` + +**Why it's a bug:** +Mago incorrectly infers `$value` as `never` at line 50. After the outer `if (\is_string($value))` check and the inner `type_json()->isValid($value)` check (which returns false), `$value` should still be typed as `string`, not `never`. The control flow analysis is incorrectly propagating "never" through sequential checks. + +--- + +## Bug 4: False positive impossible-type-comparison for array_is_list + +**File:** `src/lib/types/src/Flow/Types/Type/TypeDetector.php:77:17` + +**Error:** `error[impossible-type-comparison]: Impossible type assertion: `$value` of type `non-empty-array` can never be `list`.` + +**Code:** +```php +if (\is_array($value)) { + if ([] === $value) { + return type_array(); + } + + $detector = new ArrayContentDetector( + types(...\array_map($this->detectType(...), \array_keys($value)))->deduplicate(), + types(...\array_map($this->detectType(...), \array_values($value)))->deduplicate(), + \array_is_list($value), // ERROR: "impossible" comparison + ); +``` + +**Why it's a bug:** +Mago claims that a `non-empty-array` can never be a `list`, but this is incorrect. A list is a subset of arrays - any array with sequential integer keys starting from 0 is a list. For example, `[1, 2, 3]` is both a `non-empty-array` and a `list`. The `array_is_list()` function is specifically designed to check this condition. + +--- + +## Summary + +**Starting point:** 56 issues (30 errors, 25 warnings, 1 help) +**Final result:** 15 issues (3 errors, 12 warnings) + +### Errors (3 total - all false positives documented above) +- Bug 2: UnionType.php:78 - `never-return` +- Bug 3: TypeDetector.php:50 - `no-value` +- Bug 4: TypeDetector.php:79 - `impossible-type-comparison` + +### Warnings (12 total) + +The remaining warnings are mostly intentional `mixed` usage in type casting and detection code, which is the core purpose of this library: + +| File | Warnings | Reason | +|------|----------|--------| +| ListType.php | 2 | Iterating array values (inherent) | +| MapType.php | 3 | Iterating iterable values (inherent) | +| AutoCaster.php | 2 | Iterating array values (inherent) | +| TypeDetector.php | 1 | Detecting types from mixed values (inherent) | +| FloatType.php | 1 | String to float cast - intentional fallback | +| BooleanType.php | 1 | Mixed to bool cast - intentional fallback | +| ClassStringType.php | 1 | Bug 1 - false positive for template parameter | +| EnumType.php | 1 | `possibly-static-access-on-interface` - limitation, not bug | + +### Fixes Applied + +The following issues were fixed during this analysis: + +1. **XMLConverter.php** - Removed redundant docblock +2. **DateType.php, DateTimeType.php** - Cast bool to int in string concatenation +3. **StringType.php, NonEmptyStringType.php** - Fixed object-to-string type narrowing +4. **EnumType.php** - Added type annotations for BackedEnum +5. **StringTypeNarrower.php** - Fixed mixed-operand errors +6. **Comparator.php** - Added type annotations for generics +7. **HTMLType.php** - Fixed logic bug in cast() method +8. **TypeFactory.php** - Simplified error message +9. **TypeDetector.php** - Added null checks and type annotations +10. **StructureType.php** - Added type annotations for array elements +11. **Types.php** - Added null check for first() result +12. **Uuid.php** - Cast exception code to int +13. **UuidType.php** - Added type narrowing annotations +14. **MapType.php** - Added type annotations for key type and json_decode +15. **FloatType.php** - Added numeric-string annotations for format() calls +16. **ArrayType.php** - Added type annotations for json_decode and explicit null check diff --git a/mago.toml b/mago.toml new file mode 100644 index 000000000..60abc9b49 --- /dev/null +++ b/mago.toml @@ -0,0 +1,196 @@ +# Welcome to Mago! +# For full documentation, see https://mago.carthage.software/tools/overview +php-version = "8.3.27" + +[source] +paths = [ +# "src/adapter/etl-adapter-avro/src/Flow", +## "src/adapter/etl-adapter-avro/tests/Flow", +# "src/adapter/etl-adapter-chartjs/src/Flow", +## "src/adapter/etl-adapter-chartjs/tests/Flow", +# "src/adapter/etl-adapter-csv/src/Flow", +## "src/adapter/etl-adapter-csv/tests/Flow", +# "src/adapter/etl-adapter-doctrine/src/Flow", +## "src/adapter/etl-adapter-doctrine/tests/Flow", +# "src/adapter/etl-adapter-elasticsearch/src/Flow", +## "src/adapter/etl-adapter-elasticsearch/tests/Flow", +# "src/adapter/etl-adapter-excel/src/Flow", +## "src/adapter/etl-adapter-excel/tests/Flow", +# "src/adapter/etl-adapter-google-sheet/src/Flow", +## "src/adapter/etl-adapter-google-sheet/tests/Flow", +# "src/adapter/etl-adapter-http/src/Flow", +## "src/adapter/etl-adapter-http/tests/Flow", +# "src/adapter/etl-adapter-json/src/Flow", +## "src/adapter/etl-adapter-json/tests/Flow", +# "src/adapter/etl-adapter-logger/src/Flow", +## "src/adapter/etl-adapter-logger/tests/Flow", +# "src/adapter/etl-adapter-meilisearch/src/Flow", +## "src/adapter/etl-adapter-meilisearch/tests/Flow", +# "src/adapter/etl-adapter-parquet/src/Flow", +## "src/adapter/etl-adapter-parquet/tests/Flow", +# "src/adapter/etl-adapter-text/src/Flow", +## "src/adapter/etl-adapter-text/tests/Flow", +# "src/adapter/etl-adapter-xml/src/Flow", +## "src/adapter/etl-adapter-xml/tests/Flow", +# "src/bridge/filesystem/async-aws/src/Flow", +## "src/bridge/filesystem/async-aws/tests/Flow", +# "src/bridge/filesystem/azure/src/Flow", +## "src/bridge/filesystem/azure/tests/Flow", +# "src/bridge/monolog/http/src/Flow", +## "src/bridge/monolog/http/tests/Flow", +# "src/bridge/openapi/specification/src/Flow", +## "src/bridge/openapi/specification/tests/Flow", +# "src/bridge/symfony/http-foundation/src/Flow", +## "src/bridge/symfony/http-foundation/tests/Flow", +# "src/cli/src/Flow", +## "src/cli/tests/Flow", +# "src/core/etl/src/Flow", +## "src/core/etl/tests/Flow", +# "src/lib/array-dot/src/Flow", +## "src/lib/array-dot/tests/Flow", +# "src/lib/azure-sdk/src/Flow", +## "src/lib/azure-sdk/tests/Flow", +# "src/lib/doctrine-dbal-bulk/src/Flow", +## "src/lib/doctrine-dbal-bulk/tests/Flow", +# "src/lib/dremel/src/Flow", +## "src/lib/dremel/tests/Flow", +# "src/lib/filesystem/src/Flow", +## "src/lib/filesystem/tests/Flow", +# "src/lib/parquet-viewer/src/Flow", +## "src/lib/parquet-viewer/tests/Flow", +# "src/lib/parquet/src/Flow", +## "src/lib/parquet/tests/Flow", +# "src/lib/snappy/src/Flow", +## "src/lib/snappy/tests/Flow", + "src/lib/types/src/Flow", +# "src/lib/types/tests/Flow", +# "src/tools/documentation/src/Flow", +## "src/tools/documentation/tests/Flow" +] +includes = [ + "vendor", + "tools/phpunit/vendor", + "src/core/etl/src/Flow", + "src/tools/documentation/src", + "src/lib/types/src/Flow/Types/PHPStan", + "src/lib/parquet/src/Flow/Parquet/BinaryReader", + "src/lib/parquet/src/Flow/Parquet/BinaryReader", + "src/lib/parquet/src/Flow/Parquet/Data", + "src/lib/parquet/src/Flow/Parquet/ThriftModel", + "src/lib/parquet/src/Flow/Parquet/Thrift" +] +excludes = [] + +[formatter] +print-width = 140 +control-brace-style = "same_line" +closure-brace-style = "same_line" +function-brace-style = "same_line" +method-brace-style = "next_line" +classlike-brace-style = "next_line" +inline-empty-control-braces = true +inline-empty-closure-braces = true +inline-empty-function-braces = true +inline-empty-method-braces = true +inline-empty-classlike-braces = true +inline-empty-constructor-braces = true +inline-empty-anonymous-class-braces = true +expand-use-groups = false + +[linter] +integrations = ["symfony"] + +[linter.rules] +no-redundant-use = { enabled = true } +too-many-methods = { enabled = false } +excessive-parameter-list = { enabled = false } +kan-defect = { enabled = false } +cyclomatic-complexity = { enabled = false } +no-error-control-operator = { enabled = false } +too-many-enum-cases = { enabled = false } +too-many-properties = { enabled = false } +no-literal-password = { enabled = false } +literal-named-argument = { enabled = false } +halstead = { enabled = false } +no-boolean-flag-parameter = { enabled = false } +interface-name = { enabled = false } +class-name = { enabled = false } +trait-name = { enabled = false } +function-name = { enabled = false } +constant-name = { enabled = false } +no-else-clause = { enabled = false } +no-empty-catch-clause = { enabled = false } +explicit-octal = { enabled = false } +no-redundant-parentheses = { enabled = false } +no-boolean-literal-comparison = { enabled = false } +no-multi-assignments = { enabled = false } +no-goto = { enabled = false } +use-compound-assignment = { enabled = false } +no-ini-set = { enabled = false } +no-assign-in-condition = { enabled = false } +tagged-todo = { enabled = false } +no-redundant-file = { enabled = false } +excessive-nesting = { enabled = false } +prefer-first-class-callable = { enabled = false } +loop-does-not-iterate = { enabled = false } +no-empty-loop = { enabled = false } +no-debug-symbols = { enabled = true } +no-shorthand-ternary = { enabled = false } +parameter-type = { enabled = false } +return-type = { enabled = false } +no-redundant-method-override = { enabled = false } + +[analyzer] +find-unused-definitions = true +find-unused-expressions = false +analyze-dead-code = false +check-throws = false +allow-possibly-undefined-array-keys = true +perform-heuristic-checks = true +ignore = [ + #"mixed-operand", +# "mixed-argument", +# "mixed-method-access", +# "mixed-property-type-coercion", +# "less-specific-argument", +# "possibly-invalid-argument", +# "possibly-null-argument", +# "mixed-array-access", +# "non-existent-method", +# "invalid-argument", +# "possible-method-access-on-null", +# "less-specific-nested-argument-type", +# "possibly-false-argument", +# "invalid-return-statement", +# "invalid-property-assignment-value", +# "mixed-return-statement", +# "no-value", +# "invalid-method-access", +# "invalid-operand", +# "mixed-array-index", +# "invalid-iterator", +# "nullable-return-statement", +# "invalid-property-write", +# "less-specific-nested-return-statement", +# "less-specific-return-statement", +# "incompatible-parameter-type", +# "mismatched-array-index", +# "non-existent-function", +# "too-few-arguments", +# "unknown-iterator-type", +# "null-argument", +# "too-many-arguments", +# "invalid-type-cast", +# "missing-template-parameter", +# "never-return", +# "template-constraint-violation", +# "array-to-string-conversion", +# "falsable-return-statement", +# "interface-instantiation", +# "invalid-array-access", +# "invalid-yield-value-type", +# "match-not-exhaustive", +# "mixed-property-access", +# "non-existent-class-like", +# "unknown-match-subject-type", +] \ No newline at end of file diff --git a/rector.src.php b/rector.src.php index f6191c202..7ebaebd06 100644 --- a/rector.src.php +++ b/rector.src.php @@ -6,6 +6,7 @@ use Rector\CodingStyle\Rector\FuncCall\FunctionFirstClassCallableRector; use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector; use Rector\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector; +use Rector\Php74\Rector\Ternary\ParenthesizeNestedTernaryRector; return RectorConfig::configure() ->withPaths([ @@ -26,6 +27,7 @@ StringClassNameToClassConstantRector::class, __DIR__ . '/src/lib/parquet/src/Flow/Parquet/ThriftModel/*', ]) + ->withSkip([ParenthesizeNestedTernaryRector::class]) ->withCache(__DIR__ . '/var/rector/src') ->withImportNames(importShortClasses: false, removeUnusedImports: true) ->withSets([ diff --git a/rector.tests.php b/rector.tests.php index 470b16b88..6b8a2857d 100644 --- a/rector.tests.php +++ b/rector.tests.php @@ -224,8 +224,5 @@ ->withCache(__DIR__ . '/var/rector/tests') ->withSkipPath(__DIR__ . '/src/lib/parquet/src/Flow/Parquet/Thrift') ->withImportNames( - importNames: true, - importDocBlockNames: true, importShortClasses: false, - removeUnusedImports: true ); diff --git a/src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/AvroExtractor.php b/src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/AvroExtractor.php index 442ac0c2c..c183b10b8 100644 --- a/src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/AvroExtractor.php +++ b/src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/AvroExtractor.php @@ -19,11 +19,13 @@ public function __construct(private readonly Path $path) throw new RuntimeException('Avro integration was abandoned due to lack of availability of good Avro libraries.'); } + #[\Override] public function extract(FlowContext $context) : \Generator { yield; } + #[\Override] public function source() : Path { return $this->path; diff --git a/src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/AvroLoader.php b/src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/AvroLoader.php index 84f246ea1..8d53aad7d 100644 --- a/src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/AvroLoader.php +++ b/src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/AvroLoader.php @@ -23,15 +23,18 @@ public function __construct( $this->path = $path->setOptionWhenEmpty(Option::CONTENT_TYPE->value, ContentType::AVRO); } + #[\Override] public function closure(FlowContext $context) : void { } + #[\Override] public function destination() : Path { return $this->path; } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { } diff --git a/src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/Tests/Integration/AvroTest.php b/src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/Tests/Integration/AvroTest.php index 6540768b0..c780506ca 100644 --- a/src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/Tests/Integration/AvroTest.php +++ b/src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/Tests/Integration/AvroTest.php @@ -12,6 +12,7 @@ final class AvroTest extends FlowTestCase { + #[\Override] protected function setUp() : void { self::markTestSkipped('Avro integration was abandoned due to lack of availability of good Avro libraries.'); diff --git a/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/Chart/BarChart.php b/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/Chart/BarChart.php index 47292eabd..e0fb9199c 100644 --- a/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/Chart/BarChart.php +++ b/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/Chart/BarChart.php @@ -37,6 +37,7 @@ public function __construct( ) { } + #[\Override] public function collect(Rows $rows) : void { foreach ($rows as $row) { @@ -59,6 +60,7 @@ public function collect(Rows $rows) : void /** * @return array */ + #[\Override] public function data() : array { $data = [ @@ -87,6 +89,7 @@ function (array $dataset) : array { /** * @param array $options */ + #[\Override] public function setDatasetOptions(Reference $dataset, array $options) : self { $this->datasetOptions[$dataset->name()] = $options; @@ -97,6 +100,7 @@ public function setDatasetOptions(Reference $dataset, array $options) : self /** * @param array $options */ + #[\Override] public function setOptions(array $options) : self { $this->options = $options; diff --git a/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/Chart/LineChart.php b/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/Chart/LineChart.php index 240779ea9..fcff6a1bf 100644 --- a/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/Chart/LineChart.php +++ b/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/Chart/LineChart.php @@ -37,6 +37,7 @@ public function __construct( ) { } + #[\Override] public function collect(Rows $rows) : void { foreach ($rows as $row) { @@ -59,6 +60,7 @@ public function collect(Rows $rows) : void /** * @return array */ + #[\Override] public function data() : array { $data = [ @@ -87,6 +89,7 @@ function (array $dataset) : array { /** * @param array $options */ + #[\Override] public function setDatasetOptions(Reference $dataset, array $options) : self { $this->datasetOptions[$dataset->name()] = $options; @@ -97,6 +100,7 @@ public function setDatasetOptions(Reference $dataset, array $options) : self /** * @param array $options */ + #[\Override] public function setOptions(array $options) : self { $this->options = $options; diff --git a/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/Chart/PieChart.php b/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/Chart/PieChart.php index 9264eda0c..e06fffec4 100644 --- a/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/Chart/PieChart.php +++ b/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/Chart/PieChart.php @@ -35,6 +35,7 @@ public function __construct( ) { } + #[\Override] public function collect(Rows $rows) : void { foreach ($rows as $row) { @@ -56,6 +57,7 @@ public function collect(Rows $rows) : void /** * @return array */ + #[\Override] public function data() : array { $labels = []; @@ -88,6 +90,7 @@ public function data() : array /** * @param array $options */ + #[\Override] public function setDatasetOptions(Reference $dataset, array $options) : self { $this->datasetOptions[$dataset->name()] = $options; @@ -98,6 +101,7 @@ public function setDatasetOptions(Reference $dataset, array $options) : self /** * @param array $options */ + #[\Override] public function setOptions(array $options) : self { $this->options = $options; diff --git a/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/ChartJSLoader.php b/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/ChartJSLoader.php index 4763f33f9..d248c7ca4 100644 --- a/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/ChartJSLoader.php +++ b/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/ChartJSLoader.php @@ -24,6 +24,7 @@ public function __construct(private readonly Chart $type) $this->template = \Flow\Filesystem\DSL\path(__DIR__ . '/Resources/template/full_page.html'); } + #[\Override] public function closure(FlowContext $context) : void { if ($this->output === null && $this->outputVar === null) { @@ -58,6 +59,7 @@ public function closure(FlowContext $context) : void } } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { if (!$rows->count()) { diff --git a/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/CSVExtractor.php b/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/CSVExtractor.php index 91365bfa7..238461d0c 100644 --- a/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/CSVExtractor.php +++ b/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/CSVExtractor.php @@ -39,6 +39,7 @@ public function __construct(private readonly Path $path) $this->resetLimit(); } + #[\Override] public function extract(FlowContext $context) : \Generator { $shouldPutInputIntoRows = $context->config->shouldPutInputIntoRows(); @@ -97,6 +98,7 @@ public function extract(FlowContext $context) : \Generator } } + #[\Override] public function source() : Path { return $this->path; diff --git a/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/CSVLoader.php b/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/CSVLoader.php index 61b7820df..75f97ad98 100644 --- a/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/CSVLoader.php +++ b/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/CSVLoader.php @@ -31,16 +31,19 @@ public function __construct(Path $path) $this->path = $path->setOptionWhenEmpty(Option::CONTENT_TYPE, ContentType::CSV); } + #[\Override] public function closure(FlowContext $context) : void { $context->streams()->closeStreams($this->path); } + #[\Override] public function destination() : Path { return $this->path; } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { if (!$rows->count()) { diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/CSVTest.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/CSVTest.php index 7fa619ad7..57e19953d 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/CSVTest.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/CSVTest.php @@ -11,6 +11,7 @@ final class CSVTest extends FlowTestCase { + #[\Override] protected function setUp() : void { if (!\file_exists(__DIR__ . '/var')) { diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalDataFrameFactory.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalDataFrameFactory.php index 2d0f9c989..49b021afa 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalDataFrameFactory.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalDataFrameFactory.php @@ -43,6 +43,7 @@ public static function fromConnection(Connection $connection, string $query, Que return $factory; } + #[\Override] public function from(Rows $rows) : DataFrame { $parameters = []; diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalKeySetExtractor.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalKeySetExtractor.php index c0326e432..fd6cff636 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalKeySetExtractor.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalKeySetExtractor.php @@ -49,6 +49,7 @@ public function __construct( } } + #[\Override] public function extract(FlowContext $context) : \Generator { $totalFetched = 0; diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalLimitOffsetExtractor.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalLimitOffsetExtractor.php index 2e54a15fd..831323c7d 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalLimitOffsetExtractor.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalLimitOffsetExtractor.php @@ -53,6 +53,7 @@ public static function table( ); } + #[\Override] public function extract(FlowContext $context) : \Generator { if ($this->maximum === null && $this->queryBuilder->getMaxResults()) { diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalLoader.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalLoader.php index e437fc9bf..1b64f1376 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalLoader.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalLoader.php @@ -63,6 +63,7 @@ public static function fromConnection( return $loader; } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { $normalizedData = (new RowsNormalizer())->normalize($rows->sortEntries()); diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalQueryExtractor.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalQueryExtractor.php index 61578ed4b..d4de26064 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalQueryExtractor.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/DbalQueryExtractor.php @@ -47,6 +47,7 @@ public static function single(Connection $connection, string $query, array $para return $extractor; } + #[\Override] public function extract(FlowContext $context) : \Generator { foreach ($this->parametersSet->all() as $parameters) { diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/LiteralParameter.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/LiteralParameter.php index 683fc7501..eeadaf934 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/LiteralParameter.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/LiteralParameter.php @@ -16,11 +16,13 @@ public function __construct( ) { } + #[\Override] public function queryParamName() : string { return $this->queryParamName; } + #[\Override] public function toQueryParam(Rows $rows) : array|bool|float|int|string|null { if (\is_array($this->value)) { @@ -30,6 +32,7 @@ public function toQueryParam(Rows $rows) : array|bool|float|int|string|null return \is_scalar($this->value) || $this->value === null ? $this->value : null; } + #[\Override] public function type() : int|ArrayParameterType|null { return $this->type; diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/Parameter.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/Parameter.php index 65744c6f0..4dceabfa3 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/Parameter.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/Parameter.php @@ -32,6 +32,7 @@ public static function strings(string $queryParamName, EntryReference $ref) : se return new self($queryParamName, $ref, ArrayParameterType::STRING); } + #[\Override] public function queryParamName() : string { return $this->queryParamName; @@ -40,6 +41,7 @@ public function queryParamName() : string /** * @return array */ + #[\Override] public function toQueryParam(Rows $rows) : array { $values = $rows->reduceToArray($this->ref); @@ -47,6 +49,7 @@ public function toQueryParam(Rows $rows) : array return \array_filter($values, fn ($value) => \is_scalar($value) || $value === null); } + #[\Override] public function type() : int|ArrayParameterType { return $this->type; diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/TransactionalDbalLoader.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/TransactionalDbalLoader.php index f2ea02e9c..bb254573a 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/TransactionalDbalLoader.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/TransactionalDbalLoader.php @@ -48,6 +48,7 @@ public static function fromConnection( return $loader; } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { $this->executeInTransaction($this->connection(), $rows, $context); diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/InsertQueryCounter.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/InsertQueryCounter.php index f57eb88e0..79ef47deb 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/InsertQueryCounter.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/InsertQueryCounter.php @@ -17,6 +17,7 @@ public function __construct() $this->logger = new NullLogger(); } + #[\Override] public function log(mixed $level, string|\Stringable $message, array $context = []) : void { if (!isset($context['sql'])) { diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/SelectQueryCounter.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/SelectQueryCounter.php index 588ba125a..a8169cb6c 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/SelectQueryCounter.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/SelectQueryCounter.php @@ -22,6 +22,7 @@ public function __construct() $this->logger = new NullLogger(); } + #[\Override] public function log(mixed $level, string|\Stringable $message, array $context = []) : void { if (!isset($context['sql'])) { diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/IntegrationTestCase.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/IntegrationTestCase.php index 0af178186..272a20dc4 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/IntegrationTestCase.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/IntegrationTestCase.php @@ -19,6 +19,7 @@ abstract class IntegrationTestCase extends FlowTestCase protected DatabaseContext $sqliteDatabaseContext; + #[\Override] protected function setUp() : void { $insertQueryCounter = new InsertQueryCounter(); @@ -55,6 +56,7 @@ protected function setUp() : void ); } + #[\Override] protected function tearDown() : void { $this->pgsqlDatabaseContext->dropAllTables(); diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/RowsNormalizerTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/RowsNormalizerTest.php index 066af3fd4..d7a3f49cf 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/RowsNormalizerTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/RowsNormalizerTest.php @@ -13,6 +13,7 @@ final class RowsNormalizerTest extends TestCase { private RowsNormalizer $normalizer; + #[\Override] protected function setUp() : void { $this->normalizer = new RowsNormalizer(); diff --git a/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/ElasticsearchPHP/ElasticsearchExtractor.php b/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/ElasticsearchPHP/ElasticsearchExtractor.php index 0f22e062e..418834753 100644 --- a/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/ElasticsearchPHP/ElasticsearchExtractor.php +++ b/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/ElasticsearchPHP/ElasticsearchExtractor.php @@ -42,6 +42,7 @@ public function __construct( $this->client = null; } + #[\Override] public function extract(FlowContext $context) : \Generator { $pit = \is_array($this->pointInTimeParams) diff --git a/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/ElasticsearchPHP/ElasticsearchLoader.php b/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/ElasticsearchPHP/ElasticsearchLoader.php index 560e0a7d3..ed2ecb3b6 100644 --- a/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/ElasticsearchPHP/ElasticsearchLoader.php +++ b/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/ElasticsearchPHP/ElasticsearchLoader.php @@ -54,6 +54,7 @@ public static function update(array $clientConfig, string $index, IdFactory $idF return $loader; } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { if (!$rows->count()) { diff --git a/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/ElasticsearchPHP/HitsIntoRowsTransformer.php b/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/ElasticsearchPHP/HitsIntoRowsTransformer.php index 3a83c04c5..03990e4fd 100644 --- a/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/ElasticsearchPHP/HitsIntoRowsTransformer.php +++ b/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/ElasticsearchPHP/HitsIntoRowsTransformer.php @@ -13,6 +13,7 @@ public function __construct( ) { } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { $newRows = []; diff --git a/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/EntryIdFactory/EntryIdFactory.php b/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/EntryIdFactory/EntryIdFactory.php index 189e87abc..fb6b4787f 100644 --- a/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/EntryIdFactory/EntryIdFactory.php +++ b/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/EntryIdFactory/EntryIdFactory.php @@ -14,6 +14,7 @@ public function __construct(private string $entryName) { } + #[\Override] public function create(Row $row) : Entry { return $row->get($this->entryName)->rename('id'); diff --git a/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/EntryIdFactory/HashIdFactory.php b/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/EntryIdFactory/HashIdFactory.php index 0b7b9626b..2986ca5ac 100644 --- a/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/EntryIdFactory/HashIdFactory.php +++ b/src/adapter/etl-adapter-elasticsearch/src/Flow/ETL/Adapter/Elasticsearch/EntryIdFactory/HashIdFactory.php @@ -25,6 +25,7 @@ public function __construct(string ...$entryNames) $this->hashAlgorithm = new NativePHPHash(); } + #[\Override] public function create(Row $row) : Entry { return string_entry( diff --git a/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Context/Elasticsearch7Context.php b/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Context/Elasticsearch7Context.php index 2fa5e2361..ef63afe4b 100644 --- a/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Context/Elasticsearch7Context.php +++ b/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Context/Elasticsearch7Context.php @@ -28,6 +28,7 @@ public function client() : Client return $this->client; } + #[\Override] public function clientConfig() : array { return [ @@ -35,6 +36,7 @@ public function clientConfig() : array ]; } + #[\Override] public function createIndex(string $name) : void { try { @@ -53,6 +55,7 @@ public function createIndex(string $name) : void } } + #[\Override] public function deleteIndex(string $name) : void { try { @@ -75,6 +78,7 @@ public function loadRows(Rows $rows, string $index, IdFactory $idFactory) : void ->load($rows, flow_context(config())); } + #[\Override] public function version() : int { return 7; diff --git a/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Context/Elasticsearch8Context.php b/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Context/Elasticsearch8Context.php index bf8f9fb67..3021a692d 100644 --- a/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Context/Elasticsearch8Context.php +++ b/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Context/Elasticsearch8Context.php @@ -28,6 +28,7 @@ public function client() : Client return $this->client; } + #[\Override] public function clientConfig() : array { return [ @@ -35,6 +36,7 @@ public function clientConfig() : array ]; } + #[\Override] public function createIndex(string $name) : void { try { @@ -53,6 +55,7 @@ public function createIndex(string $name) : void } } + #[\Override] public function deleteIndex(string $name) : void { try { @@ -75,6 +78,7 @@ public function loadRows(Rows $rows, string $index, IdFactory $idFactory) : void ->load($rows, flow_context(config())); } + #[\Override] public function version() : int { return 8; diff --git a/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Doubles/Spy/HttpClientSpy.php b/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Doubles/Spy/HttpClientSpy.php index 0c11a021e..dbdc7559b 100644 --- a/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Doubles/Spy/HttpClientSpy.php +++ b/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Doubles/Spy/HttpClientSpy.php @@ -13,6 +13,7 @@ final class HttpClientSpy implements ClientInterface { public array $requests = []; + #[\Override] public function sendRequest(RequestInterface $request) : ResponseInterface { $this->requests[] = $request; diff --git a/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchIntegrationTest.php b/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchIntegrationTest.php index 16801d235..fd6827c26 100644 --- a/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchIntegrationTest.php +++ b/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchIntegrationTest.php @@ -16,6 +16,7 @@ final class ElasticsearchIntegrationTest extends ElasticsearchTestCase public const SOURCE_INDEX = 'etl-test-source-index'; + #[\Override] protected function setUp() : void { parent::setUp(); @@ -26,6 +27,7 @@ protected function setUp() : void $this->elasticsearchContext->createIndex(self::DESTINATION_INDEX); } + #[\Override] protected function tearDown() : void { $this->elasticsearchContext->deleteIndex(self::SOURCE_INDEX); diff --git a/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchPHP/ElasticsearchExtractorTest.php b/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchPHP/ElasticsearchExtractorTest.php index ecc0437fc..e9828ef30 100644 --- a/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchPHP/ElasticsearchExtractorTest.php +++ b/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchPHP/ElasticsearchExtractorTest.php @@ -16,6 +16,7 @@ final class ElasticsearchExtractorTest extends ElasticsearchTestCase { public const INDEX_NAME = 'etl-test-index'; + #[\Override] protected function setUp() : void { parent::setUp(); @@ -24,6 +25,7 @@ protected function setUp() : void $this->elasticsearchContext->createIndex(self::INDEX_NAME); } + #[\Override] protected function tearDown() : void { $this->elasticsearchContext->deleteIndex(self::INDEX_NAME); diff --git a/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchPHP/ElasticsearchLoaderTest.php b/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchPHP/ElasticsearchLoaderTest.php index 54c154a09..b38bdb84a 100644 --- a/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchPHP/ElasticsearchLoaderTest.php +++ b/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchPHP/ElasticsearchLoaderTest.php @@ -15,6 +15,7 @@ final class ElasticsearchLoaderTest extends ElasticsearchTestCase { public const INDEX_NAME = 'etl-test-index'; + #[\Override] protected function setUp() : void { parent::setUp(); @@ -22,6 +23,7 @@ protected function setUp() : void $this->elasticsearchContext->createIndex(self::INDEX_NAME); } + #[\Override] protected function tearDown() : void { $this->elasticsearchContext->deleteIndex(self::INDEX_NAME); diff --git a/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchTestCase.php b/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchTestCase.php index 9197ba286..a14235f7f 100644 --- a/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchTestCase.php +++ b/src/adapter/etl-adapter-elasticsearch/tests/Flow/ETL/Adapter/Elasticsearch/Tests/Integration/ElasticsearchTestCase.php @@ -11,6 +11,7 @@ abstract class ElasticsearchTestCase extends FlowTestCase { protected ElasticsearchContext $elasticsearchContext; + #[\Override] protected function setUp() : void { $this->elasticsearchContext = (\class_exists("Elasticsearch\Client")) diff --git a/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/ExcelExtractor.php b/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/ExcelExtractor.php index 0ffa88adf..91b554b2a 100644 --- a/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/ExcelExtractor.php +++ b/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/ExcelExtractor.php @@ -45,6 +45,7 @@ public function __construct(private readonly Path $path) $this->resetLimit(); } + #[\Override] public function extract(FlowContext $context) : \Generator { $headers = []; @@ -73,6 +74,7 @@ public function extract(FlowContext $context) : \Generator } } + #[\Override] public function source() : Path { return $this->path; diff --git a/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/Function/IsValidExcelSheetName.php b/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/Function/IsValidExcelSheetName.php index 2633eee1b..8bd47af04 100644 --- a/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/Function/IsValidExcelSheetName.php +++ b/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/Function/IsValidExcelSheetName.php @@ -14,6 +14,7 @@ public function __construct(private ScalarFunction|string $sheetName) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $sheetName = (new Parameter($this->sheetName))->asString($row, $context); diff --git a/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/GoogleSheetExtractor.php b/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/GoogleSheetExtractor.php index a27155da6..417c0aad6 100644 --- a/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/GoogleSheetExtractor.php +++ b/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/GoogleSheetExtractor.php @@ -35,6 +35,7 @@ public function __construct( $this->resetLimit(); } + #[\Override] public function extract(FlowContext $context) : \Generator { $cellsRange = new SheetRange($this->columnRange, 1, $this->rowsPerPage); diff --git a/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Integration/GoogleSheetExtractorTest.php b/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Integration/GoogleSheetExtractorTest.php index f97d7f73b..d16feadac 100644 --- a/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Integration/GoogleSheetExtractorTest.php +++ b/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Integration/GoogleSheetExtractorTest.php @@ -14,6 +14,7 @@ final class GoogleSheetExtractorTest extends FlowTestCase { private GoogleSheetsContext $context; + #[\Override] protected function setUp() : void { $this->context = new GoogleSheetsContext(); diff --git a/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/PsrHttpClientDynamicExtractor.php b/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/PsrHttpClientDynamicExtractor.php index 32b6fcaa7..72ab3bf20 100644 --- a/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/PsrHttpClientDynamicExtractor.php +++ b/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/PsrHttpClientDynamicExtractor.php @@ -29,6 +29,7 @@ public function __construct( ) { } + #[\Override] public function extract(FlowContext $context) : \Generator { $responseFactory = new ResponseEntriesFactory(); diff --git a/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/PsrHttpClientStaticExtractor.php b/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/PsrHttpClientStaticExtractor.php index 6191a326f..27ae09392 100644 --- a/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/PsrHttpClientStaticExtractor.php +++ b/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/PsrHttpClientStaticExtractor.php @@ -31,6 +31,7 @@ public function __construct( ) { } + #[\Override] public function extract(FlowContext $context) : \Generator { $responseFactory = new ResponseEntriesFactory(); diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/HTTP/Tests/Integration/PsrHttpClientDynamicExtractorTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/HTTP/Tests/Integration/PsrHttpClientDynamicExtractorTest.php index 142990f6d..185c72a0b 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/HTTP/Tests/Integration/PsrHttpClientDynamicExtractorTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/HTTP/Tests/Integration/PsrHttpClientDynamicExtractorTest.php @@ -33,6 +33,7 @@ public function test_http_extractor() : void ); $extractor = from_dynamic_http_requests($psr18Client, new class implements NextRequestFactory { + #[\Override] public function create(?ResponseInterface $previousResponse = null) : ?RequestInterface { $psr17Factory = new Psr17Factory(); diff --git a/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/JSONMachine/JsonExtractor.php b/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/JSONMachine/JsonExtractor.php index e22723c15..d2b8b097e 100644 --- a/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/JSONMachine/JsonExtractor.php +++ b/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/JSONMachine/JsonExtractor.php @@ -29,6 +29,7 @@ public function __construct( $this->resetLimit(); } + #[\Override] public function extract(FlowContext $context) : \Generator { $shouldPutInputIntoRows = $context->config->shouldPutInputIntoRows(); @@ -67,6 +68,7 @@ public function extract(FlowContext $context) : \Generator } } + #[\Override] public function source() : Path { return $this->path; diff --git a/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/JSONMachine/JsonLinesExtractor.php b/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/JSONMachine/JsonLinesExtractor.php index 816058654..364d282a9 100644 --- a/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/JSONMachine/JsonLinesExtractor.php +++ b/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/JSONMachine/JsonLinesExtractor.php @@ -29,6 +29,7 @@ public function __construct( $this->resetLimit(); } + #[\Override] public function extract(FlowContext $context) : \Generator { $shouldPutInputIntoRows = $context->config->shouldPutInputIntoRows(); @@ -81,6 +82,7 @@ public function extract(FlowContext $context) : \Generator } } + #[\Override] public function source() : Path { return $this->path; diff --git a/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/JsonLinesLoader.php b/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/JsonLinesLoader.php index 73f6cc943..2061ba4a8 100644 --- a/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/JsonLinesLoader.php +++ b/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/JsonLinesLoader.php @@ -22,16 +22,19 @@ public function __construct(Path $path) $this->path = $path->setOptionWhenEmpty(Option::CONTENT_TYPE->value, ContentType::JSON); } + #[\Override] public function closure(FlowContext $context) : void { $context->streams()->closeStreams($this->path); } + #[\Override] public function destination() : Path { return $this->path; } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { if ($rows->partitions()->count()) { diff --git a/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/JsonLoader.php b/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/JsonLoader.php index 65fb3d4a3..6929cbdc4 100644 --- a/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/JsonLoader.php +++ b/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/JsonLoader.php @@ -29,6 +29,7 @@ public function __construct(Path $path) $this->path = $path->setOptionWhenEmpty(Option::CONTENT_TYPE, ContentType::JSON); } + #[\Override] public function closure(FlowContext $context) : void { @@ -39,11 +40,13 @@ public function closure(FlowContext $context) : void $context->streams()->closeStreams($this->path); } + #[\Override] public function destination() : Path { return $this->path; } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { if ($rows->partitions()->count()) { diff --git a/src/adapter/etl-adapter-logger/src/Flow/ETL/Adapter/Logger/Logger/DumpLogger.php b/src/adapter/etl-adapter-logger/src/Flow/ETL/Adapter/Logger/Logger/DumpLogger.php index 5cae39658..6d8eaf0b1 100644 --- a/src/adapter/etl-adapter-logger/src/Flow/ETL/Adapter/Logger/Logger/DumpLogger.php +++ b/src/adapter/etl-adapter-logger/src/Flow/ETL/Adapter/Logger/Logger/DumpLogger.php @@ -14,6 +14,7 @@ final class DumpLogger extends AbstractLogger * @param mixed $message * @param array $context */ + #[\Override] public function log($level, $message, array $context = []) : void { if (!\is_string($message)) { diff --git a/src/adapter/etl-adapter-logger/src/Flow/ETL/Adapter/Logger/PsrLoggerLoader.php b/src/adapter/etl-adapter-logger/src/Flow/ETL/Adapter/Logger/PsrLoggerLoader.php index fe8aadf8a..21b0fc920 100644 --- a/src/adapter/etl-adapter-logger/src/Flow/ETL/Adapter/Logger/PsrLoggerLoader.php +++ b/src/adapter/etl-adapter-logger/src/Flow/ETL/Adapter/Logger/PsrLoggerLoader.php @@ -13,6 +13,7 @@ public function __construct(private LoggerInterface $logger, private string $mes { } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { $loader = function (Row $row) : void { diff --git a/src/adapter/etl-adapter-meilisearch/src/Flow/ETL/Adapter/Meilisearch/MeilisearchPHP/HitsIntoRowsTransformer.php b/src/adapter/etl-adapter-meilisearch/src/Flow/ETL/Adapter/Meilisearch/MeilisearchPHP/HitsIntoRowsTransformer.php index 7e50ea5fd..a3687dd82 100644 --- a/src/adapter/etl-adapter-meilisearch/src/Flow/ETL/Adapter/Meilisearch/MeilisearchPHP/HitsIntoRowsTransformer.php +++ b/src/adapter/etl-adapter-meilisearch/src/Flow/ETL/Adapter/Meilisearch/MeilisearchPHP/HitsIntoRowsTransformer.php @@ -12,6 +12,7 @@ public function __construct( ) { } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { $newRows = []; diff --git a/src/adapter/etl-adapter-meilisearch/src/Flow/ETL/Adapter/Meilisearch/MeilisearchPHP/MeilisearchExtractor.php b/src/adapter/etl-adapter-meilisearch/src/Flow/ETL/Adapter/Meilisearch/MeilisearchPHP/MeilisearchExtractor.php index 25779d436..44930e062 100644 --- a/src/adapter/etl-adapter-meilisearch/src/Flow/ETL/Adapter/Meilisearch/MeilisearchPHP/MeilisearchExtractor.php +++ b/src/adapter/etl-adapter-meilisearch/src/Flow/ETL/Adapter/Meilisearch/MeilisearchPHP/MeilisearchExtractor.php @@ -23,6 +23,7 @@ public function __construct( ) { } + #[\Override] public function extract(FlowContext $context) : \Generator { $params = new SearchParams($this->params); diff --git a/src/adapter/etl-adapter-meilisearch/src/Flow/ETL/Adapter/Meilisearch/MeilisearchPHP/MeilisearchLoader.php b/src/adapter/etl-adapter-meilisearch/src/Flow/ETL/Adapter/Meilisearch/MeilisearchPHP/MeilisearchLoader.php index 136a1344f..527a47f2b 100644 --- a/src/adapter/etl-adapter-meilisearch/src/Flow/ETL/Adapter/Meilisearch/MeilisearchPHP/MeilisearchLoader.php +++ b/src/adapter/etl-adapter-meilisearch/src/Flow/ETL/Adapter/Meilisearch/MeilisearchPHP/MeilisearchLoader.php @@ -30,6 +30,7 @@ public static function update(array $config, string $index) : self return new self($config, $index); } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { if (!$rows->count()) { diff --git a/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Double/Spy/HttpClientSpy.php b/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Double/Spy/HttpClientSpy.php index 9671b05cc..2713ad312 100644 --- a/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Double/Spy/HttpClientSpy.php +++ b/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Double/Spy/HttpClientSpy.php @@ -15,6 +15,7 @@ final class HttpClientSpy implements ClientInterface */ public array $requests = []; + #[\Override] public function sendRequest(RequestInterface $request) : ResponseInterface { $this->requests[] = $request; diff --git a/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MailiSearchTest.php b/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MailiSearchTest.php index 4f7817ad9..e1bf3b437 100644 --- a/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MailiSearchTest.php +++ b/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MailiSearchTest.php @@ -20,6 +20,7 @@ final class MailiSearchTest extends FlowTestCase private MeilisearchContext $meilisearchContext; + #[\Override] protected function setUp() : void { $url = \getenv('MEILISEARCH_URL'); @@ -40,6 +41,7 @@ protected function setUp() : void $this->meilisearchContext->createIndex(self::DESTINATION_INDEX); } + #[\Override] protected function tearDown() : void { $this->meilisearchContext->deleteIndex(self::SOURCE_INDEX); diff --git a/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MeilisearchExtractorTest.php b/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MeilisearchExtractorTest.php index 70820f5b4..18b339f02 100644 --- a/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MeilisearchExtractorTest.php +++ b/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MeilisearchExtractorTest.php @@ -18,6 +18,7 @@ final class MeilisearchExtractorTest extends FlowTestCase private MeilisearchContext $meilisearchContext; + #[\Override] protected function setUp() : void { $url = \getenv('MEILISEARCH_URL'); @@ -35,6 +36,7 @@ protected function setUp() : void $this->meilisearchContext->createIndex(self::INDEX_NAME); } + #[\Override] protected function tearDown() : void { $this->meilisearchContext->deleteIndex(self::INDEX_NAME); diff --git a/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MeilisearchLoaderTest.php b/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MeilisearchLoaderTest.php index 75123f18f..ff6a0a351 100644 --- a/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MeilisearchLoaderTest.php +++ b/src/adapter/etl-adapter-meilisearch/tests/Flow/ETL/Adapter/Meilisearch/Tests/Integration/MeilisearchPHP/MeilisearchLoaderTest.php @@ -17,6 +17,7 @@ final class MeilisearchLoaderTest extends FlowTestCase private MeilisearchContext $meilisearchContext; + #[\Override] protected function setUp() : void { $url = \getenv('MEILISEARCH_URL'); @@ -34,6 +35,7 @@ protected function setUp() : void $this->meilisearchContext->createIndex(self::INDEX_NAME); } + #[\Override] protected function tearDown() : void { $this->meilisearchContext->deleteIndex(self::INDEX_NAME); diff --git a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/ParquetExtractor.php b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/ParquetExtractor.php index d2a5bce1f..e83cec1ba 100644 --- a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/ParquetExtractor.php +++ b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/ParquetExtractor.php @@ -38,6 +38,7 @@ public function __construct(private readonly Path $path) $this->options = Options::default(); } + #[\Override] public function extract(FlowContext $context) : \Generator { $shouldPutInputIntoRows = $context->config->shouldPutInputIntoRows(); @@ -80,6 +81,7 @@ public function extract(FlowContext $context) : \Generator } } + #[\Override] public function source() : Path { return $this->path; diff --git a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/ParquetLoader.php b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/ParquetLoader.php index b0ea94f2c..8d5cba606 100644 --- a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/ParquetLoader.php +++ b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/ParquetLoader.php @@ -42,6 +42,7 @@ public function __construct(Path $path) $this->path = $path->setOptionWhenEmpty(Option::CONTENT_TYPE, ContentType::PARQUET); } + #[\Override] public function closure(FlowContext $context) : void { if (\count($this->writers)) { @@ -54,11 +55,13 @@ public function closure(FlowContext $context) : void $this->writers = []; } + #[\Override] public function destination() : Path { return $this->path; } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { if ($this->schema === null && $this->inferredSchema === null) { diff --git a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/SchemaConverter.php b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/SchemaConverter.php index 4aba57c58..f127c4dc9 100644 --- a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/SchemaConverter.php +++ b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/SchemaConverter.php @@ -16,7 +16,20 @@ struct_schema, time_schema, uuid_schema}; -use function Flow\Types\DSL\{type_boolean, type_date, type_datetime, type_float, type_integer, type_json, type_list, type_map, type_optional, type_string, type_structure, type_time, type_uuid}; +use function Flow\Types\DSL\{type_boolean, + type_date, + type_datetime, + type_float, + type_instance_of, + type_integer, + type_json, + type_list, + type_map, + type_optional, + type_string, + type_structure, + type_time, + type_uuid}; use Flow\ETL\Exception\RuntimeException; use Flow\ETL\Schema; use Flow\ETL\Schema\Definition; @@ -251,7 +264,9 @@ private function parquetToFlowType(Column $column) : Type return $nullable ? type_optional($type) : $type; } - /** @var NestedColumn $column */ + /** + * @var NestedColumn $column + */ $nullable = $column->repetition() === ParquetSchema\Repetition::OPTIONAL; if ($column->isList()) { diff --git a/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/TextExtractor.php b/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/TextExtractor.php index 0f3bafb02..7d5b71810 100644 --- a/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/TextExtractor.php +++ b/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/TextExtractor.php @@ -20,6 +20,7 @@ public function __construct( $this->resetLimit(); } + #[\Override] public function extract(FlowContext $context) : \Generator { $shouldPutInputIntoRows = $context->config->shouldPutInputIntoRows(); @@ -48,6 +49,7 @@ public function extract(FlowContext $context) : \Generator } } + #[\Override] public function source() : Path { return $this->path; diff --git a/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/TextLoader.php b/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/TextLoader.php index e2ee85e28..bf70ac5b4 100644 --- a/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/TextLoader.php +++ b/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/TextLoader.php @@ -22,16 +22,19 @@ public function __construct(Path $path) $this->path = $path->setOptionWhenEmpty(Option::CONTENT_TYPE->value, ContentType::TEXT); } + #[\Override] public function closure(FlowContext $context) : void { $context->streams()->closeStreams($this->path); } + #[\Override] public function destination() : Path { return $this->path; } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { if ($rows->partitions()->count()) { diff --git a/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/Loader/XMLLoader.php b/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/Loader/XMLLoader.php index 9098504d9..fc0ee8e96 100644 --- a/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/Loader/XMLLoader.php +++ b/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/Loader/XMLLoader.php @@ -48,6 +48,7 @@ public function __construct( $this->path = $path->setOptionWhenEmpty(Option::CONTENT_TYPE, ContentType::XML); } + #[\Override] public function closure(FlowContext $context) : void { foreach ($context->streams()->listOpenStreams($this->path) as $stream) { @@ -57,11 +58,13 @@ public function closure(FlowContext $context) : void $context->streams()->closeStreams($this->path); } + #[\Override] public function destination() : Path { return $this->path; } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { $normalizer = new RowsNormalizer( diff --git a/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/RowsNormalizer/EntryNormalizer/PHPValueNormalizer.php b/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/RowsNormalizer/EntryNormalizer/PHPValueNormalizer.php index d1a90ea3b..60c9e9373 100644 --- a/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/RowsNormalizer/EntryNormalizer/PHPValueNormalizer.php +++ b/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/RowsNormalizer/EntryNormalizer/PHPValueNormalizer.php @@ -32,7 +32,7 @@ public function __construct( public function normalize(string $name, Type $type, mixed $value) : XMLNode|XMLAttribute { if (\str_starts_with($name, $this->attributePrefix)) { - return new XMLAttribute(\substr($name, \strlen($this->attributePrefix)), (string) type_string()->cast($value)); + return new XMLAttribute(\substr($name, \strlen($this->attributePrefix)), type_string()->cast($value)); } if ($value === null) { diff --git a/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/XMLParserExtractor.php b/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/XMLParserExtractor.php index 61b1ab675..a329e05bb 100644 --- a/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/XMLParserExtractor.php +++ b/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/XMLParserExtractor.php @@ -81,6 +81,7 @@ public function endElementHandler(\XMLParser $parser, string $name) : void array_pop($this->currentPath); } + #[\Override] public function extract(FlowContext $context) : \Generator { $shouldPutInputIntoRows = $context->config->shouldPutInputIntoRows(); @@ -153,6 +154,7 @@ public function extract(FlowContext $context) : \Generator } } + #[\Override] public function source() : Path { return $this->path; diff --git a/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/XMLReaderExtractor.php b/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/XMLReaderExtractor.php index de329eab0..e2d24974a 100644 --- a/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/XMLReaderExtractor.php +++ b/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/XMLReaderExtractor.php @@ -41,6 +41,7 @@ public function __construct( $this->resetLimit(); } + #[\Override] public function extract(FlowContext $context) : \Generator { $shouldPutInputIntoRows = $context->config->shouldPutInputIntoRows(); @@ -103,6 +104,7 @@ public function extract(FlowContext $context) : \Generator } } + #[\Override] public function source() : Path { return $this->path; diff --git a/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/XMLWriter/DOMDocumentWriter.php b/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/XMLWriter/DOMDocumentWriter.php index 6c0983427..db9096a70 100644 --- a/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/XMLWriter/DOMDocumentWriter.php +++ b/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/XMLWriter/DOMDocumentWriter.php @@ -10,6 +10,7 @@ final class DOMDocumentWriter implements XMLWriter { + #[\Override] public function write(XMLNode $node) : string { $dom = new \DOMDocument(); diff --git a/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3DesintationStream/AsyncAWSS3BlockLifecycle.php b/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3DesintationStream/AsyncAWSS3BlockLifecycle.php index 0a591b7cb..e5f0c05b8 100644 --- a/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3DesintationStream/AsyncAWSS3BlockLifecycle.php +++ b/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3DesintationStream/AsyncAWSS3BlockLifecycle.php @@ -21,6 +21,7 @@ public function __construct( ) { } + #[\Override] public function filled(Block $block) : void { $handle = \fopen($block->path()->path(), 'rb'); diff --git a/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3DestinationStream.php b/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3DestinationStream.php index fd8b7f920..cfc5836e7 100644 --- a/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3DestinationStream.php +++ b/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3DestinationStream.php @@ -143,6 +143,7 @@ public static function openBlank( ); } + #[\Override] public function append(string $data) : DestinationStream { $this->blocks->append($data); @@ -150,6 +151,7 @@ public function append(string $data) : DestinationStream return $this; } + #[\Override] public function close() : void { if ($this->blocks->size() === 0) { @@ -236,6 +238,7 @@ public function close() : void $this->closed = true; } + #[\Override] public function fromResource($resource) : DestinationStream { if (!\is_resource($resource)) { @@ -253,11 +256,13 @@ public function fromResource($resource) : DestinationStream return $this; } + #[\Override] public function isOpen() : bool { return !$this->closed; } + #[\Override] public function path() : Path { return $this->path; diff --git a/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3Filesystem.php b/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3Filesystem.php index 47a9b24e6..8ef8705f6 100644 --- a/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3Filesystem.php +++ b/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3Filesystem.php @@ -26,6 +26,7 @@ public function __construct(private string $bucket, private S3Client $s3Client, } } + #[\Override] public function appendTo(Path $path) : DestinationStream { if ($path->isEqual($this->getSystemTmpDir())) { @@ -37,11 +38,13 @@ public function appendTo(Path $path) : DestinationStream return AsyncAWSS3DestinationStream::openAppend($this->s3Client, $this->bucket, $path, $this->options->blockFactory(), $this->options->partSize()); } + #[\Override] public function getSystemTmpDir() : Path { return $this->options->tmpDir(); } + #[\Override] public function list(Path $path, Filter $pathFilter = new KeepAll()) : \Generator { $this->protocol()->validateScheme($path); @@ -78,6 +81,7 @@ public function list(Path $path, Filter $pathFilter = new KeepAll()) : \Generato } while ($continuationToken); } + #[\Override] public function mv(Path $from, Path $to) : bool { $this->protocol()->validateScheme($from); @@ -97,16 +101,19 @@ public function mv(Path $from, Path $to) : bool return true; } + #[\Override] public function protocol() : Protocol { return new Protocol('aws-s3'); } + #[\Override] public function readFrom(Path $path) : SourceStream { return new AsyncAWSS3SourceStream($path, $this->bucket, $this->s3Client); } + #[\Override] public function rm(Path $path) : bool { if ($path->isEqual($this->getSystemTmpDir())) { @@ -164,6 +171,7 @@ public function rm(Path $path) : bool } + #[\Override] public function status(Path $path) : ?FileStatus { if ($path->isEqual($this->getSystemTmpDir())) { @@ -208,6 +216,7 @@ public function status(Path $path) : ?FileStatus return null; } + #[\Override] public function writeTo(Path $path) : DestinationStream { if ($path->isEqual($this->getSystemTmpDir())) { diff --git a/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3SourceStream.php b/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3SourceStream.php index b0acf3df6..bf48ac6fe 100644 --- a/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3SourceStream.php +++ b/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3SourceStream.php @@ -15,10 +15,12 @@ public function __construct(private readonly Path $path, private readonly string { } + #[\Override] public function close() : void { } + #[\Override] public function content() : string { return $this->s3Client->getObject([ @@ -27,11 +29,13 @@ public function content() : string ])->getBody()->getContentAsString(); } + #[\Override] public function isOpen() : bool { return true; } + #[\Override] public function iterate(int $length = 1) : \Generator { for ($offset = 0; $offset < $this->size(); $offset += $length) { @@ -39,11 +43,13 @@ public function iterate(int $length = 1) : \Generator } } + #[\Override] public function path() : Path { return $this->path; } + #[\Override] public function read(int $length, int $offset) : string { $response = $this->s3Client->getObject([ @@ -55,6 +61,7 @@ public function read(int $length, int $offset) : string return $response->getBody()->getContentAsString(); } + #[\Override] public function readLines(string $separator = "\n", ?int $length = null) : \Generator { $offset = 0; @@ -100,6 +107,7 @@ public function readLines(string $separator = "\n", ?int $length = null) : \Gene } } + #[\Override] public function size() : ?int { if ($this->size === null) { diff --git a/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Integration/AsyncAWSS3FilesystemTest.php b/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Integration/AsyncAWSS3FilesystemTest.php index 900ab70ff..cd2033282 100644 --- a/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Integration/AsyncAWSS3FilesystemTest.php +++ b/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Integration/AsyncAWSS3FilesystemTest.php @@ -129,7 +129,7 @@ public function test_file_status_on_pattern() : void self::assertTrue($fs->status(path('aws-s3://var/some_path_to/*.txt'))?->isFile()); self::assertSame( 'aws-s3://var/some_path_to/file.txt', - $fs->status(path('aws-s3://var/some_path_to/*.txt'))->path->uri() + $fs->status(path('aws-s3://var/some_path_to/*.txt'))?->path->uri() ); } diff --git a/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobDestinationStream.php b/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobDestinationStream.php index a6984ee01..6a7441a39 100644 --- a/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobDestinationStream.php +++ b/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobDestinationStream.php @@ -72,6 +72,7 @@ public static function openBlank( ); } + #[\Override] public function append(string $data) : self { $this->blocks->append($data); @@ -79,6 +80,7 @@ public function append(string $data) : self return $this; } + #[\Override] public function close() : void { if ($this->blocks->size() === 0) { @@ -113,6 +115,7 @@ public function close() : void $this->closed = true; } + #[\Override] public function fromResource($resource) : self { if (!\is_resource($resource)) { @@ -130,11 +133,13 @@ public function fromResource($resource) : self return $this; } + #[\Override] public function isOpen() : bool { return !$this->closed; } + #[\Override] public function path() : Path { return $this->path; diff --git a/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobDestinationStream/AzureBlobBlockLifecycle.php b/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobDestinationStream/AzureBlobBlockLifecycle.php index 7879f979f..4b4d0dc7b 100644 --- a/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobDestinationStream/AzureBlobBlockLifecycle.php +++ b/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobDestinationStream/AzureBlobBlockLifecycle.php @@ -24,6 +24,7 @@ public function __construct( } } + #[\Override] public function filled(Block $block) : void { if (!$this->initialized) { diff --git a/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobFilesystem.php b/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobFilesystem.php index 025776f51..fc2aa6329 100644 --- a/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobFilesystem.php +++ b/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobFilesystem.php @@ -21,6 +21,7 @@ public function __construct(private BlobServiceInterface $blobService, private O { } + #[\Override] public function appendTo(Path $path) : DestinationStream { if ($path->isEqual($this->getSystemTmpDir())) { @@ -37,11 +38,13 @@ public function appendTo(Path $path) : DestinationStream ); } + #[\Override] public function getSystemTmpDir() : Path { return $this->options->tmpDir(); } + #[\Override] public function list(Path $path, Filter $pathFilter = new KeepAll()) : \Generator { $this->protocol()->validateScheme($path); @@ -72,6 +75,7 @@ public function list(Path $path, Filter $pathFilter = new KeepAll()) : \Generato } } + #[\Override] public function mv(Path $from, Path $to) : bool { $this->protocol()->validateScheme($from); @@ -83,16 +87,19 @@ public function mv(Path $from, Path $to) : bool return true; } + #[\Override] public function protocol() : Protocol { return new Protocol('azure-blob'); } + #[\Override] public function readFrom(Path $path) : SourceStream { return new AzureBlobSourceStream($path, $this->blobService); } + #[\Override] public function rm(Path $path) : bool { if ($path->isEqual($this->getSystemTmpDir())) { @@ -140,6 +147,7 @@ public function rm(Path $path) : bool } } + #[\Override] public function status(Path $path) : ?FileStatus { if ($path->isEqual($this->getSystemTmpDir())) { @@ -180,6 +188,7 @@ public function status(Path $path) : ?FileStatus return null; } + #[\Override] public function writeTo(Path $path) : DestinationStream { if ($path->isEqual($this->getSystemTmpDir())) { diff --git a/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobSourceStream.php b/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobSourceStream.php index 74e687115..2d6dcb374 100644 --- a/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobSourceStream.php +++ b/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobSourceStream.php @@ -17,21 +17,25 @@ public function __construct(private readonly Path $path, private readonly BlobSe { } + #[\Override] public function close() : void { // do nothing as we can't close Azure Blob since we are just reading parts of it at once } + #[\Override] public function content() : string { return $this->blobService->getBlob($this->path->path())->content(); } + #[\Override] public function isOpen() : bool { return true; } + #[\Override] public function iterate(int $length = 1) : \Generator { $offset = 0; @@ -42,11 +46,13 @@ public function iterate(int $length = 1) : \Generator } } + #[\Override] public function path() : Path { return $this->path; } + #[\Override] public function read(int $length, int $offset) : string { $offset = $offset < 0 ? $this->size() + $offset : $offset; @@ -57,6 +63,7 @@ public function read(int $length, int $offset) : string )->content(); } + #[\Override] public function readLines(string $separator = "\n", ?int $length = null) : \Generator { $offset = 0; @@ -102,6 +109,7 @@ public function readLines(string $separator = "\n", ?int $length = null) : \Gene } } + #[\Override] public function size() : ?int { if ($this->blobProperties === null) { diff --git a/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobFilesystemTest.php b/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobFilesystemTest.php index 059bb391b..1d39aa477 100644 --- a/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobFilesystemTest.php +++ b/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobFilesystemTest.php @@ -165,7 +165,7 @@ public function test_file_status_on_pattern() : void $fs->writeTo(path('azure-blob://some_path_to/file.txt'))->fromResource($resource)->close(); self::assertTrue($fs->status(path('azure-blob://some_path_to/*.txt'))?->isFile()); - self::assertSame('azure-blob://some_path_to/file.txt', $fs->status(path('azure-blob://some_path_to/*.txt'))->path->uri()); + self::assertSame('azure-blob://some_path_to/file.txt', $fs->status(path('azure-blob://some_path_to/*.txt'))?->path->uri()); } public function test_file_status_on_root_folder() : void diff --git a/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobServiceTestCase.php b/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobServiceTestCase.php index 7c608631b..1110773d4 100644 --- a/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobServiceTestCase.php +++ b/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobServiceTestCase.php @@ -21,6 +21,7 @@ abstract class AzureBlobServiceTestCase extends FlowTestCase */ private array $containers = []; + #[\Override] protected function tearDown() : void { foreach ($this->containers as $container) { diff --git a/src/bridge/monolog/http/src/Flow/Bridge/Monolog/Http/PSR7Processor.php b/src/bridge/monolog/http/src/Flow/Bridge/Monolog/Http/PSR7Processor.php index fa7ab5a1d..ab7b8b6aa 100644 --- a/src/bridge/monolog/http/src/Flow/Bridge/Monolog/Http/PSR7Processor.php +++ b/src/bridge/monolog/http/src/Flow/Bridge/Monolog/Http/PSR7Processor.php @@ -21,6 +21,7 @@ public function __construct(private Config $config = new Config()) * * @return array|LogRecord */ + #[\Override] public function __invoke(LogRecord|array $record) : LogRecord|array { $context = \is_array($record) ? $record['context'] : $record->context; diff --git a/src/bridge/monolog/http/src/Flow/Bridge/Monolog/Http/Sanitization/Mask.php b/src/bridge/monolog/http/src/Flow/Bridge/Monolog/Http/Sanitization/Mask.php index 1cc75c064..7c9c8d868 100644 --- a/src/bridge/monolog/http/src/Flow/Bridge/Monolog/Http/Sanitization/Mask.php +++ b/src/bridge/monolog/http/src/Flow/Bridge/Monolog/Http/Sanitization/Mask.php @@ -39,6 +39,7 @@ public static function fromArray(array $data) : self /** * {@inheritdoc} */ + #[\Override] public function normalize() : array { return [ @@ -48,6 +49,7 @@ public function normalize() : array ]; } + #[\Override] public function sanitize(string $value) : string { if ($value === '') { diff --git a/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Output/CSVOutput.php b/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Output/CSVOutput.php index 3f4764882..4d81e500a 100644 --- a/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Output/CSVOutput.php +++ b/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Output/CSVOutput.php @@ -26,6 +26,7 @@ public function __construct( } + #[\Override] public function memoryLoader(string $id) : Loader { return to_csv(path_memory($id, ['stream' => 'temp'])) @@ -37,6 +38,7 @@ public function memoryLoader(string $id) : Loader ->withDateTimeFormat($this->datetimeFormat); } + #[\Override] public function stdoutLoader() : Loader { return to_csv(path_stdout(['stream' => 'output'])) @@ -48,6 +50,7 @@ public function stdoutLoader() : Loader ->withDateTimeFormat($this->datetimeFormat); } + #[\Override] public function type() : Type { return Type::CSV; diff --git a/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Output/JsonOutput.php b/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Output/JsonOutput.php index be1376c78..2b8555f66 100644 --- a/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Output/JsonOutput.php +++ b/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Output/JsonOutput.php @@ -23,6 +23,7 @@ public function __construct( } + #[\Override] public function memoryLoader(string $id) : Loader { return to_json(path_memory($id, ['stream' => 'temp'])) @@ -31,6 +32,7 @@ public function memoryLoader(string $id) : Loader ->withRowsInNewLines($this->putRowsInNewLines); } + #[\Override] public function stdoutLoader() : Loader { return to_json(path_stdout(['stream' => 'output'])) @@ -39,6 +41,7 @@ public function stdoutLoader() : Loader ->withRowsInNewLines($this->putRowsInNewLines); } + #[\Override] public function type() : Type { return Type::JSON; diff --git a/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Output/ParquetOutput.php b/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Output/ParquetOutput.php index c335e4bba..4c133594e 100644 --- a/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Output/ParquetOutput.php +++ b/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Output/ParquetOutput.php @@ -24,6 +24,7 @@ public function __construct( ) { } + #[\Override] public function memoryLoader(string $id) : Loader { $loader = to_parquet(path_memory($id, ['stream' => 'temp'])) @@ -40,6 +41,7 @@ public function memoryLoader(string $id) : Loader return $loader; } + #[\Override] public function stdoutLoader() : Loader { $loader = to_parquet(path_stdout(['stream' => 'output'])) @@ -56,6 +58,7 @@ public function stdoutLoader() : Loader return $loader; } + #[\Override] public function type() : Type { return Type::PARQUET; diff --git a/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Output/XMLOutput.php b/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Output/XMLOutput.php index 5cb03904d..d0fd74355 100644 --- a/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Output/XMLOutput.php +++ b/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Output/XMLOutput.php @@ -26,6 +26,7 @@ public function __construct( ) { } + #[\Override] public function memoryLoader(string $id) : Loader { return to_xml(path_memory($id, ['stream' => 'temp']), xml_writer: $this->xmlWriter) @@ -35,6 +36,7 @@ public function memoryLoader(string $id) : Loader ->withDateTimeFormat($this->dateTimeFormat); } + #[\Override] public function stdoutLoader() : Loader { return to_xml(path_stdout(['stream' => 'output']), xml_writer: $this->xmlWriter) @@ -44,6 +46,7 @@ public function stdoutLoader() : Loader ->withDateTimeFormat($this->dateTimeFormat); } + #[\Override] public function type() : Type { return Type::XML; diff --git a/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Response/FlowBufferedResponse.php b/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Response/FlowBufferedResponse.php index 941058a3e..4f541c955 100644 --- a/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Response/FlowBufferedResponse.php +++ b/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Response/FlowBufferedResponse.php @@ -33,6 +33,7 @@ public function __construct( parent::__construct(null, $status, $headers); } + #[\Override] public function getContent() : string { $this->evaluate(); @@ -40,6 +41,7 @@ public function getContent() : string return $this->content; } + #[\Override] public function sendContent() : static { $this->evaluate(); diff --git a/src/cli/src/Flow/CLI/Command/DatabaseTableListCommand.php b/src/cli/src/Flow/CLI/Command/DatabaseTableListCommand.php index cfe0689ea..9e54e7eab 100644 --- a/src/cli/src/Flow/CLI/Command/DatabaseTableListCommand.php +++ b/src/cli/src/Flow/CLI/Command/DatabaseTableListCommand.php @@ -25,6 +25,7 @@ final class DatabaseTableListCommand extends Command private ?Config $flowConfig = null; + #[\Override] public function configure() : void { $this @@ -37,6 +38,7 @@ public function configure() : void $this->addDbOptions($this); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output) : int { $style = new SymfonyStyle($input, $output); @@ -76,6 +78,7 @@ protected function execute(InputInterface $input, OutputInterface $output) : int return Command::SUCCESS; } + #[\Override] protected function initialize(InputInterface $input, OutputInterface $output) : void { $this->flowConfig = (new ConfigOption('config'))->get($input); diff --git a/src/cli/src/Flow/CLI/Command/DatabaseTableSchemaCommand.php b/src/cli/src/Flow/CLI/Command/DatabaseTableSchemaCommand.php index 7b65df22a..ca5235a00 100644 --- a/src/cli/src/Flow/CLI/Command/DatabaseTableSchemaCommand.php +++ b/src/cli/src/Flow/CLI/Command/DatabaseTableSchemaCommand.php @@ -29,6 +29,7 @@ final class DatabaseTableSchemaCommand extends Command private ?Config $flowConfig = null; + #[\Override] public function configure() : void { $this @@ -45,6 +46,7 @@ public function configure() : void $this->addDbOptions($this); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output) : int { $style = new SymfonyStyle($input, $output); @@ -115,6 +117,7 @@ protected function execute(InputInterface $input, OutputInterface $output) : int return Command::SUCCESS; } + #[\Override] protected function initialize(InputInterface $input, OutputInterface $output) : void { $this->flowConfig = (new ConfigOption('config'))->get($input); diff --git a/src/cli/src/Flow/CLI/Command/FileAnalyzeCommand.php b/src/cli/src/Flow/CLI/Command/FileAnalyzeCommand.php index a8af2391b..ddd628453 100644 --- a/src/cli/src/Flow/CLI/Command/FileAnalyzeCommand.php +++ b/src/cli/src/Flow/CLI/Command/FileAnalyzeCommand.php @@ -42,6 +42,7 @@ final class FileAnalyzeCommand extends Command private ?Path $sourcePath = null; + #[\Override] public function configure() : void { $this @@ -63,6 +64,7 @@ public function configure() : void $this->addStatisticsOptions($this); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output) : int { $style = new FlowStyle($input, $output); @@ -135,6 +137,7 @@ static function (Rows $rows) use ($progress) : void { return Command::SUCCESS; } + #[\Override] protected function initialize(InputInterface $input, OutputInterface $output) : void { $this->flowConfig = (new ConfigOption('config'))->get($input); diff --git a/src/cli/src/Flow/CLI/Command/FileConvertCommand.php b/src/cli/src/Flow/CLI/Command/FileConvertCommand.php index cad2999e3..5cc4863f3 100644 --- a/src/cli/src/Flow/CLI/Command/FileConvertCommand.php +++ b/src/cli/src/Flow/CLI/Command/FileConvertCommand.php @@ -38,6 +38,7 @@ final class FileConvertCommand extends Command private ?FileFormat $outputFileFormat = null; + #[\Override] public function configure() : void { $this @@ -65,6 +66,7 @@ public function configure() : void $this->addParquetInputOptions($this); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output) : int { $style = new SymfonyStyle($input, $output); @@ -116,6 +118,7 @@ protected function execute(InputInterface $input, OutputInterface $output) : int return Command::SUCCESS; } + #[\Override] protected function initialize(InputInterface $input, OutputInterface $output) : void { $this->flowConfig = (new ConfigOption('config'))->get($input); diff --git a/src/cli/src/Flow/CLI/Command/FileReadCommand.php b/src/cli/src/Flow/CLI/Command/FileReadCommand.php index dd829c2a7..c58184ab0 100644 --- a/src/cli/src/Flow/CLI/Command/FileReadCommand.php +++ b/src/cli/src/Flow/CLI/Command/FileReadCommand.php @@ -35,6 +35,7 @@ final class FileReadCommand extends Command private ?Path $sourcePath = null; + #[\Override] public function configure() : void { $this @@ -57,6 +58,7 @@ public function configure() : void $this->addParquetInputOptions($this); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output) : int { $style = new SymfonyStyle($input, $output); @@ -105,6 +107,7 @@ protected function execute(InputInterface $input, OutputInterface $output) : int return Command::SUCCESS; } + #[\Override] protected function initialize(InputInterface $input, OutputInterface $output) : void { $this->flowConfig = (new ConfigOption('config'))->get($input); diff --git a/src/cli/src/Flow/CLI/Command/FileRowsCountCommand.php b/src/cli/src/Flow/CLI/Command/FileRowsCountCommand.php index 2414af317..12d4fd0f8 100644 --- a/src/cli/src/Flow/CLI/Command/FileRowsCountCommand.php +++ b/src/cli/src/Flow/CLI/Command/FileRowsCountCommand.php @@ -32,6 +32,7 @@ final class FileRowsCountCommand extends Command private ?Path $sourcePath = null; + #[\Override] public function configure() : void { $this @@ -50,6 +51,7 @@ public function configure() : void $this->addParquetInputOptions($this); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output) : int { $style = new SymfonyStyle($input, $output); @@ -73,6 +75,7 @@ protected function execute(InputInterface $input, OutputInterface $output) : int return Command::SUCCESS; } + #[\Override] protected function initialize(InputInterface $input, OutputInterface $output) : void { $this->flowConfig = (new ConfigOption('config'))->get($input); diff --git a/src/cli/src/Flow/CLI/Command/FileSchemaCommand.php b/src/cli/src/Flow/CLI/Command/FileSchemaCommand.php index a93492bf6..e6f94f24c 100644 --- a/src/cli/src/Flow/CLI/Command/FileSchemaCommand.php +++ b/src/cli/src/Flow/CLI/Command/FileSchemaCommand.php @@ -34,6 +34,7 @@ final class FileSchemaCommand extends Command private ?Path $sourcePath = null; + #[\Override] public function configure() : void { $this @@ -57,6 +58,7 @@ public function configure() : void $this->addParquetInputOptions($this); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output) : int { $style = new SymfonyStyle($input, $output); @@ -104,6 +106,7 @@ protected function execute(InputInterface $input, OutputInterface $output) : int return Command::SUCCESS; } + #[\Override] protected function initialize(InputInterface $input, OutputInterface $output) : void { $this->flowConfig = (new ConfigOption('config'))->get($input); diff --git a/src/cli/src/Flow/CLI/Command/PipelineRunCommand.php b/src/cli/src/Flow/CLI/Command/PipelineRunCommand.php index 4204418e4..082acba9a 100644 --- a/src/cli/src/Flow/CLI/Command/PipelineRunCommand.php +++ b/src/cli/src/Flow/CLI/Command/PipelineRunCommand.php @@ -28,6 +28,7 @@ final class PipelineRunCommand extends Command private ?Path $pipelinePath = null; + #[\Override] public function configure() : void { $this @@ -57,6 +58,7 @@ public function configure() : void $this->addStatisticsOptions($this); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output) : int { $style = new SymfonyStyle($input, $output); @@ -93,6 +95,7 @@ public function execute(InputInterface $input, OutputInterface $output) : int return Command::SUCCESS; } + #[\Override] protected function initialize(InputInterface $input, OutputInterface $output) : void { $this->flowConfig = (new ConfigOption('config'))->get($input); diff --git a/src/cli/src/Flow/CLI/Command/SchemaFormatCommand.php b/src/cli/src/Flow/CLI/Command/SchemaFormatCommand.php index a7fee41a2..36849d364 100644 --- a/src/cli/src/Flow/CLI/Command/SchemaFormatCommand.php +++ b/src/cli/src/Flow/CLI/Command/SchemaFormatCommand.php @@ -24,6 +24,7 @@ final class SchemaFormatCommand extends Command private ?Path $schemaPath = null; + #[\Override] public function configure() : void { $this @@ -37,6 +38,7 @@ public function configure() : void $this->addConfigOptions($this); } + #[\Override] public function execute(InputInterface $input, OutputInterface $output) : int { $style = new SymfonyStyle($input, $output); @@ -66,6 +68,7 @@ public function execute(InputInterface $input, OutputInterface $output) : int return Command::SUCCESS; } + #[\Override] protected function initialize(InputInterface $input, OutputInterface $output) : void { $this->flowConfig = (new ConfigOption('config'))->get($input); diff --git a/src/cli/src/Flow/CLI/Formatter/ValueFormatter.php b/src/cli/src/Flow/CLI/Formatter/ValueFormatter.php index 6a648f017..85896cbd4 100644 --- a/src/cli/src/Flow/CLI/Formatter/ValueFormatter.php +++ b/src/cli/src/Flow/CLI/Formatter/ValueFormatter.php @@ -32,6 +32,6 @@ public function format(string|float|int|bool|\DateTimeInterface|null $value) : s return \number_format((float) $value, 2); } - return (string) $value; + return $value; } } diff --git a/src/cli/tests/Flow/CLI/Tests/Integration/DatabaseTableListCommandTest.php b/src/cli/tests/Flow/CLI/Tests/Integration/DatabaseTableListCommandTest.php index 5203a8854..45b57a036 100644 --- a/src/cli/tests/Flow/CLI/Tests/Integration/DatabaseTableListCommandTest.php +++ b/src/cli/tests/Flow/CLI/Tests/Integration/DatabaseTableListCommandTest.php @@ -18,6 +18,7 @@ final class DatabaseTableListCommandTest extends FlowTestCase use OperatingSystem; + #[\Override] protected function setUp() : void { parent::setUp(); diff --git a/src/cli/tests/Flow/CLI/Tests/Integration/DatabaseTableSchemaCommandTest.php b/src/cli/tests/Flow/CLI/Tests/Integration/DatabaseTableSchemaCommandTest.php index 47587c5e9..231103245 100644 --- a/src/cli/tests/Flow/CLI/Tests/Integration/DatabaseTableSchemaCommandTest.php +++ b/src/cli/tests/Flow/CLI/Tests/Integration/DatabaseTableSchemaCommandTest.php @@ -18,6 +18,7 @@ final class DatabaseTableSchemaCommandTest extends FlowTestCase use OperatingSystem; + #[\Override] protected function setUp() : void { parent::setUp(); diff --git a/src/core/etl/src/Flow/Clock/FakeClock.php b/src/core/etl/src/Flow/Clock/FakeClock.php index af8e3f834..d9cd9a233 100644 --- a/src/core/etl/src/Flow/Clock/FakeClock.php +++ b/src/core/etl/src/Flow/Clock/FakeClock.php @@ -17,6 +17,7 @@ public function modify(string $modify) : void $this->dateTime = $this->dateTime->modify($modify); } + #[\Override] public function now() : \DateTimeImmutable { return $this->dateTime; diff --git a/src/core/etl/src/Flow/Clock/SystemClock.php b/src/core/etl/src/Flow/Clock/SystemClock.php index c54d6ac4f..e3d27af25 100644 --- a/src/core/etl/src/Flow/Clock/SystemClock.php +++ b/src/core/etl/src/Flow/Clock/SystemClock.php @@ -22,6 +22,7 @@ public static function utc() : self return new self(new \DateTimeZone('UTC')); } + #[\Override] public function now() : \DateTimeImmutable { return new \DateTimeImmutable('now', $this->timezone); diff --git a/src/core/etl/src/Flow/ETL/Cache/Implementation/FilesystemCache.php b/src/core/etl/src/Flow/ETL/Cache/Implementation/FilesystemCache.php index aefab368f..a8fb20cfe 100644 --- a/src/core/etl/src/Flow/ETL/Cache/Implementation/FilesystemCache.php +++ b/src/core/etl/src/Flow/ETL/Cache/Implementation/FilesystemCache.php @@ -23,16 +23,19 @@ public function __construct( $this->cacheDir = $cacheDir ?? $this->filesystem->getSystemTmpDir(); } + #[\Override] public function clear() : void { $this->filesystem->rm($this->cacheDir); } + #[\Override] public function delete(string $key) : void { $this->filesystem->rm($this->cachePath($key)); } + #[\Override] public function get(string $key) : Row|Rows|CacheIndex { $path = $this->cachePath($key); @@ -49,11 +52,13 @@ public function get(string $key) : Row|Rows|CacheIndex return $this->serializer->unserialize($serializedValue, [Row::class, Rows::class, CacheIndex::class]); } + #[\Override] public function has(string $key) : bool { return $this->filesystem->status($this->cachePath($key)) !== null; } + #[\Override] public function set(string $key, CacheIndex|Rows|Row $value) : void { $cacheStream = $this->filesystem->writeTo($this->cachePath($key)); diff --git a/src/core/etl/src/Flow/ETL/Cache/Implementation/InMemoryCache.php b/src/core/etl/src/Flow/ETL/Cache/Implementation/InMemoryCache.php index aef41e222..6c0996702 100644 --- a/src/core/etl/src/Flow/ETL/Cache/Implementation/InMemoryCache.php +++ b/src/core/etl/src/Flow/ETL/Cache/Implementation/InMemoryCache.php @@ -19,11 +19,13 @@ public function __construct() { } + #[\Override] public function clear() : void { $this->cache = []; } + #[\Override] public function delete(string $key) : void { if (!$this->has($key)) { @@ -36,6 +38,7 @@ public function delete(string $key) : void /** * @throws KeyNotInCacheException */ + #[\Override] public function get(string $key) : Row|Rows|CacheIndex { if (!\array_key_exists($key, $this->cache)) { @@ -45,11 +48,13 @@ public function get(string $key) : Row|Rows|CacheIndex return $this->cache[$key]; } + #[\Override] public function has(string $key) : bool { return \array_key_exists($key, $this->cache); } + #[\Override] public function set(string $key, CacheIndex|Rows|Row $value) : void { $this->cache[$key] = $value; diff --git a/src/core/etl/src/Flow/ETL/Cache/Implementation/PSRSimpleCache.php b/src/core/etl/src/Flow/ETL/Cache/Implementation/PSRSimpleCache.php index f1639627b..8a74a3322 100644 --- a/src/core/etl/src/Flow/ETL/Cache/Implementation/PSRSimpleCache.php +++ b/src/core/etl/src/Flow/ETL/Cache/Implementation/PSRSimpleCache.php @@ -19,16 +19,19 @@ public function __construct( ) { } + #[\Override] public function clear() : void { $this->cache->clear(); } + #[\Override] public function delete(string $key) : void { $this->cache->delete($key); } + #[\Override] public function get(string $key) : Row|Rows|CacheIndex { $serializedValue = $this->cache->get($key); @@ -40,6 +43,7 @@ public function get(string $key) : Row|Rows|CacheIndex return $this->serializer->unserialize(\is_string($serializedValue) ? $serializedValue : '', [Row::class, Rows::class, CacheIndex::class]); } + #[\Override] public function has(string $key) : bool { try { @@ -49,6 +53,7 @@ public function has(string $key) : bool } } + #[\Override] public function set(string $key, CacheIndex|Rows|Row $value) : void { $this->cache->set($key, $this->serializer->serialize($value), $this->ttl); diff --git a/src/core/etl/src/Flow/ETL/Constraint/SortedByConstraint.php b/src/core/etl/src/Flow/ETL/Constraint/SortedByConstraint.php index 93429c700..f0563f3d8 100644 --- a/src/core/etl/src/Flow/ETL/Constraint/SortedByConstraint.php +++ b/src/core/etl/src/Flow/ETL/Constraint/SortedByConstraint.php @@ -24,6 +24,7 @@ public function __construct(Reference $column, Reference ...$columns) $this->references = new References($column, ...$columns); } + #[\Override] public function isSatisfiedBy(Row $row) : bool { if ($this->firstRow) { @@ -64,6 +65,7 @@ public function isSatisfiedBy(Row $row) : bool return true; } + #[\Override] public function toString() : string { $columns = []; @@ -78,6 +80,7 @@ public function toString() : string ); } + #[\Override] public function violation(Row $row) : string { $violations = []; diff --git a/src/core/etl/src/Flow/ETL/Constraint/UniqueConstraint.php b/src/core/etl/src/Flow/ETL/Constraint/UniqueConstraint.php index 68dedb636..791d1bccd 100644 --- a/src/core/etl/src/Flow/ETL/Constraint/UniqueConstraint.php +++ b/src/core/etl/src/Flow/ETL/Constraint/UniqueConstraint.php @@ -21,6 +21,7 @@ public function __construct(string|Reference $column, string|Reference ...$colum $this->storage = new InMemoryStorage(); } + #[\Override] public function isSatisfiedBy(Row $row) : bool { $key = $row->keep(...$this->reference)->hash(); @@ -34,6 +35,7 @@ public function isSatisfiedBy(Row $row) : bool return true; } + #[\Override] public function toString() : string { return sprintf( @@ -42,6 +44,7 @@ public function toString() : string ); } + #[\Override] public function violation(Row $row) : string { $violations = []; diff --git a/src/core/etl/src/Flow/ETL/Constraint/UniqueConstraint/InMemoryStorage.php b/src/core/etl/src/Flow/ETL/Constraint/UniqueConstraint/InMemoryStorage.php index 2c135fd27..0f808f72a 100644 --- a/src/core/etl/src/Flow/ETL/Constraint/UniqueConstraint/InMemoryStorage.php +++ b/src/core/etl/src/Flow/ETL/Constraint/UniqueConstraint/InMemoryStorage.php @@ -13,11 +13,13 @@ public function __construct() { } + #[\Override] public function clear() : void { $this->storage = []; } + #[\Override] public function delete(string $key) : void { if ($this->has($key)) { @@ -25,11 +27,13 @@ public function delete(string $key) : void } } + #[\Override] public function has(string $key) : bool { return isset($this->storage[$key]); } + #[\Override] public function set(string $key) : void { $this->storage[$key] = true; diff --git a/src/core/etl/src/Flow/ETL/Dataset/Statistics/HighResolutionTime.php b/src/core/etl/src/Flow/ETL/Dataset/Statistics/HighResolutionTime.php index b8ba5f283..15cbff47e 100644 --- a/src/core/etl/src/Flow/ETL/Dataset/Statistics/HighResolutionTime.php +++ b/src/core/etl/src/Flow/ETL/Dataset/Statistics/HighResolutionTime.php @@ -21,6 +21,7 @@ public static function now() : self return new self($timeParts[0], $timeParts[1]); } + #[\Override] public function __toString() : string { return $this->toString(); diff --git a/src/core/etl/src/Flow/ETL/ErrorHandler/IgnoreError.php b/src/core/etl/src/Flow/ETL/ErrorHandler/IgnoreError.php index 1609b3341..ccba68931 100644 --- a/src/core/etl/src/Flow/ETL/ErrorHandler/IgnoreError.php +++ b/src/core/etl/src/Flow/ETL/ErrorHandler/IgnoreError.php @@ -8,11 +8,13 @@ final class IgnoreError implements ErrorHandler { + #[\Override] public function skipRows(\Throwable $error, Rows $rows) : bool { return false; } + #[\Override] public function throw(\Throwable $error, Rows $rows) : bool { return false; diff --git a/src/core/etl/src/Flow/ETL/ErrorHandler/SkipRows.php b/src/core/etl/src/Flow/ETL/ErrorHandler/SkipRows.php index 3fb3b6020..109dc0884 100644 --- a/src/core/etl/src/Flow/ETL/ErrorHandler/SkipRows.php +++ b/src/core/etl/src/Flow/ETL/ErrorHandler/SkipRows.php @@ -8,11 +8,13 @@ final class SkipRows implements ErrorHandler { + #[\Override] public function skipRows(\Throwable $error, Rows $rows) : bool { return true; } + #[\Override] public function throw(\Throwable $error, Rows $rows) : bool { return false; diff --git a/src/core/etl/src/Flow/ETL/ErrorHandler/ThrowError.php b/src/core/etl/src/Flow/ETL/ErrorHandler/ThrowError.php index a6d0134ea..b947924bd 100644 --- a/src/core/etl/src/Flow/ETL/ErrorHandler/ThrowError.php +++ b/src/core/etl/src/Flow/ETL/ErrorHandler/ThrowError.php @@ -8,11 +8,13 @@ final class ThrowError implements ErrorHandler { + #[\Override] public function skipRows(\Throwable $error, Rows $rows) : bool { return false; } + #[\Override] public function throw(\Throwable $error, Rows $rows) : bool { return true; diff --git a/src/core/etl/src/Flow/ETL/Extractor/ArrayExtractor.php b/src/core/etl/src/Flow/ETL/Extractor/ArrayExtractor.php index 6dfa6f387..ea5fa47a7 100644 --- a/src/core/etl/src/Flow/ETL/Extractor/ArrayExtractor.php +++ b/src/core/etl/src/Flow/ETL/Extractor/ArrayExtractor.php @@ -18,6 +18,7 @@ public function __construct(private readonly iterable $dataset) { } + #[\Override] public function extract(FlowContext $context) : \Generator { foreach ($this->dataset as $row) { diff --git a/src/core/etl/src/Flow/ETL/Extractor/BatchByExtractor.php b/src/core/etl/src/Flow/ETL/Extractor/BatchByExtractor.php index 0cc4609be..20834bced 100644 --- a/src/core/etl/src/Flow/ETL/Extractor/BatchByExtractor.php +++ b/src/core/etl/src/Flow/ETL/Extractor/BatchByExtractor.php @@ -28,6 +28,7 @@ public function __construct( /** * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { $buffer = []; @@ -62,6 +63,7 @@ public function extract(FlowContext $context) : \Generator } } + #[\Override] public function extractors() : array { return [$this->extractor]; diff --git a/src/core/etl/src/Flow/ETL/Extractor/BatchExtractor.php b/src/core/etl/src/Flow/ETL/Extractor/BatchExtractor.php index eeea3c0df..8bf07315e 100644 --- a/src/core/etl/src/Flow/ETL/Extractor/BatchExtractor.php +++ b/src/core/etl/src/Flow/ETL/Extractor/BatchExtractor.php @@ -20,6 +20,7 @@ public function __construct( /** * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { $chunk = []; @@ -72,6 +73,7 @@ public function extract(FlowContext $context) : \Generator } } + #[\Override] public function extractors() : array { return [$this->extractor]; diff --git a/src/core/etl/src/Flow/ETL/Extractor/CacheExtractor.php b/src/core/etl/src/Flow/ETL/Extractor/CacheExtractor.php index bb805508d..67afa71d7 100644 --- a/src/core/etl/src/Flow/ETL/Extractor/CacheExtractor.php +++ b/src/core/etl/src/Flow/ETL/Extractor/CacheExtractor.php @@ -17,6 +17,7 @@ public function __construct( ) { } + #[\Override] public function extract(FlowContext $context) : \Generator { if (!$context->cache()->has($this->id)) { diff --git a/src/core/etl/src/Flow/ETL/Extractor/ChainExtractor.php b/src/core/etl/src/Flow/ETL/Extractor/ChainExtractor.php index eec7f5b89..fbd2ec9ff 100644 --- a/src/core/etl/src/Flow/ETL/Extractor/ChainExtractor.php +++ b/src/core/etl/src/Flow/ETL/Extractor/ChainExtractor.php @@ -22,6 +22,7 @@ public function __construct(Extractor ...$extractors) /** * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { foreach ($this->extractors as $extractor) { @@ -35,6 +36,7 @@ public function extract(FlowContext $context) : \Generator } } + #[\Override] public function extractors() : array { return $this->extractors; diff --git a/src/core/etl/src/Flow/ETL/Extractor/CollectingExtractor.php b/src/core/etl/src/Flow/ETL/Extractor/CollectingExtractor.php index a1cc1b8b0..2796d0cf9 100644 --- a/src/core/etl/src/Flow/ETL/Extractor/CollectingExtractor.php +++ b/src/core/etl/src/Flow/ETL/Extractor/CollectingExtractor.php @@ -12,6 +12,7 @@ public function __construct(private Extractor $extractor) { } + #[\Override] public function extract(FlowContext $context) : \Generator { $collectedRows = new Rows(); @@ -23,6 +24,7 @@ public function extract(FlowContext $context) : \Generator yield $collectedRows; } + #[\Override] public function extractors() : array { return [$this->extractor]; diff --git a/src/core/etl/src/Flow/ETL/Extractor/DataFrameExtractor.php b/src/core/etl/src/Flow/ETL/Extractor/DataFrameExtractor.php index cd49601ff..3d4512b56 100644 --- a/src/core/etl/src/Flow/ETL/Extractor/DataFrameExtractor.php +++ b/src/core/etl/src/Flow/ETL/Extractor/DataFrameExtractor.php @@ -12,6 +12,7 @@ public function __construct(private DataFrame $dataFrame) { } + #[\Override] public function extract(FlowContext $context) : \Generator { foreach ($this->dataFrame->get() as $rows) { diff --git a/src/core/etl/src/Flow/ETL/Extractor/FilesExtractor.php b/src/core/etl/src/Flow/ETL/Extractor/FilesExtractor.php index bd1f6a954..0fecaa01a 100644 --- a/src/core/etl/src/Flow/ETL/Extractor/FilesExtractor.php +++ b/src/core/etl/src/Flow/ETL/Extractor/FilesExtractor.php @@ -17,6 +17,7 @@ public function __construct(private readonly Path $path) { } + #[\Override] public function extract(FlowContext $context) : \Generator { @@ -39,6 +40,7 @@ public function extract(FlowContext $context) : \Generator } } + #[\Override] public function source() : Path { return $this->path; diff --git a/src/core/etl/src/Flow/ETL/Extractor/GeneratorExtractor.php b/src/core/etl/src/Flow/ETL/Extractor/GeneratorExtractor.php index 6fa157910..15b0a99b4 100644 --- a/src/core/etl/src/Flow/ETL/Extractor/GeneratorExtractor.php +++ b/src/core/etl/src/Flow/ETL/Extractor/GeneratorExtractor.php @@ -22,6 +22,7 @@ public function __construct(private \Generator $rows) /** * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { foreach ($this->rows as $row) { diff --git a/src/core/etl/src/Flow/ETL/Extractor/MemoryExtractor.php b/src/core/etl/src/Flow/ETL/Extractor/MemoryExtractor.php index 2024e254d..d74313ec5 100644 --- a/src/core/etl/src/Flow/ETL/Extractor/MemoryExtractor.php +++ b/src/core/etl/src/Flow/ETL/Extractor/MemoryExtractor.php @@ -18,6 +18,7 @@ public function __construct( ) { } + #[\Override] public function extract(FlowContext $context) : \Generator { foreach ($this->memory->dump() as $row) { diff --git a/src/core/etl/src/Flow/ETL/Extractor/PathPartitionsExtractor.php b/src/core/etl/src/Flow/ETL/Extractor/PathPartitionsExtractor.php index ec7fb4ad9..6560942b3 100644 --- a/src/core/etl/src/Flow/ETL/Extractor/PathPartitionsExtractor.php +++ b/src/core/etl/src/Flow/ETL/Extractor/PathPartitionsExtractor.php @@ -18,6 +18,7 @@ public function __construct(private readonly Path $path) { } + #[\Override] public function extract(FlowContext $context) : \Generator { foreach ($context->filesystem($this->path)->list($this->path, $this->filter()) as $fileStatus) { @@ -40,6 +41,7 @@ public function extract(FlowContext $context) : \Generator } } + #[\Override] public function source() : Path { return $this->path; diff --git a/src/core/etl/src/Flow/ETL/Extractor/PipelineExtractor.php b/src/core/etl/src/Flow/ETL/Extractor/PipelineExtractor.php index cf309fab7..c021bdb42 100644 --- a/src/core/etl/src/Flow/ETL/Extractor/PipelineExtractor.php +++ b/src/core/etl/src/Flow/ETL/Extractor/PipelineExtractor.php @@ -18,6 +18,7 @@ public function __construct( * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { return $this->pipeline->process($context); diff --git a/src/core/etl/src/Flow/ETL/Extractor/RowsExtractor.php b/src/core/etl/src/Flow/ETL/Extractor/RowsExtractor.php index 2e79c69d2..4c7e21bb1 100644 --- a/src/core/etl/src/Flow/ETL/Extractor/RowsExtractor.php +++ b/src/core/etl/src/Flow/ETL/Extractor/RowsExtractor.php @@ -21,6 +21,7 @@ public function __construct(Rows ...$rows) $this->rows = $rows; } + #[\Override] public function extract(FlowContext $context) : \Generator { foreach ($this->rows as $rows) { diff --git a/src/core/etl/src/Flow/ETL/Extractor/SequenceExtractor.php b/src/core/etl/src/Flow/ETL/Extractor/SequenceExtractor.php index 8457b57c7..4cda62b37 100644 --- a/src/core/etl/src/Flow/ETL/Extractor/SequenceExtractor.php +++ b/src/core/etl/src/Flow/ETL/Extractor/SequenceExtractor.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function extract(FlowContext $context) : \Generator { /** @var mixed $item */ diff --git a/src/core/etl/src/Flow/ETL/Extractor/SequenceGenerator/DatePeriodSequenceGenerator.php b/src/core/etl/src/Flow/ETL/Extractor/SequenceGenerator/DatePeriodSequenceGenerator.php index 3f94ae924..2fb1eef99 100644 --- a/src/core/etl/src/Flow/ETL/Extractor/SequenceGenerator/DatePeriodSequenceGenerator.php +++ b/src/core/etl/src/Flow/ETL/Extractor/SequenceGenerator/DatePeriodSequenceGenerator.php @@ -13,6 +13,7 @@ public function __construct(private \DatePeriod $period) { } + #[\Override] public function generate() : \Generator { foreach ($this->period->getIterator() as $item) { diff --git a/src/core/etl/src/Flow/ETL/Extractor/SequenceGenerator/NumberSequenceGenerator.php b/src/core/etl/src/Flow/ETL/Extractor/SequenceGenerator/NumberSequenceGenerator.php index 38dc5150c..1798325a4 100644 --- a/src/core/etl/src/Flow/ETL/Extractor/SequenceGenerator/NumberSequenceGenerator.php +++ b/src/core/etl/src/Flow/ETL/Extractor/SequenceGenerator/NumberSequenceGenerator.php @@ -10,6 +10,7 @@ public function __construct(private string|int|float $start, private string|int| { } + #[\Override] public function generate() : \Generator { foreach (\range($this->start, $this->end, $this->step) as $item) { diff --git a/src/core/etl/src/Flow/ETL/Extractor/SortBucketsExtractor.php b/src/core/etl/src/Flow/ETL/Extractor/SortBucketsExtractor.php index 2ca32339f..98ad7db32 100644 --- a/src/core/etl/src/Flow/ETL/Extractor/SortBucketsExtractor.php +++ b/src/core/etl/src/Flow/ETL/Extractor/SortBucketsExtractor.php @@ -25,6 +25,7 @@ public function __construct( /** * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { foreach ($this->sortBuckets as $bucket) { diff --git a/src/core/etl/src/Flow/ETL/Filesystem/FilesystemStreams.php b/src/core/etl/src/Flow/ETL/Filesystem/FilesystemStreams.php index 2bbb411ec..7780cf66d 100644 --- a/src/core/etl/src/Flow/ETL/Filesystem/FilesystemStreams.php +++ b/src/core/etl/src/Flow/ETL/Filesystem/FilesystemStreams.php @@ -69,6 +69,7 @@ public function closeStreams(Path $path) : void $this->writingStreams = $streams; } + #[\Override] public function count() : int { return \count($this->writingStreams); @@ -89,6 +90,7 @@ public function exists(Path $path, array $partitions = []) : bool /** * @return \Traversable */ + #[\Override] public function getIterator() : \Traversable { return new \ArrayIterator(\array_merge(...\array_values($this->writingStreams))); diff --git a/src/core/etl/src/Flow/ETL/Filesystem/ScalarFunctionFilter.php b/src/core/etl/src/Flow/ETL/Filesystem/ScalarFunctionFilter.php index 8db0fae11..feb432548 100644 --- a/src/core/etl/src/Flow/ETL/Filesystem/ScalarFunctionFilter.php +++ b/src/core/etl/src/Flow/ETL/Filesystem/ScalarFunctionFilter.php @@ -21,6 +21,7 @@ public function __construct( ) { } + #[\Override] public function accept(FileStatus $status) : bool { return (bool) $this->function->eval( diff --git a/src/core/etl/src/Flow/ETL/Formatter/ASCII/Headers.php b/src/core/etl/src/Flow/ETL/Formatter/ASCII/Headers.php index 756d2f06b..e56f357ec 100644 --- a/src/core/etl/src/Flow/ETL/Formatter/ASCII/Headers.php +++ b/src/core/etl/src/Flow/ETL/Formatter/ASCII/Headers.php @@ -17,6 +17,7 @@ public function __construct(private readonly Rows $rows) { } + #[\Override] public function count() : int { return \count($this->names()); diff --git a/src/core/etl/src/Flow/ETL/Formatter/AsciiTableFormatter.php b/src/core/etl/src/Flow/ETL/Formatter/AsciiTableFormatter.php index 78c3f0303..702dc9c00 100644 --- a/src/core/etl/src/Flow/ETL/Formatter/AsciiTableFormatter.php +++ b/src/core/etl/src/Flow/ETL/Formatter/AsciiTableFormatter.php @@ -9,6 +9,7 @@ final class AsciiTableFormatter implements Formatter { + #[\Override] public function format(Rows $rows, int|bool $truncate = 20) : string { if ($rows->count() === 0) { diff --git a/src/core/etl/src/Flow/ETL/Function/All.php b/src/core/etl/src/Flow/ETL/Function/All.php index a9143d9da..4fde8aea4 100644 --- a/src/core/etl/src/Flow/ETL/Function/All.php +++ b/src/core/etl/src/Flow/ETL/Function/All.php @@ -29,6 +29,7 @@ public function andNot(ScalarFunction $scalarFunction) : self return new self(...$this->functions, ...[new Not($scalarFunction)]); } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { foreach ($this->functions as $ref) { diff --git a/src/core/etl/src/Flow/ETL/Function/Any.php b/src/core/etl/src/Flow/ETL/Function/Any.php index c44a847b9..85f1302a6 100644 --- a/src/core/etl/src/Flow/ETL/Function/Any.php +++ b/src/core/etl/src/Flow/ETL/Function/Any.php @@ -29,6 +29,7 @@ public function andNot(ScalarFunction $scalarFunction) : All return new All(...$this->functions, ...[new Not($scalarFunction)]); } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { foreach ($this->functions as $ref) { diff --git a/src/core/etl/src/Flow/ETL/Function/Append.php b/src/core/etl/src/Flow/ETL/Function/Append.php index a4b7759ed..d1b0f2509 100644 --- a/src/core/etl/src/Flow/ETL/Function/Append.php +++ b/src/core/etl/src/Flow/ETL/Function/Append.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/ArrayExpand.php b/src/core/etl/src/Flow/ETL/Function/ArrayExpand.php index e88a10859..216519a94 100644 --- a/src/core/etl/src/Flow/ETL/Function/ArrayExpand.php +++ b/src/core/etl/src/Flow/ETL/Function/ArrayExpand.php @@ -17,6 +17,7 @@ public function __construct(private readonly ScalarFunction $ref, private readon /** * @return array */ + #[\Override] public function eval(Row $row, FlowContext $context) : array { $array = (new Parameter($this->ref))->asArray($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/ArrayFilter.php b/src/core/etl/src/Flow/ETL/Function/ArrayFilter.php index 09a3e7722..22110840d 100644 --- a/src/core/etl/src/Flow/ETL/Function/ArrayFilter.php +++ b/src/core/etl/src/Flow/ETL/Function/ArrayFilter.php @@ -16,6 +16,7 @@ public function __construct(private readonly ScalarFunction|array $array, privat { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $array = (new Parameter($this->array))->asArray($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/ArrayGet.php b/src/core/etl/src/Flow/ETL/Function/ArrayGet.php index 775aeeffb..2f92be89c 100644 --- a/src/core/etl/src/Flow/ETL/Function/ArrayGet.php +++ b/src/core/etl/src/Flow/ETL/Function/ArrayGet.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { try { diff --git a/src/core/etl/src/Flow/ETL/Function/ArrayGetCollection.php b/src/core/etl/src/Flow/ETL/Function/ArrayGetCollection.php index cd7f071cf..38761b492 100644 --- a/src/core/etl/src/Flow/ETL/Function/ArrayGetCollection.php +++ b/src/core/etl/src/Flow/ETL/Function/ArrayGetCollection.php @@ -29,6 +29,7 @@ public static function fromFirst(ScalarFunction $ref, ScalarFunction|array $keys return new self($ref, $keys, '0'); } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { try { diff --git a/src/core/etl/src/Flow/ETL/Function/ArrayKeep.php b/src/core/etl/src/Flow/ETL/Function/ArrayKeep.php index ebc123bd4..421167ae7 100644 --- a/src/core/etl/src/Flow/ETL/Function/ArrayKeep.php +++ b/src/core/etl/src/Flow/ETL/Function/ArrayKeep.php @@ -16,6 +16,7 @@ public function __construct(private readonly ScalarFunction|array $array, privat { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $array = (new Parameter($this->array))->asArray($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/ArrayKeyRename.php b/src/core/etl/src/Flow/ETL/Function/ArrayKeyRename.php index d09afe8cd..0e7802e8e 100644 --- a/src/core/etl/src/Flow/ETL/Function/ArrayKeyRename.php +++ b/src/core/etl/src/Flow/ETL/Function/ArrayKeyRename.php @@ -17,6 +17,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $value = (new Parameter($this->ref))->asArray($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/ArrayKeys.php b/src/core/etl/src/Flow/ETL/Function/ArrayKeys.php index 43068fc65..e107c8586 100644 --- a/src/core/etl/src/Flow/ETL/Function/ArrayKeys.php +++ b/src/core/etl/src/Flow/ETL/Function/ArrayKeys.php @@ -19,6 +19,7 @@ public function __construct(private readonly ScalarFunction|array $array) /** * @return null|array */ + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $array = (new Parameter($this->array))->asArray($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/ArrayKeysStyleConvert.php b/src/core/etl/src/Flow/ETL/Function/ArrayKeysStyleConvert.php index cead5c592..256e7fbee 100644 --- a/src/core/etl/src/Flow/ETL/Function/ArrayKeysStyleConvert.php +++ b/src/core/etl/src/Flow/ETL/Function/ArrayKeysStyleConvert.php @@ -24,6 +24,7 @@ public function __construct( } } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $array = (new Parameter($this->ref))->asArray($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/ArrayMerge.php b/src/core/etl/src/Flow/ETL/Function/ArrayMerge.php index 573f702c8..d8f426895 100644 --- a/src/core/etl/src/Flow/ETL/Function/ArrayMerge.php +++ b/src/core/etl/src/Flow/ETL/Function/ArrayMerge.php @@ -23,6 +23,7 @@ public function __construct(private readonly ScalarFunction|array $left, private /** * @return null|array */ + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $left = (new Parameter($this->left))->asArray($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/ArrayMergeCollection.php b/src/core/etl/src/Flow/ETL/Function/ArrayMergeCollection.php index 1fa9b9468..913d09c07 100644 --- a/src/core/etl/src/Flow/ETL/Function/ArrayMergeCollection.php +++ b/src/core/etl/src/Flow/ETL/Function/ArrayMergeCollection.php @@ -19,6 +19,7 @@ public function __construct(private readonly ScalarFunction|array $array) /** * @return null|array */ + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $array = (new Parameter($this->array))->asArray($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/ArrayPathExists.php b/src/core/etl/src/Flow/ETL/Function/ArrayPathExists.php index 1e6706cea..e228e3d78 100644 --- a/src/core/etl/src/Flow/ETL/Function/ArrayPathExists.php +++ b/src/core/etl/src/Flow/ETL/Function/ArrayPathExists.php @@ -20,6 +20,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : bool { try { diff --git a/src/core/etl/src/Flow/ETL/Function/ArrayReverse.php b/src/core/etl/src/Flow/ETL/Function/ArrayReverse.php index 35ed648b1..be99cc67c 100644 --- a/src/core/etl/src/Flow/ETL/Function/ArrayReverse.php +++ b/src/core/etl/src/Flow/ETL/Function/ArrayReverse.php @@ -20,6 +20,7 @@ public function __construct(private readonly ScalarFunction|array $array, privat /** * @return null|array */ + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $array = (new Parameter($this->array))->asArray($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/ArraySort.php b/src/core/etl/src/Flow/ETL/Function/ArraySort.php index e0f310394..04fca78cb 100644 --- a/src/core/etl/src/Flow/ETL/Function/ArraySort.php +++ b/src/core/etl/src/Flow/ETL/Function/ArraySort.php @@ -21,6 +21,7 @@ public function __construct( /** * @return null|array */ + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $array = (new Parameter($this->ref))->asArray($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/ArrayUnpack.php b/src/core/etl/src/Flow/ETL/Function/ArrayUnpack.php index 8b61fd631..0af879772 100644 --- a/src/core/etl/src/Flow/ETL/Function/ArrayUnpack.php +++ b/src/core/etl/src/Flow/ETL/Function/ArrayUnpack.php @@ -25,6 +25,7 @@ public function __construct( /** * @return array */ + #[\Override] public function eval(Row $row, FlowContext $context) : array { $array = (new Parameter($this->array))->asArray($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/ArrayValues.php b/src/core/etl/src/Flow/ETL/Function/ArrayValues.php index 33d365534..cba8a87b0 100644 --- a/src/core/etl/src/Flow/ETL/Function/ArrayValues.php +++ b/src/core/etl/src/Flow/ETL/Function/ArrayValues.php @@ -19,6 +19,7 @@ public function __construct(private readonly ScalarFunction|array $array) /** * @return null|array */ + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $array = (new Parameter($this->array))->asArray($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Ascii.php b/src/core/etl/src/Flow/ETL/Function/Ascii.php index 1ca951008..4dcf4c07c 100644 --- a/src/core/etl/src/Flow/ETL/Function/Ascii.php +++ b/src/core/etl/src/Flow/ETL/Function/Ascii.php @@ -14,6 +14,7 @@ public function __construct(private readonly ScalarFunction|string $string) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $string = (new Parameter($this->string))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Average.php b/src/core/etl/src/Flow/ETL/Function/Average.php index b290b25e6..78a2cc684 100644 --- a/src/core/etl/src/Flow/ETL/Function/Average.php +++ b/src/core/etl/src/Flow/ETL/Function/Average.php @@ -26,6 +26,7 @@ public function __construct(private readonly Reference $ref, private readonly in $this->sum = 0; } + #[\Override] public function aggregate(Row $row, FlowContext $context) : void { try { @@ -41,6 +42,7 @@ public function aggregate(Row $row, FlowContext $context) : void } } + #[\Override] public function apply(Row $row, Rows $partition, FlowContext $context) : mixed { $sum = 0; @@ -63,6 +65,7 @@ public function apply(Row $row, Rows $partition, FlowContext $context) : mixed return (new Calculator())->divide($sum, $count, $this->scale, $this->rounding); } + #[\Override] public function over(Window $window) : WindowFunction { $this->window = $window; @@ -70,6 +73,7 @@ public function over(Window $window) : WindowFunction return $this; } + #[\Override] public function result(EntryFactory $entryFactory) : Entry { if (!$this->ref->hasAlias()) { @@ -90,11 +94,13 @@ public function result(EntryFactory $entryFactory) : Entry return float_entry($this->ref->name(), $result); } + #[\Override] public function toString() : string { return 'average()'; } + #[\Override] public function window() : Window { if ($this->window === null) { diff --git a/src/core/etl/src/Flow/ETL/Function/Between.php b/src/core/etl/src/Flow/ETL/Function/Between.php index 53734af5f..5aa3c35c4 100644 --- a/src/core/etl/src/Flow/ETL/Function/Between.php +++ b/src/core/etl/src/Flow/ETL/Function/Between.php @@ -18,6 +18,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $value = (new Parameter($this->value))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/BinaryLength.php b/src/core/etl/src/Flow/ETL/Function/BinaryLength.php index 8d932eea6..60ab71b09 100644 --- a/src/core/etl/src/Flow/ETL/Function/BinaryLength.php +++ b/src/core/etl/src/Flow/ETL/Function/BinaryLength.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?int { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/CallUserFunc.php b/src/core/etl/src/Flow/ETL/Function/CallUserFunc.php index d677e6979..dedce155e 100644 --- a/src/core/etl/src/Flow/ETL/Function/CallUserFunc.php +++ b/src/core/etl/src/Flow/ETL/Function/CallUserFunc.php @@ -26,6 +26,7 @@ public function __construct(ScalarFunction|callable $callable, private readonly $this->callable = $callable; } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $callable = (new Parameter($this->callable))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Capitalize.php b/src/core/etl/src/Flow/ETL/Function/Capitalize.php index 9fb603fc7..a18e09e8f 100644 --- a/src/core/etl/src/Flow/ETL/Function/Capitalize.php +++ b/src/core/etl/src/Flow/ETL/Function/Capitalize.php @@ -13,6 +13,7 @@ public function __construct(private readonly ScalarFunction|string $string) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $string = (new Parameter($this->string))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Cast.php b/src/core/etl/src/Flow/ETL/Function/Cast.php index 8a47dec1c..603fad25a 100644 --- a/src/core/etl/src/Flow/ETL/Function/Cast.php +++ b/src/core/etl/src/Flow/ETL/Function/Cast.php @@ -27,6 +27,7 @@ public function __construct( * @throws InvalidArgumentException * @throws \JsonException */ + #[\Override] public function eval(Row $row, FlowContext $context) : ?ScalarResult { $value = (new Parameter($this->value))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Chunk.php b/src/core/etl/src/Flow/ETL/Function/Chunk.php index 72a9a9d33..3c59ce54b 100644 --- a/src/core/etl/src/Flow/ETL/Function/Chunk.php +++ b/src/core/etl/src/Flow/ETL/Function/Chunk.php @@ -19,6 +19,7 @@ public function __construct( /** * @return null|array */ + #[\Override] public function eval(Row $row, FlowContext $context) : ?array { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Coalesce.php b/src/core/etl/src/Flow/ETL/Function/Coalesce.php index b9a5cd98f..1473b7ba0 100644 --- a/src/core/etl/src/Flow/ETL/Function/Coalesce.php +++ b/src/core/etl/src/Flow/ETL/Function/Coalesce.php @@ -19,6 +19,7 @@ public function __construct( $this->values = $values; } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { foreach ($this->values as $value) { diff --git a/src/core/etl/src/Flow/ETL/Function/CodePointLength.php b/src/core/etl/src/Flow/ETL/Function/CodePointLength.php index 804bd70c4..67e99d400 100644 --- a/src/core/etl/src/Flow/ETL/Function/CodePointLength.php +++ b/src/core/etl/src/Flow/ETL/Function/CodePointLength.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?int { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/CollapseWhitespace.php b/src/core/etl/src/Flow/ETL/Function/CollapseWhitespace.php index fde70fe1a..e39452398 100644 --- a/src/core/etl/src/Flow/ETL/Function/CollapseWhitespace.php +++ b/src/core/etl/src/Flow/ETL/Function/CollapseWhitespace.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Collect.php b/src/core/etl/src/Flow/ETL/Function/Collect.php index 4b1558fd1..7034c63bb 100644 --- a/src/core/etl/src/Flow/ETL/Function/Collect.php +++ b/src/core/etl/src/Flow/ETL/Function/Collect.php @@ -22,6 +22,7 @@ public function __construct(private readonly Reference $ref) $this->collection = []; } + #[\Override] public function aggregate(Row $row, FlowContext $context) : void { try { @@ -39,6 +40,7 @@ public function aggregate(Row $row, FlowContext $context) : void /** * @return Entry */ + #[\Override] public function result(EntryFactory $entryFactory) : Entry { if (!$this->ref->hasAlias()) { diff --git a/src/core/etl/src/Flow/ETL/Function/CollectUnique.php b/src/core/etl/src/Flow/ETL/Function/CollectUnique.php index f61a6dc26..174acc533 100644 --- a/src/core/etl/src/Flow/ETL/Function/CollectUnique.php +++ b/src/core/etl/src/Flow/ETL/Function/CollectUnique.php @@ -22,6 +22,7 @@ public function __construct(private readonly Reference $ref) $this->collection = []; } + #[\Override] public function aggregate(Row $row, FlowContext $context) : void { try { @@ -44,6 +45,7 @@ public function aggregate(Row $row, FlowContext $context) : void /** * @return Entry */ + #[\Override] public function result(EntryFactory $entryFactory) : Entry { if (!$this->ref->hasAlias()) { diff --git a/src/core/etl/src/Flow/ETL/Function/Combine.php b/src/core/etl/src/Flow/ETL/Function/Combine.php index 4e4569f8f..cb595dced 100644 --- a/src/core/etl/src/Flow/ETL/Function/Combine.php +++ b/src/core/etl/src/Flow/ETL/Function/Combine.php @@ -22,6 +22,7 @@ public function __construct( /** * @return null|array */ + #[\Override] public function eval(Row $row, FlowContext $context) : ?array { $keys = (new Parameter($this->keys))->asArray($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Concat.php b/src/core/etl/src/Flow/ETL/Function/Concat.php index 168d65bc6..25cac7ec0 100644 --- a/src/core/etl/src/Flow/ETL/Function/Concat.php +++ b/src/core/etl/src/Flow/ETL/Function/Concat.php @@ -20,6 +20,7 @@ public function __construct( $this->refs = $refs; } + #[\Override] public function eval(Row $row, FlowContext $context) : string { /** @var array $concatValues */ diff --git a/src/core/etl/src/Flow/ETL/Function/ConcatWithSeparator.php b/src/core/etl/src/Flow/ETL/Function/ConcatWithSeparator.php index 43c20a56a..f24ba2aa8 100644 --- a/src/core/etl/src/Flow/ETL/Function/ConcatWithSeparator.php +++ b/src/core/etl/src/Flow/ETL/Function/ConcatWithSeparator.php @@ -23,6 +23,7 @@ public function __construct( $this->refs = $refs; } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $separator = (new Parameter($this->separator))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Contains.php b/src/core/etl/src/Flow/ETL/Function/Contains.php index e41f024c7..31e25913b 100644 --- a/src/core/etl/src/Flow/ETL/Function/Contains.php +++ b/src/core/etl/src/Flow/ETL/Function/Contains.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : bool { $haystack = (new Parameter($this->haystack))->as($row, $context, type_string(), type_array()); diff --git a/src/core/etl/src/Flow/ETL/Function/Count.php b/src/core/etl/src/Flow/ETL/Function/Count.php index 83922a4ce..6e07ddfe1 100644 --- a/src/core/etl/src/Flow/ETL/Function/Count.php +++ b/src/core/etl/src/Flow/ETL/Function/Count.php @@ -22,6 +22,7 @@ public function __construct(private readonly ?Reference $ref = null) $this->count = 0; } + #[\Override] public function aggregate(Row $row, FlowContext $context) : void { try { @@ -34,6 +35,7 @@ public function aggregate(Row $row, FlowContext $context) : void } } + #[\Override] public function apply(Row $row, Rows $partition, FlowContext $context) : mixed { if ($this->ref === null) { @@ -63,6 +65,7 @@ public function apply(Row $row, Rows $partition, FlowContext $context) : mixed return $count; } + #[\Override] public function over(Window $window) : WindowFunction { $this->window = $window; @@ -73,6 +76,7 @@ public function over(Window $window) : WindowFunction /** * @return Entry */ + #[\Override] public function result(EntryFactory $entryFactory) : Entry { if (!$this->ref) { @@ -86,11 +90,13 @@ public function result(EntryFactory $entryFactory) : Entry return int_entry($this->ref->name(), $this->count); } + #[\Override] public function toString() : string { return 'count()'; } + #[\Override] public function window() : Window { if ($this->window === null) { diff --git a/src/core/etl/src/Flow/ETL/Function/DOMElementAttributeValue.php b/src/core/etl/src/Flow/ETL/Function/DOMElementAttributeValue.php index 538fb7e67..752b5cce8 100644 --- a/src/core/etl/src/Flow/ETL/Function/DOMElementAttributeValue.php +++ b/src/core/etl/src/Flow/ETL/Function/DOMElementAttributeValue.php @@ -17,6 +17,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $types = [ diff --git a/src/core/etl/src/Flow/ETL/Function/DOMElementAttributesCount.php b/src/core/etl/src/Flow/ETL/Function/DOMElementAttributesCount.php index 3c50ef48d..564589804 100644 --- a/src/core/etl/src/Flow/ETL/Function/DOMElementAttributesCount.php +++ b/src/core/etl/src/Flow/ETL/Function/DOMElementAttributesCount.php @@ -15,6 +15,7 @@ public function __construct(private readonly ScalarFunction|\DOMNode|HTMlElement { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?int { $types = [ diff --git a/src/core/etl/src/Flow/ETL/Function/DOMElementParent.php b/src/core/etl/src/Flow/ETL/Function/DOMElementParent.php index 8f2ce8d3c..0ca42b024 100644 --- a/src/core/etl/src/Flow/ETL/Function/DOMElementParent.php +++ b/src/core/etl/src/Flow/ETL/Function/DOMElementParent.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : \DOMNode|HTMLElement|null { $types = [ diff --git a/src/core/etl/src/Flow/ETL/Function/DOMElementValue.php b/src/core/etl/src/Flow/ETL/Function/DOMElementValue.php index 11cf307d3..119eeb82b 100644 --- a/src/core/etl/src/Flow/ETL/Function/DOMElementValue.php +++ b/src/core/etl/src/Flow/ETL/Function/DOMElementValue.php @@ -14,6 +14,7 @@ public function __construct(private readonly ScalarFunction|\DOMNode|CharacterDa { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $types = [ diff --git a/src/core/etl/src/Flow/ETL/Function/DateTimeFormat.php b/src/core/etl/src/Flow/ETL/Function/DateTimeFormat.php index a4b4317c2..513a6dc8e 100644 --- a/src/core/etl/src/Flow/ETL/Function/DateTimeFormat.php +++ b/src/core/etl/src/Flow/ETL/Function/DateTimeFormat.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $value = (new Parameter($this->dateTime))->asInstanceOf($row, $context, \DateTimeInterface::class); diff --git a/src/core/etl/src/Flow/ETL/Function/DenseRank.php b/src/core/etl/src/Flow/ETL/Function/DenseRank.php index 2e761fd34..5a7d86e30 100644 --- a/src/core/etl/src/Flow/ETL/Function/DenseRank.php +++ b/src/core/etl/src/Flow/ETL/Function/DenseRank.php @@ -16,6 +16,7 @@ public function __construct() $this->window = null; } + #[\Override] public function apply(Row $row, Rows $partition, FlowContext $context) : mixed { $rank = 1; @@ -49,6 +50,7 @@ public function apply(Row $row, Rows $partition, FlowContext $context) : mixed return $rank; } + #[\Override] public function over(Window $window) : WindowFunction { $this->window = $window; @@ -56,11 +58,13 @@ public function over(Window $window) : WindowFunction return $this; } + #[\Override] public function toString() : string { return 'dens_rank()'; } + #[\Override] public function window() : Window { if ($this->window === null) { diff --git a/src/core/etl/src/Flow/ETL/Function/Divide.php b/src/core/etl/src/Flow/ETL/Function/Divide.php index cd2fe2541..7e555c883 100644 --- a/src/core/etl/src/Flow/ETL/Function/Divide.php +++ b/src/core/etl/src/Flow/ETL/Function/Divide.php @@ -18,6 +18,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : int|float|null { $leftValue = (new Parameter($this->left))->asNumber($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/EndsWith.php b/src/core/etl/src/Flow/ETL/Function/EndsWith.php index a82dc3091..3b14bdc2a 100644 --- a/src/core/etl/src/Flow/ETL/Function/EndsWith.php +++ b/src/core/etl/src/Flow/ETL/Function/EndsWith.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : bool { $haystack = (new Parameter($this->haystack))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/EnsureEnd.php b/src/core/etl/src/Flow/ETL/Function/EnsureEnd.php index 64589f2b2..7d0a17de0 100644 --- a/src/core/etl/src/Flow/ETL/Function/EnsureEnd.php +++ b/src/core/etl/src/Flow/ETL/Function/EnsureEnd.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/EnsureStart.php b/src/core/etl/src/Flow/ETL/Function/EnsureStart.php index aaa881cf9..fec908397 100644 --- a/src/core/etl/src/Flow/ETL/Function/EnsureStart.php +++ b/src/core/etl/src/Flow/ETL/Function/EnsureStart.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Equals.php b/src/core/etl/src/Flow/ETL/Function/Equals.php index 8b65f063d..59b01470e 100644 --- a/src/core/etl/src/Flow/ETL/Function/Equals.php +++ b/src/core/etl/src/Flow/ETL/Function/Equals.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : bool { $left = (new Parameter($this->left))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Exists.php b/src/core/etl/src/Flow/ETL/Function/Exists.php index e1391773f..d2af90f3a 100644 --- a/src/core/etl/src/Flow/ETL/Function/Exists.php +++ b/src/core/etl/src/Flow/ETL/Function/Exists.php @@ -13,6 +13,7 @@ public function __construct(private readonly ScalarFunction $ref) { } + #[\Override] public function eval(Row $row, FlowContext $context) : bool { try { diff --git a/src/core/etl/src/Flow/ETL/Function/First.php b/src/core/etl/src/Flow/ETL/Function/First.php index e108a2c99..9c97e3606 100644 --- a/src/core/etl/src/Flow/ETL/Function/First.php +++ b/src/core/etl/src/Flow/ETL/Function/First.php @@ -22,6 +22,7 @@ public function __construct(private readonly Reference $ref) $this->first = null; } + #[\Override] public function aggregate(Row $row, FlowContext $context) : void { if ($this->first === null) { @@ -36,6 +37,7 @@ public function aggregate(Row $row, FlowContext $context) : void /** * @return Entry */ + #[\Override] public function result(EntryFactory $entryFactory) : Entry { $name = $this->ref->hasAlias() ? $this->ref->name() : $this->ref->name() . '_first'; diff --git a/src/core/etl/src/Flow/ETL/Function/GreaterThan.php b/src/core/etl/src/Flow/ETL/Function/GreaterThan.php index b3d128707..76a7e63d1 100644 --- a/src/core/etl/src/Flow/ETL/Function/GreaterThan.php +++ b/src/core/etl/src/Flow/ETL/Function/GreaterThan.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $left = (new Parameter($this->left))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/GreaterThanEqual.php b/src/core/etl/src/Flow/ETL/Function/GreaterThanEqual.php index c6184b0bd..30b80cc0b 100644 --- a/src/core/etl/src/Flow/ETL/Function/GreaterThanEqual.php +++ b/src/core/etl/src/Flow/ETL/Function/GreaterThanEqual.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $left = (new Parameter($this->left))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Greatest.php b/src/core/etl/src/Flow/ETL/Function/Greatest.php index 0fcbb351b..3bb6cce9d 100644 --- a/src/core/etl/src/Flow/ETL/Function/Greatest.php +++ b/src/core/etl/src/Flow/ETL/Function/Greatest.php @@ -18,6 +18,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $extractedValues = []; diff --git a/src/core/etl/src/Flow/ETL/Function/HTMLQuerySelector.php b/src/core/etl/src/Flow/ETL/Function/HTMLQuerySelector.php index 5abd9def9..97aa49e52 100644 --- a/src/core/etl/src/Flow/ETL/Function/HTMLQuerySelector.php +++ b/src/core/etl/src/Flow/ETL/Function/HTMLQuerySelector.php @@ -20,6 +20,7 @@ public function __construct( } } + #[\Override] public function eval(Row $row, FlowContext $context) : ?Element { $value = (new Parameter($this->value))->as($row, $context, type_instance_of(HTMLDocument::class), type_instance_of(HTMLElement::class)); diff --git a/src/core/etl/src/Flow/ETL/Function/HTMLQuerySelectorAll.php b/src/core/etl/src/Flow/ETL/Function/HTMLQuerySelectorAll.php index 2864198d6..a9c0cba52 100644 --- a/src/core/etl/src/Flow/ETL/Function/HTMLQuerySelectorAll.php +++ b/src/core/etl/src/Flow/ETL/Function/HTMLQuerySelectorAll.php @@ -24,6 +24,7 @@ public function __construct( /** * @return null|array */ + #[\Override] public function eval(Row $row, FlowContext $context) : ?array { $value = (new Parameter($this->value))->as($row, $context, type_instance_of(HTMLDocument::class), type_instance_of(HTMLElement::class)); diff --git a/src/core/etl/src/Flow/ETL/Function/Hash.php b/src/core/etl/src/Flow/ETL/Function/Hash.php index 161cf32cf..e6cea0a7c 100644 --- a/src/core/etl/src/Flow/ETL/Function/Hash.php +++ b/src/core/etl/src/Flow/ETL/Function/Hash.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $value = (new Parameter($this->value))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/IndexOf.php b/src/core/etl/src/Flow/ETL/Function/IndexOf.php index 2a011dc91..27dbf2698 100644 --- a/src/core/etl/src/Flow/ETL/Function/IndexOf.php +++ b/src/core/etl/src/Flow/ETL/Function/IndexOf.php @@ -19,6 +19,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : int|false|null { $string = (new Parameter($this->string))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/IndexOfLast.php b/src/core/etl/src/Flow/ETL/Function/IndexOfLast.php index 0c5dcb525..6dcec81c6 100644 --- a/src/core/etl/src/Flow/ETL/Function/IndexOfLast.php +++ b/src/core/etl/src/Flow/ETL/Function/IndexOfLast.php @@ -19,6 +19,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : int|false|null { $string = (new Parameter($this->string))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/IsEmpty.php b/src/core/etl/src/Flow/ETL/Function/IsEmpty.php index a9e9c18cb..dc2fd16d2 100644 --- a/src/core/etl/src/Flow/ETL/Function/IsEmpty.php +++ b/src/core/etl/src/Flow/ETL/Function/IsEmpty.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?bool { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/IsIn.php b/src/core/etl/src/Flow/ETL/Function/IsIn.php index 0d6c9ad90..89f718d4b 100644 --- a/src/core/etl/src/Flow/ETL/Function/IsIn.php +++ b/src/core/etl/src/Flow/ETL/Function/IsIn.php @@ -19,6 +19,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $haystack = (new Parameter($this->haystack))->asArray($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/IsNotNull.php b/src/core/etl/src/Flow/ETL/Function/IsNotNull.php index 5da3e04eb..9b9d14e57 100644 --- a/src/core/etl/src/Flow/ETL/Function/IsNotNull.php +++ b/src/core/etl/src/Flow/ETL/Function/IsNotNull.php @@ -13,6 +13,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : bool { return (new Parameter($this->value))->eval($row, $context) !== null; diff --git a/src/core/etl/src/Flow/ETL/Function/IsNotNumeric.php b/src/core/etl/src/Flow/ETL/Function/IsNotNumeric.php index 0603619c3..f1ee1d16f 100644 --- a/src/core/etl/src/Flow/ETL/Function/IsNotNumeric.php +++ b/src/core/etl/src/Flow/ETL/Function/IsNotNumeric.php @@ -13,6 +13,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : bool { return (new Parameter($this->value))->asNumber($row, $context) === null; diff --git a/src/core/etl/src/Flow/ETL/Function/IsNull.php b/src/core/etl/src/Flow/ETL/Function/IsNull.php index 72a3cc46f..93889a127 100644 --- a/src/core/etl/src/Flow/ETL/Function/IsNull.php +++ b/src/core/etl/src/Flow/ETL/Function/IsNull.php @@ -13,6 +13,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : bool { return (new Parameter($this->value))->eval($row, $context) === null; diff --git a/src/core/etl/src/Flow/ETL/Function/IsNumeric.php b/src/core/etl/src/Flow/ETL/Function/IsNumeric.php index b5b3e4dfe..a916a0814 100644 --- a/src/core/etl/src/Flow/ETL/Function/IsNumeric.php +++ b/src/core/etl/src/Flow/ETL/Function/IsNumeric.php @@ -13,6 +13,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : bool { return (new Parameter($this->value))->asNumber($row, $context) !== null; diff --git a/src/core/etl/src/Flow/ETL/Function/IsType.php b/src/core/etl/src/Flow/ETL/Function/IsType.php index 2fca76713..f0a10d03b 100644 --- a/src/core/etl/src/Flow/ETL/Function/IsType.php +++ b/src/core/etl/src/Flow/ETL/Function/IsType.php @@ -26,6 +26,7 @@ public function __construct( $this->types = $types; } + #[\Override] public function eval(Row $row, FlowContext $context) : bool { $value = (new Parameter($this->value))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/IsUtf8.php b/src/core/etl/src/Flow/ETL/Function/IsUtf8.php index 67cf66463..23a26d8cb 100644 --- a/src/core/etl/src/Flow/ETL/Function/IsUtf8.php +++ b/src/core/etl/src/Flow/ETL/Function/IsUtf8.php @@ -14,6 +14,7 @@ public function __construct(private readonly ScalarFunction|string $string) { } + #[\Override] public function eval(Row $row, FlowContext $context) : bool { $string = (new Parameter($this->string))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/JsonDecode.php b/src/core/etl/src/Flow/ETL/Function/JsonDecode.php index 993280197..887739d14 100644 --- a/src/core/etl/src/Flow/ETL/Function/JsonDecode.php +++ b/src/core/etl/src/Flow/ETL/Function/JsonDecode.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $value = (new Parameter($this->value))->as($row, $context, type_string(), type_array()); @@ -30,7 +31,7 @@ public function eval(Row $row, FlowContext $context) : mixed } try { - return \json_decode(\is_scalar($value) ? (string) $value : '', true, 512, $flags); + return \json_decode(\is_scalar($value) ? $value : '', true, 512, $flags); } catch (\JsonException $e) { $context->functions()->invalidResult(new InvalidArgumentException('JsonDecode error: ' . $e->getMessage())); diff --git a/src/core/etl/src/Flow/ETL/Function/JsonEncode.php b/src/core/etl/src/Flow/ETL/Function/JsonEncode.php index 3e887b806..dbb6f0ef9 100644 --- a/src/core/etl/src/Flow/ETL/Function/JsonEncode.php +++ b/src/core/etl/src/Flow/ETL/Function/JsonEncode.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $value = (new Parameter($this->value))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Last.php b/src/core/etl/src/Flow/ETL/Function/Last.php index 808e82976..de3f52db6 100644 --- a/src/core/etl/src/Flow/ETL/Function/Last.php +++ b/src/core/etl/src/Flow/ETL/Function/Last.php @@ -22,6 +22,7 @@ public function __construct(private readonly Reference $ref) $this->last = null; } + #[\Override] public function aggregate(Row $row, FlowContext $context) : void { try { @@ -34,6 +35,7 @@ public function aggregate(Row $row, FlowContext $context) : void /** * @return Entry */ + #[\Override] public function result(EntryFactory $entryFactory) : Entry { $name = $this->ref->hasAlias() ? $this->ref->name() : $this->ref->name() . '_last'; diff --git a/src/core/etl/src/Flow/ETL/Function/Least.php b/src/core/etl/src/Flow/ETL/Function/Least.php index 6906bb9c1..ff2aac43b 100644 --- a/src/core/etl/src/Flow/ETL/Function/Least.php +++ b/src/core/etl/src/Flow/ETL/Function/Least.php @@ -18,6 +18,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $extractedValues = []; diff --git a/src/core/etl/src/Flow/ETL/Function/LessThan.php b/src/core/etl/src/Flow/ETL/Function/LessThan.php index 1d9896d96..7563de3b1 100644 --- a/src/core/etl/src/Flow/ETL/Function/LessThan.php +++ b/src/core/etl/src/Flow/ETL/Function/LessThan.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $left = (new Parameter($this->left))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/LessThanEqual.php b/src/core/etl/src/Flow/ETL/Function/LessThanEqual.php index 35e5ee665..ba1588d54 100644 --- a/src/core/etl/src/Flow/ETL/Function/LessThanEqual.php +++ b/src/core/etl/src/Flow/ETL/Function/LessThanEqual.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $left = (new Parameter($this->left))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/ListSelect.php b/src/core/etl/src/Flow/ETL/Function/ListSelect.php index d5e085742..e65b11491 100644 --- a/src/core/etl/src/Flow/ETL/Function/ListSelect.php +++ b/src/core/etl/src/Flow/ETL/Function/ListSelect.php @@ -25,6 +25,7 @@ public function __construct( /** * @return null|array> */ + #[\Override] public function eval(Row $row, FlowContext $context) : ?array { if (!$row->has($this->ref)) { diff --git a/src/core/etl/src/Flow/ETL/Function/Literal.php b/src/core/etl/src/Flow/ETL/Function/Literal.php index 8f2345699..ffea77050 100644 --- a/src/core/etl/src/Flow/ETL/Function/Literal.php +++ b/src/core/etl/src/Flow/ETL/Function/Literal.php @@ -13,6 +13,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { return $this->value; diff --git a/src/core/etl/src/Flow/ETL/Function/MatchCases.php b/src/core/etl/src/Flow/ETL/Function/MatchCases.php index 5395aab5e..01924ea10 100644 --- a/src/core/etl/src/Flow/ETL/Function/MatchCases.php +++ b/src/core/etl/src/Flow/ETL/Function/MatchCases.php @@ -19,6 +19,7 @@ public function __construct(private readonly array $cases, private readonly mixe } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { foreach ($this->cases as $condition) { diff --git a/src/core/etl/src/Flow/ETL/Function/MatchCases/MatchCondition.php b/src/core/etl/src/Flow/ETL/Function/MatchCases/MatchCondition.php index c9b415adf..55ec311bd 100644 --- a/src/core/etl/src/Flow/ETL/Function/MatchCases/MatchCondition.php +++ b/src/core/etl/src/Flow/ETL/Function/MatchCases/MatchCondition.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { return (new Parameter($this->then))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Max.php b/src/core/etl/src/Flow/ETL/Function/Max.php index 2a786b429..542ae9840 100644 --- a/src/core/etl/src/Flow/ETL/Function/Max.php +++ b/src/core/etl/src/Flow/ETL/Function/Max.php @@ -19,6 +19,7 @@ public function __construct(private readonly Reference $ref) $this->max = null; } + #[\Override] public function aggregate(Row $row, FlowContext $context) : void { try { @@ -46,6 +47,7 @@ public function aggregate(Row $row, FlowContext $context) : void /** * @return Entry|Entry|Entry */ + #[\Override] public function result(EntryFactory $entryFactory) : Entry { if (!$this->ref->hasAlias()) { diff --git a/src/core/etl/src/Flow/ETL/Function/Min.php b/src/core/etl/src/Flow/ETL/Function/Min.php index 228d0d806..de88e5edd 100644 --- a/src/core/etl/src/Flow/ETL/Function/Min.php +++ b/src/core/etl/src/Flow/ETL/Function/Min.php @@ -19,6 +19,7 @@ public function __construct(private readonly Reference $ref) $this->min = null; } + #[\Override] public function aggregate(Row $row, FlowContext $context) : void { try { @@ -46,6 +47,7 @@ public function aggregate(Row $row, FlowContext $context) : void /** * @return Entry|Entry|Entry */ + #[\Override] public function result(EntryFactory $entryFactory) : Entry { if (!$this->ref->hasAlias()) { diff --git a/src/core/etl/src/Flow/ETL/Function/Minus.php b/src/core/etl/src/Flow/ETL/Function/Minus.php index 8e59b29fa..c0a0c9de8 100644 --- a/src/core/etl/src/Flow/ETL/Function/Minus.php +++ b/src/core/etl/src/Flow/ETL/Function/Minus.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : int|float|null { $leftValue = (new Parameter($this->left))->asNumber($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Mod.php b/src/core/etl/src/Flow/ETL/Function/Mod.php index d2d2d6bcc..3ced63095 100644 --- a/src/core/etl/src/Flow/ETL/Function/Mod.php +++ b/src/core/etl/src/Flow/ETL/Function/Mod.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?int { $leftValue = (new Parameter($this->left))->asInt($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/ModifyDateTime.php b/src/core/etl/src/Flow/ETL/Function/ModifyDateTime.php index a29ffb43b..a84ba7f32 100644 --- a/src/core/etl/src/Flow/ETL/Function/ModifyDateTime.php +++ b/src/core/etl/src/Flow/ETL/Function/ModifyDateTime.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $value = (new Parameter($this->reference))->asInstanceOf($row, $context, \DateTimeInterface::class); diff --git a/src/core/etl/src/Flow/ETL/Function/Multiply.php b/src/core/etl/src/Flow/ETL/Function/Multiply.php index 1518ea12d..8c5ddd1da 100644 --- a/src/core/etl/src/Flow/ETL/Function/Multiply.php +++ b/src/core/etl/src/Flow/ETL/Function/Multiply.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : int|float|null { $leftValue = (new Parameter($this->left))->asNumber($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Not.php b/src/core/etl/src/Flow/ETL/Function/Not.php index 803d1ea37..190514bce 100644 --- a/src/core/etl/src/Flow/ETL/Function/Not.php +++ b/src/core/etl/src/Flow/ETL/Function/Not.php @@ -12,6 +12,7 @@ public function __construct(private readonly ScalarFunction $value) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { return !(new Parameter($this->value))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/NotEquals.php b/src/core/etl/src/Flow/ETL/Function/NotEquals.php index 9ff64cbab..5fee5c178 100644 --- a/src/core/etl/src/Flow/ETL/Function/NotEquals.php +++ b/src/core/etl/src/Flow/ETL/Function/NotEquals.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : bool { $left = (new Parameter($this->left))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/NotSame.php b/src/core/etl/src/Flow/ETL/Function/NotSame.php index b8ef6e8bc..e9d9d5940 100644 --- a/src/core/etl/src/Flow/ETL/Function/NotSame.php +++ b/src/core/etl/src/Flow/ETL/Function/NotSame.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : bool { $left = (new Parameter($this->left))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Now.php b/src/core/etl/src/Flow/ETL/Function/Now.php index 9e0e2b4aa..c1bf94a1c 100644 --- a/src/core/etl/src/Flow/ETL/Function/Now.php +++ b/src/core/etl/src/Flow/ETL/Function/Now.php @@ -13,6 +13,7 @@ public function __construct(private readonly ScalarFunction|\DateTimeZone $timeZ { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?\DateTimeImmutable { $tz = (new Parameter($this->timeZone))->asInstanceOf($row, $context, \DateTimeZone::class); diff --git a/src/core/etl/src/Flow/ETL/Function/NumberFormat.php b/src/core/etl/src/Flow/ETL/Function/NumberFormat.php index 52e0fac37..5925c3914 100644 --- a/src/core/etl/src/Flow/ETL/Function/NumberFormat.php +++ b/src/core/etl/src/Flow/ETL/Function/NumberFormat.php @@ -17,6 +17,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $value = (new Parameter($this->value))->asNumber($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/OnEach.php b/src/core/etl/src/Flow/ETL/Function/OnEach.php index 1e1665912..91888c856 100644 --- a/src/core/etl/src/Flow/ETL/Function/OnEach.php +++ b/src/core/etl/src/Flow/ETL/Function/OnEach.php @@ -22,6 +22,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $value = (new Parameter($this->array))->asArray($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Optional.php b/src/core/etl/src/Flow/ETL/Function/Optional.php index 4e9c06a97..7dd3ee259 100644 --- a/src/core/etl/src/Flow/ETL/Function/Optional.php +++ b/src/core/etl/src/Flow/ETL/Function/Optional.php @@ -12,6 +12,7 @@ public function __construct(private readonly ScalarFunction $function) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { try { diff --git a/src/core/etl/src/Flow/ETL/Function/Plus.php b/src/core/etl/src/Flow/ETL/Function/Plus.php index 4d398d518..e89b08c27 100644 --- a/src/core/etl/src/Flow/ETL/Function/Plus.php +++ b/src/core/etl/src/Flow/ETL/Function/Plus.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : int|float|null { $leftValue = (new Parameter($this->left))->asNumber($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Power.php b/src/core/etl/src/Flow/ETL/Function/Power.php index 7d1c0ad3f..18ad43165 100644 --- a/src/core/etl/src/Flow/ETL/Function/Power.php +++ b/src/core/etl/src/Flow/ETL/Function/Power.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : float|int|null { $leftValue = (new Parameter($this->left))->asNumber($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Prepend.php b/src/core/etl/src/Flow/ETL/Function/Prepend.php index e704d64d3..224424ff9 100644 --- a/src/core/etl/src/Flow/ETL/Function/Prepend.php +++ b/src/core/etl/src/Flow/ETL/Function/Prepend.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/RandomString.php b/src/core/etl/src/Flow/ETL/Function/RandomString.php index 58ccd4de5..324587917 100644 --- a/src/core/etl/src/Flow/ETL/Function/RandomString.php +++ b/src/core/etl/src/Flow/ETL/Function/RandomString.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $length = (new Parameter($this->length))->asInt($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Rank.php b/src/core/etl/src/Flow/ETL/Function/Rank.php index 710fd14f3..583805705 100644 --- a/src/core/etl/src/Flow/ETL/Function/Rank.php +++ b/src/core/etl/src/Flow/ETL/Function/Rank.php @@ -16,6 +16,7 @@ public function __construct() $this->window = null; } + #[\Override] public function apply(Row $row, Rows $partition, FlowContext $context) : mixed { $rank = 1; @@ -44,6 +45,7 @@ public function apply(Row $row, Rows $partition, FlowContext $context) : mixed return $rank; } + #[\Override] public function over(Window $window) : WindowFunction { $this->window = $window; @@ -51,11 +53,13 @@ public function over(Window $window) : WindowFunction return $this; } + #[\Override] public function toString() : string { return 'rank()'; } + #[\Override] public function window() : Window { if ($this->window === null) { diff --git a/src/core/etl/src/Flow/ETL/Function/Regex.php b/src/core/etl/src/Flow/ETL/Function/Regex.php index 3c0d992c4..0fb3cdede 100644 --- a/src/core/etl/src/Flow/ETL/Function/Regex.php +++ b/src/core/etl/src/Flow/ETL/Function/Regex.php @@ -27,6 +27,7 @@ public function __construct( /** * @return null|array */ + #[\Override] public function eval(Row $row, FlowContext $context) : ?array { $pattern = (new Parameter($this->pattern))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/RegexAll.php b/src/core/etl/src/Flow/ETL/Function/RegexAll.php index 41323a5d6..403d35bec 100644 --- a/src/core/etl/src/Flow/ETL/Function/RegexAll.php +++ b/src/core/etl/src/Flow/ETL/Function/RegexAll.php @@ -26,6 +26,7 @@ public function __construct( /** * @return null|array */ + #[\Override] public function eval(Row $row, FlowContext $context) : ?array { $pattern = (new Parameter($this->pattern))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/RegexMatch.php b/src/core/etl/src/Flow/ETL/Function/RegexMatch.php index 995e3b9c9..711f29162 100644 --- a/src/core/etl/src/Flow/ETL/Function/RegexMatch.php +++ b/src/core/etl/src/Flow/ETL/Function/RegexMatch.php @@ -23,6 +23,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?bool { $pattern = (new Parameter($this->pattern))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/RegexMatchAll.php b/src/core/etl/src/Flow/ETL/Function/RegexMatchAll.php index c7d8d3675..607354082 100644 --- a/src/core/etl/src/Flow/ETL/Function/RegexMatchAll.php +++ b/src/core/etl/src/Flow/ETL/Function/RegexMatchAll.php @@ -23,6 +23,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?bool { $pattern = (new Parameter($this->pattern))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/RegexReplace.php b/src/core/etl/src/Flow/ETL/Function/RegexReplace.php index 78be4483a..c59f72ab1 100644 --- a/src/core/etl/src/Flow/ETL/Function/RegexReplace.php +++ b/src/core/etl/src/Flow/ETL/Function/RegexReplace.php @@ -17,6 +17,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $pattern = (new Parameter($this->pattern))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Repeat.php b/src/core/etl/src/Flow/ETL/Function/Repeat.php index 3372e0490..dfa8dd0e1 100644 --- a/src/core/etl/src/Flow/ETL/Function/Repeat.php +++ b/src/core/etl/src/Flow/ETL/Function/Repeat.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Reverse.php b/src/core/etl/src/Flow/ETL/Function/Reverse.php index 7fafb5923..837c9d236 100644 --- a/src/core/etl/src/Flow/ETL/Function/Reverse.php +++ b/src/core/etl/src/Flow/ETL/Function/Reverse.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Round.php b/src/core/etl/src/Flow/ETL/Function/Round.php index bbc105149..3ef6acf49 100644 --- a/src/core/etl/src/Flow/ETL/Function/Round.php +++ b/src/core/etl/src/Flow/ETL/Function/Round.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : int|float|null { $value = (new Parameter($this->value))->asNumber($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/RowNumber.php b/src/core/etl/src/Flow/ETL/Function/RowNumber.php index 85ea409ef..af5ccedbf 100644 --- a/src/core/etl/src/Flow/ETL/Function/RowNumber.php +++ b/src/core/etl/src/Flow/ETL/Function/RowNumber.php @@ -16,6 +16,7 @@ public function __construct() $this->window = null; } + #[\Override] public function apply(Row $row, Rows $partition, FlowContext $context) : mixed { $number = 1; @@ -31,6 +32,7 @@ public function apply(Row $row, Rows $partition, FlowContext $context) : mixed return null; } + #[\Override] public function over(Window $window) : WindowFunction { $this->window = $window; @@ -38,11 +40,13 @@ public function over(Window $window) : WindowFunction return $this; } + #[\Override] public function toString() : string { return 'row_number()'; } + #[\Override] public function window() : Window { if ($this->window === null) { diff --git a/src/core/etl/src/Flow/ETL/Function/Same.php b/src/core/etl/src/Flow/ETL/Function/Same.php index 62a0d47d7..0a3c7d69a 100644 --- a/src/core/etl/src/Flow/ETL/Function/Same.php +++ b/src/core/etl/src/Flow/ETL/Function/Same.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : bool { $left = (new Parameter($this->left))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Sanitize.php b/src/core/etl/src/Flow/ETL/Function/Sanitize.php index 35029c08c..90226ce8c 100644 --- a/src/core/etl/src/Flow/ETL/Function/Sanitize.php +++ b/src/core/etl/src/Flow/ETL/Function/Sanitize.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $val = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/ScalarFunction/ExpandResults.php b/src/core/etl/src/Flow/ETL/Function/ScalarFunction/ExpandResults.php index ff430527d..b392dab96 100644 --- a/src/core/etl/src/Flow/ETL/Function/ScalarFunction/ExpandResults.php +++ b/src/core/etl/src/Flow/ETL/Function/ScalarFunction/ExpandResults.php @@ -11,5 +11,6 @@ interface ExpandResults extends ScalarFunction /** * @return array */ + #[\Override] public function eval(Row $row, FlowContext $context) : array; } diff --git a/src/core/etl/src/Flow/ETL/Function/ScalarFunction/UnpackResults.php b/src/core/etl/src/Flow/ETL/Function/ScalarFunction/UnpackResults.php index 07b920911..7340bc870 100644 --- a/src/core/etl/src/Flow/ETL/Function/ScalarFunction/UnpackResults.php +++ b/src/core/etl/src/Flow/ETL/Function/ScalarFunction/UnpackResults.php @@ -11,5 +11,6 @@ interface UnpackResults extends ScalarFunction /** * @return array */ + #[\Override] public function eval(Row $row, FlowContext $context) : array; } diff --git a/src/core/etl/src/Flow/ETL/Function/Size.php b/src/core/etl/src/Flow/ETL/Function/Size.php index 19742dfc3..d3748bb9e 100644 --- a/src/core/etl/src/Flow/ETL/Function/Size.php +++ b/src/core/etl/src/Flow/ETL/Function/Size.php @@ -14,6 +14,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?int { $value = (new Parameter($this->value))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Slug.php b/src/core/etl/src/Flow/ETL/Function/Slug.php index a0d474b7b..4b1da74cc 100644 --- a/src/core/etl/src/Flow/ETL/Function/Slug.php +++ b/src/core/etl/src/Flow/ETL/Function/Slug.php @@ -24,6 +24,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $string = (new Parameter($this->string))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Split.php b/src/core/etl/src/Flow/ETL/Function/Split.php index d73e9c6c2..f6b8b26cf 100644 --- a/src/core/etl/src/Flow/ETL/Function/Split.php +++ b/src/core/etl/src/Flow/ETL/Function/Split.php @@ -21,6 +21,7 @@ public function __construct( /** * @return null|array */ + #[\Override] public function eval(Row $row, FlowContext $context) : ?array { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Sprintf.php b/src/core/etl/src/Flow/ETL/Function/Sprintf.php index 7e7007e15..f1b8a08b3 100644 --- a/src/core/etl/src/Flow/ETL/Function/Sprintf.php +++ b/src/core/etl/src/Flow/ETL/Function/Sprintf.php @@ -21,6 +21,7 @@ public function __construct( $this->values = $values; } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $format = (new Parameter($this->format))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/StartsWith.php b/src/core/etl/src/Flow/ETL/Function/StartsWith.php index d7830bcae..d6222caab 100644 --- a/src/core/etl/src/Flow/ETL/Function/StartsWith.php +++ b/src/core/etl/src/Flow/ETL/Function/StartsWith.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : bool { $haystack = (new Parameter($this->haystack))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/StrPad.php b/src/core/etl/src/Flow/ETL/Function/StrPad.php index add26273c..1f68a2838 100644 --- a/src/core/etl/src/Flow/ETL/Function/StrPad.php +++ b/src/core/etl/src/Flow/ETL/Function/StrPad.php @@ -17,6 +17,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/StrReplace.php b/src/core/etl/src/Flow/ETL/Function/StrReplace.php index 87b6621d5..7283afc9a 100644 --- a/src/core/etl/src/Flow/ETL/Function/StrReplace.php +++ b/src/core/etl/src/Flow/ETL/Function/StrReplace.php @@ -22,6 +22,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/StringAfter.php b/src/core/etl/src/Flow/ETL/Function/StringAfter.php index 0a0cee45d..5d408bdf8 100644 --- a/src/core/etl/src/Flow/ETL/Function/StringAfter.php +++ b/src/core/etl/src/Flow/ETL/Function/StringAfter.php @@ -18,6 +18,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $string = (new Parameter($this->string))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/StringAfterLast.php b/src/core/etl/src/Flow/ETL/Function/StringAfterLast.php index ba81a53c2..8f1ca3e6a 100644 --- a/src/core/etl/src/Flow/ETL/Function/StringAfterLast.php +++ b/src/core/etl/src/Flow/ETL/Function/StringAfterLast.php @@ -18,6 +18,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $string = (new Parameter($this->string))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/StringAggregate.php b/src/core/etl/src/Flow/ETL/Function/StringAggregate.php index 10c6f2fb9..4ca7c3b56 100644 --- a/src/core/etl/src/Flow/ETL/Function/StringAggregate.php +++ b/src/core/etl/src/Flow/ETL/Function/StringAggregate.php @@ -20,6 +20,7 @@ public function __construct(private readonly Reference $ref, private readonly st { } + #[\Override] public function aggregate(Row $row, FlowContext $context) : void { $stringValue = $row->valueOf($this->ref->to()); @@ -32,6 +33,7 @@ public function aggregate(Row $row, FlowContext $context) : void /** * @return Row\Entry */ + #[\Override] public function result(EntryFactory $entryFactory) : Entry { if (!$this->ref->hasAlias()) { diff --git a/src/core/etl/src/Flow/ETL/Function/StringBefore.php b/src/core/etl/src/Flow/ETL/Function/StringBefore.php index 66761dca5..12237c56b 100644 --- a/src/core/etl/src/Flow/ETL/Function/StringBefore.php +++ b/src/core/etl/src/Flow/ETL/Function/StringBefore.php @@ -18,6 +18,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $string = (new Parameter($this->string))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/StringBeforeLast.php b/src/core/etl/src/Flow/ETL/Function/StringBeforeLast.php index 100acc2ec..64a807fe4 100644 --- a/src/core/etl/src/Flow/ETL/Function/StringBeforeLast.php +++ b/src/core/etl/src/Flow/ETL/Function/StringBeforeLast.php @@ -18,6 +18,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $string = (new Parameter($this->string))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/StringContainsAny.php b/src/core/etl/src/Flow/ETL/Function/StringContainsAny.php index 50983766a..f7852cc36 100644 --- a/src/core/etl/src/Flow/ETL/Function/StringContainsAny.php +++ b/src/core/etl/src/Flow/ETL/Function/StringContainsAny.php @@ -21,6 +21,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : bool { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/StringEqualsTo.php b/src/core/etl/src/Flow/ETL/Function/StringEqualsTo.php index 8f5888543..73e97b43b 100644 --- a/src/core/etl/src/Flow/ETL/Function/StringEqualsTo.php +++ b/src/core/etl/src/Flow/ETL/Function/StringEqualsTo.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?bool { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/StringFold.php b/src/core/etl/src/Flow/ETL/Function/StringFold.php index 0fa48a368..cb63b443d 100644 --- a/src/core/etl/src/Flow/ETL/Function/StringFold.php +++ b/src/core/etl/src/Flow/ETL/Function/StringFold.php @@ -14,6 +14,7 @@ public function __construct(private readonly ScalarFunction|string $string) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $string = (new Parameter($this->string))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/StringMatch.php b/src/core/etl/src/Flow/ETL/Function/StringMatch.php index 53d9b4739..c13b2af08 100644 --- a/src/core/etl/src/Flow/ETL/Function/StringMatch.php +++ b/src/core/etl/src/Flow/ETL/Function/StringMatch.php @@ -19,6 +19,7 @@ public function __construct( /** * @return null|array */ + #[\Override] public function eval(Row $row, FlowContext $context) : ?array { $haystack = (new Parameter($this->haystack))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/StringMatchAll.php b/src/core/etl/src/Flow/ETL/Function/StringMatchAll.php index 08cafee94..d5dbdd0c5 100644 --- a/src/core/etl/src/Flow/ETL/Function/StringMatchAll.php +++ b/src/core/etl/src/Flow/ETL/Function/StringMatchAll.php @@ -18,6 +18,7 @@ public function __construct( /** * @return null|array> */ + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $haystack = (new Parameter($this->haystack))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/StringNormalize.php b/src/core/etl/src/Flow/ETL/Function/StringNormalize.php index 29ccb0031..edb96cfc9 100644 --- a/src/core/etl/src/Flow/ETL/Function/StringNormalize.php +++ b/src/core/etl/src/Flow/ETL/Function/StringNormalize.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/StringStyle.php b/src/core/etl/src/Flow/ETL/Function/StringStyle.php index 4ad4f45cb..17d9f09a8 100644 --- a/src/core/etl/src/Flow/ETL/Function/StringStyle.php +++ b/src/core/etl/src/Flow/ETL/Function/StringStyle.php @@ -18,6 +18,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $string = (new Parameter($this->string))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/StringTitle.php b/src/core/etl/src/Flow/ETL/Function/StringTitle.php index f4c5441e4..5e6c9b505 100644 --- a/src/core/etl/src/Flow/ETL/Function/StringTitle.php +++ b/src/core/etl/src/Flow/ETL/Function/StringTitle.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $string = (new Parameter($this->string))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/StringWidth.php b/src/core/etl/src/Flow/ETL/Function/StringWidth.php index c6fb212f5..ad53deccd 100644 --- a/src/core/etl/src/Flow/ETL/Function/StringWidth.php +++ b/src/core/etl/src/Flow/ETL/Function/StringWidth.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?int { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/StructureSelect.php b/src/core/etl/src/Flow/ETL/Function/StructureSelect.php index 2ab153d78..e2c34cfcf 100644 --- a/src/core/etl/src/Flow/ETL/Function/StructureSelect.php +++ b/src/core/etl/src/Flow/ETL/Function/StructureSelect.php @@ -25,6 +25,7 @@ public function __construct( /** * @return null|array */ + #[\Override] public function eval(Row $row, FlowContext $context) : ?array { if (!$row->has($this->ref)) { diff --git a/src/core/etl/src/Flow/ETL/Function/Sum.php b/src/core/etl/src/Flow/ETL/Function/Sum.php index 2437f48a9..ba4ade44e 100644 --- a/src/core/etl/src/Flow/ETL/Function/Sum.php +++ b/src/core/etl/src/Flow/ETL/Function/Sum.php @@ -23,6 +23,7 @@ public function __construct(private readonly Reference $ref) $this->window = null; } + #[\Override] public function aggregate(Row $row, FlowContext $context) : void { try { @@ -38,6 +39,7 @@ public function aggregate(Row $row, FlowContext $context) : void } } + #[\Override] public function apply(Row $row, Rows $partition, FlowContext $context) : mixed { $sum = 0; @@ -58,6 +60,7 @@ public function apply(Row $row, Rows $partition, FlowContext $context) : mixed return $sum; } + #[\Override] public function over(Window $window) : WindowFunction { $this->window = $window; @@ -68,6 +71,7 @@ public function over(Window $window) : WindowFunction /** * @return Entry|Entry */ + #[\Override] public function result(EntryFactory $entryFactory) : Entry { if (!$this->ref->hasAlias()) { @@ -81,11 +85,13 @@ public function result(EntryFactory $entryFactory) : Entry return float_entry($this->ref->name(), $this->sum); } + #[\Override] public function toString() : string { return 'sum()'; } + #[\Override] public function window() : Window { if ($this->window === null) { diff --git a/src/core/etl/src/Flow/ETL/Function/ToDate.php b/src/core/etl/src/Flow/ETL/Function/ToDate.php index ea0292434..d6d9265b7 100644 --- a/src/core/etl/src/Flow/ETL/Function/ToDate.php +++ b/src/core/etl/src/Flow/ETL/Function/ToDate.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?\DateTimeInterface { $value = (new Parameter($this->value))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/ToDateTime.php b/src/core/etl/src/Flow/ETL/Function/ToDateTime.php index ab780c9e6..0d40f3c00 100644 --- a/src/core/etl/src/Flow/ETL/Function/ToDateTime.php +++ b/src/core/etl/src/Flow/ETL/Function/ToDateTime.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : \DateTimeImmutable|false|null { $value = (new Parameter($this->value))->eval($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/ToLower.php b/src/core/etl/src/Flow/ETL/Function/ToLower.php index 48e2d7659..68d6b77c0 100644 --- a/src/core/etl/src/Flow/ETL/Function/ToLower.php +++ b/src/core/etl/src/Flow/ETL/Function/ToLower.php @@ -14,6 +14,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/ToTimeZone.php b/src/core/etl/src/Flow/ETL/Function/ToTimeZone.php index c956e9f60..d9722ec1b 100644 --- a/src/core/etl/src/Flow/ETL/Function/ToTimeZone.php +++ b/src/core/etl/src/Flow/ETL/Function/ToTimeZone.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $dateTime = (new Parameter($this->value))->asInstanceOf($row, $context, \DateTimeInterface::class); diff --git a/src/core/etl/src/Flow/ETL/Function/ToUpper.php b/src/core/etl/src/Flow/ETL/Function/ToUpper.php index 20ebce904..3b9ce1a4f 100644 --- a/src/core/etl/src/Flow/ETL/Function/ToUpper.php +++ b/src/core/etl/src/Flow/ETL/Function/ToUpper.php @@ -13,6 +13,7 @@ public function __construct(private readonly ScalarFunction|string $value) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Trim.php b/src/core/etl/src/Flow/ETL/Function/Trim.php index 0dea624b9..56e480bdd 100644 --- a/src/core/etl/src/Flow/ETL/Function/Trim.php +++ b/src/core/etl/src/Flow/ETL/Function/Trim.php @@ -17,6 +17,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Truncate.php b/src/core/etl/src/Flow/ETL/Function/Truncate.php index fbda73d35..36fc0cf67 100644 --- a/src/core/etl/src/Flow/ETL/Function/Truncate.php +++ b/src/core/etl/src/Flow/ETL/Function/Truncate.php @@ -17,6 +17,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Ulid.php b/src/core/etl/src/Flow/ETL/Function/Ulid.php index 49b87b841..f6a19b91b 100644 --- a/src/core/etl/src/Flow/ETL/Function/Ulid.php +++ b/src/core/etl/src/Flow/ETL/Function/Ulid.php @@ -17,6 +17,7 @@ public function __construct(private readonly ScalarFunction|string|null $ref = n { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $param = (new Parameter($this->ref))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/UnicodeLength.php b/src/core/etl/src/Flow/ETL/Function/UnicodeLength.php index 040bb3c88..7e18e49a4 100644 --- a/src/core/etl/src/Flow/ETL/Function/UnicodeLength.php +++ b/src/core/etl/src/Flow/ETL/Function/UnicodeLength.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?int { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Uuid.php b/src/core/etl/src/Flow/ETL/Function/Uuid.php index 8fb2f83e4..cc86a98a3 100644 --- a/src/core/etl/src/Flow/ETL/Function/Uuid.php +++ b/src/core/etl/src/Flow/ETL/Function/Uuid.php @@ -34,6 +34,7 @@ public static function uuid7(ScalarFunction|\DateTimeInterface|null $value = nul return new self('uuid7', $value); } + #[\Override] public function eval(Row $row, FlowContext $context) : ScalarResult { $param = (new Parameter($this->value))->as($row, $context, type_string(), type_instance_of(\DateTimeInterface::class)); diff --git a/src/core/etl/src/Flow/ETL/Function/When.php b/src/core/etl/src/Flow/ETL/Function/When.php index a308f9b8a..cecd7b214 100644 --- a/src/core/etl/src/Flow/ETL/Function/When.php +++ b/src/core/etl/src/Flow/ETL/Function/When.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { $condition = (new Parameter($this->condition))->asBoolean($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/Wordwrap.php b/src/core/etl/src/Flow/ETL/Function/Wordwrap.php index 8d4109bda..19065cc40 100644 --- a/src/core/etl/src/Flow/ETL/Function/Wordwrap.php +++ b/src/core/etl/src/Flow/ETL/Function/Wordwrap.php @@ -19,6 +19,7 @@ public function __construct( ) { } + #[\Override] public function eval(Row $row, FlowContext $context) : ?string { $value = (new Parameter($this->value))->asString($row, $context); diff --git a/src/core/etl/src/Flow/ETL/Function/XPath.php b/src/core/etl/src/Flow/ETL/Function/XPath.php index 44108c52e..c68af3f5f 100644 --- a/src/core/etl/src/Flow/ETL/Function/XPath.php +++ b/src/core/etl/src/Flow/ETL/Function/XPath.php @@ -18,6 +18,7 @@ public function __construct( /** * @return null|array<\DOMNode> */ + #[\Override] public function eval(Row $row, FlowContext $context) : ?array { $value = (new Parameter($this->value))->asInstanceOf($row, $context, \DOMNode::class); diff --git a/src/core/etl/src/Flow/ETL/Hash/NativePHPHash.php b/src/core/etl/src/Flow/ETL/Hash/NativePHPHash.php index 0404b758f..2aee61632 100644 --- a/src/core/etl/src/Flow/ETL/Hash/NativePHPHash.php +++ b/src/core/etl/src/Flow/ETL/Hash/NativePHPHash.php @@ -21,6 +21,7 @@ public static function xxh128(string $string) : string return (new self('xxh128'))->hash($string); } + #[\Override] public function hash(string $value) : string { return \hash($this->algorithm, $value, $this->binary, $this->options); diff --git a/src/core/etl/src/Flow/ETL/Hash/PlainText.php b/src/core/etl/src/Flow/ETL/Hash/PlainText.php index a96a94952..1f6dc466c 100644 --- a/src/core/etl/src/Flow/ETL/Hash/PlainText.php +++ b/src/core/etl/src/Flow/ETL/Hash/PlainText.php @@ -6,6 +6,7 @@ final class PlainText implements Algorithm { + #[\Override] public function hash(string $value) : string { return $value; diff --git a/src/core/etl/src/Flow/ETL/Join/Comparison/All.php b/src/core/etl/src/Flow/ETL/Join/Comparison/All.php index f80febba6..451dfcf4a 100644 --- a/src/core/etl/src/Flow/ETL/Join/Comparison/All.php +++ b/src/core/etl/src/Flow/ETL/Join/Comparison/All.php @@ -20,6 +20,7 @@ public function __construct(Comparison $comparison, Comparison ...$comparisons) $this->comparisons = \array_merge([$comparison], $comparisons); } + #[\Override] public function compare(Row $left, Row $right) : bool { foreach ($this->comparisons as $comparison) { @@ -34,6 +35,7 @@ public function compare(Row $left, Row $right) : bool /** * @return array */ + #[\Override] public function left() : array { $entries = []; @@ -48,6 +50,7 @@ public function left() : array /** * @return array */ + #[\Override] public function right() : array { $entries = []; diff --git a/src/core/etl/src/Flow/ETL/Join/Comparison/Any.php b/src/core/etl/src/Flow/ETL/Join/Comparison/Any.php index f86f16c86..bb52fd756 100644 --- a/src/core/etl/src/Flow/ETL/Join/Comparison/Any.php +++ b/src/core/etl/src/Flow/ETL/Join/Comparison/Any.php @@ -20,6 +20,7 @@ public function __construct(Comparison $comparison, Comparison ...$comparisons) $this->comparisons = \array_merge([$comparison], $comparisons); } + #[\Override] public function compare(Row $left, Row $right) : bool { foreach ($this->comparisons as $comparison) { @@ -34,6 +35,7 @@ public function compare(Row $left, Row $right) : bool /** * @return array */ + #[\Override] public function left() : array { $entries = []; @@ -48,6 +50,7 @@ public function left() : array /** * @return array */ + #[\Override] public function right() : array { $entries = []; diff --git a/src/core/etl/src/Flow/ETL/Join/Comparison/Equal.php b/src/core/etl/src/Flow/ETL/Join/Comparison/Equal.php index 49295f50b..afe06b363 100644 --- a/src/core/etl/src/Flow/ETL/Join/Comparison/Equal.php +++ b/src/core/etl/src/Flow/ETL/Join/Comparison/Equal.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function compare(Row $left, Row $right) : bool { return $left->valueOf($this->entryLeft) == $right->valueOf($this->entryRight); @@ -24,6 +25,7 @@ public function compare(Row $left, Row $right) : bool /** * @return array */ + #[\Override] public function left() : array { return [\is_string($this->entryLeft) ? EntryReference::init($this->entryLeft) : $this->entryLeft]; @@ -32,6 +34,7 @@ public function left() : array /** * @return array */ + #[\Override] public function right() : array { return [\is_string($this->entryRight) ? EntryReference::init($this->entryRight) : $this->entryRight]; diff --git a/src/core/etl/src/Flow/ETL/Join/Comparison/Identical.php b/src/core/etl/src/Flow/ETL/Join/Comparison/Identical.php index e13ecd2dc..ea67e1695 100644 --- a/src/core/etl/src/Flow/ETL/Join/Comparison/Identical.php +++ b/src/core/etl/src/Flow/ETL/Join/Comparison/Identical.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function compare(Row $left, Row $right) : bool { return $left->valueOf($this->entryLeft) === $right->valueOf($this->entryRight); @@ -24,6 +25,7 @@ public function compare(Row $left, Row $right) : bool /** * @return array */ + #[\Override] public function left() : array { return [\is_string($this->entryLeft) ? EntryReference::init($this->entryLeft) : $this->entryLeft]; @@ -32,6 +34,7 @@ public function left() : array /** * @return array */ + #[\Override] public function right() : array { return [\is_string($this->entryRight) ? EntryReference::init($this->entryRight) : $this->entryRight]; diff --git a/src/core/etl/src/Flow/ETL/Loader/ArrayLoader.php b/src/core/etl/src/Flow/ETL/Loader/ArrayLoader.php index 5d1516f7b..5b2bba93b 100644 --- a/src/core/etl/src/Flow/ETL/Loader/ArrayLoader.php +++ b/src/core/etl/src/Flow/ETL/Loader/ArrayLoader.php @@ -15,6 +15,7 @@ public function __construct(private array &$array) { } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { $this->array = \array_merge( diff --git a/src/core/etl/src/Flow/ETL/Loader/BranchingLoader.php b/src/core/etl/src/Flow/ETL/Loader/BranchingLoader.php index d932dec54..e52989f65 100644 --- a/src/core/etl/src/Flow/ETL/Loader/BranchingLoader.php +++ b/src/core/etl/src/Flow/ETL/Loader/BranchingLoader.php @@ -19,6 +19,7 @@ public function __construct( ) { } + #[\Override] public function closure(FlowContext $context) : void { if ($this->loader instanceof Closure) { @@ -26,6 +27,7 @@ public function closure(FlowContext $context) : void } } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { $rows = (new ScalarFunctionFilterTransformer($this->condition))->transform($rows, $context); @@ -43,6 +45,7 @@ public function load(Rows $rows, FlowContext $context) : void ); } + #[\Override] public function loaders() : array { return [ diff --git a/src/core/etl/src/Flow/ETL/Loader/CallbackLoader.php b/src/core/etl/src/Flow/ETL/Loader/CallbackLoader.php index d3032ce6b..22697a9ee 100644 --- a/src/core/etl/src/Flow/ETL/Loader/CallbackLoader.php +++ b/src/core/etl/src/Flow/ETL/Loader/CallbackLoader.php @@ -20,6 +20,7 @@ public function __construct(callable $callback) $this->callback = $callback; } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { ($this->callback)($rows, $context); diff --git a/src/core/etl/src/Flow/ETL/Loader/MemoryLoader.php b/src/core/etl/src/Flow/ETL/Loader/MemoryLoader.php index d8207e6b6..d0d94cd7d 100644 --- a/src/core/etl/src/Flow/ETL/Loader/MemoryLoader.php +++ b/src/core/etl/src/Flow/ETL/Loader/MemoryLoader.php @@ -13,6 +13,7 @@ public function __construct(private Memory $memory) { } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { $this->memory->save($rows->toArray()); diff --git a/src/core/etl/src/Flow/ETL/Loader/RetryLoader.php b/src/core/etl/src/Flow/ETL/Loader/RetryLoader.php index 5f1d695f0..699cf2604 100644 --- a/src/core/etl/src/Flow/ETL/Loader/RetryLoader.php +++ b/src/core/etl/src/Flow/ETL/Loader/RetryLoader.php @@ -20,6 +20,7 @@ public function __construct( ) { } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { $attemptNumber = 0; diff --git a/src/core/etl/src/Flow/ETL/Loader/SchemaValidationLoader.php b/src/core/etl/src/Flow/ETL/Loader/SchemaValidationLoader.php index 3561d6a0e..ca124c4ce 100644 --- a/src/core/etl/src/Flow/ETL/Loader/SchemaValidationLoader.php +++ b/src/core/etl/src/Flow/ETL/Loader/SchemaValidationLoader.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { $given = $rows->schema(); diff --git a/src/core/etl/src/Flow/ETL/Loader/StreamLoader.php b/src/core/etl/src/Flow/ETL/Loader/StreamLoader.php index cb8b54944..8ab605a96 100644 --- a/src/core/etl/src/Flow/ETL/Loader/StreamLoader.php +++ b/src/core/etl/src/Flow/ETL/Loader/StreamLoader.php @@ -53,11 +53,13 @@ public static function stdout(int|bool $truncate = 20, Output $output = Output:: return new self('php://stdout', Mode::WRITE, $truncate, $output, $formatter, $schemaFormatter, Type::stdout); } + #[\Override] public function closure(FlowContext $context) : void { $this->closeStream(); } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { $stream = $this->getStream(); diff --git a/src/core/etl/src/Flow/ETL/Loader/TransformerLoader.php b/src/core/etl/src/Flow/ETL/Loader/TransformerLoader.php index 1d8433cca..19cf169d4 100644 --- a/src/core/etl/src/Flow/ETL/Loader/TransformerLoader.php +++ b/src/core/etl/src/Flow/ETL/Loader/TransformerLoader.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function closure(FlowContext $context) : void { if ($this->loader instanceof Closure) { @@ -22,6 +23,7 @@ public function closure(FlowContext $context) : void } } + #[\Override] public function load(Rows $rows, FlowContext $context) : void { if ($this->transformer instanceof Transformer) { @@ -33,6 +35,7 @@ public function load(Rows $rows, FlowContext $context) : void $this->loader->load($rows, $context); } + #[\Override] public function loaders() : array { return [$this->loader]; diff --git a/src/core/etl/src/Flow/ETL/Memory/ArrayMemory.php b/src/core/etl/src/Flow/ETL/Memory/ArrayMemory.php index 2a59ce4c2..9e51f79f0 100644 --- a/src/core/etl/src/Flow/ETL/Memory/ArrayMemory.php +++ b/src/core/etl/src/Flow/ETL/Memory/ArrayMemory.php @@ -22,6 +22,7 @@ public function __construct(private array $memory = []) /** * @return array */ + #[\Override] public function chunks(int $size) : array { if ($size < 1) { @@ -37,6 +38,7 @@ public function chunks(int $size) : array return $chunks; } + #[\Override] public function count() : int { return \count($this->memory); @@ -47,6 +49,7 @@ public function count() : int * * @return array> */ + #[\Override] public function dump() : array { return $this->memory; @@ -60,6 +63,7 @@ public function dump() : array * * @return array */ + #[\Override] public function flatValues() : array { $data = []; @@ -76,6 +80,7 @@ public function flatValues() : array * * @return array */ + #[\Override] public function map(callable $callback) : array { $data = []; @@ -90,6 +95,7 @@ public function map(callable $callback) : array /** * @param array> $data */ + #[\Override] public function save(array $data) : void { $this->assertMemoryStructure($data); diff --git a/src/core/etl/src/Flow/ETL/NativePHPRandomValueGenerator.php b/src/core/etl/src/Flow/ETL/NativePHPRandomValueGenerator.php index 50f809331..9a94fa283 100644 --- a/src/core/etl/src/Flow/ETL/NativePHPRandomValueGenerator.php +++ b/src/core/etl/src/Flow/ETL/NativePHPRandomValueGenerator.php @@ -6,11 +6,13 @@ final class NativePHPRandomValueGenerator implements RandomValueGenerator { + #[\Override] public function int(int $min, int $max) : int { return \random_int($min, $max); } + #[\Override] public function string(int $int) : string { $bytes = (int) \ceil($int / 2); diff --git a/src/core/etl/src/Flow/ETL/Pipeline/BatchingByPipeline.php b/src/core/etl/src/Flow/ETL/Pipeline/BatchingByPipeline.php index 0153a510e..7ce401ed2 100644 --- a/src/core/etl/src/Flow/ETL/Pipeline/BatchingByPipeline.php +++ b/src/core/etl/src/Flow/ETL/Pipeline/BatchingByPipeline.php @@ -26,6 +26,7 @@ public function __construct( } } + #[\Override] public function add(Loader|Transformer $pipe) : self { $this->pipeline->add($pipe); @@ -33,16 +34,19 @@ public function add(Loader|Transformer $pipe) : self return $this; } + #[\Override] public function has(string $transformerClass) : bool { return $this->pipeline->has($transformerClass); } + #[\Override] public function pipelines() : array { return [$this->pipeline]; } + #[\Override] public function pipes() : Pipes { return $this->pipeline->pipes(); @@ -51,11 +55,13 @@ public function pipes() : Pipes /** * @return \Generator */ + #[\Override] public function process(FlowContext $context) : \Generator { return batched_by(from_pipeline($this->pipeline), $this->column, $this->minSize)->extract($context); } + #[\Override] public function source() : Extractor { return $this->pipeline->source(); diff --git a/src/core/etl/src/Flow/ETL/Pipeline/BatchingPipeline.php b/src/core/etl/src/Flow/ETL/Pipeline/BatchingPipeline.php index bc643ff34..6fbc725b8 100644 --- a/src/core/etl/src/Flow/ETL/Pipeline/BatchingPipeline.php +++ b/src/core/etl/src/Flow/ETL/Pipeline/BatchingPipeline.php @@ -23,6 +23,7 @@ public function __construct(private Pipeline $pipeline, private int $size) } } + #[\Override] public function add(Loader|Transformer $pipe) : self { $this->pipeline->add($pipe); @@ -30,16 +31,19 @@ public function add(Loader|Transformer $pipe) : self return $this; } + #[\Override] public function has(string $transformerClass) : bool { return $this->pipeline->has($transformerClass); } + #[\Override] public function pipelines() : array { return [$this->pipeline]; } + #[\Override] public function pipes() : Pipes { return $this->pipeline->pipes(); @@ -48,11 +52,13 @@ public function pipes() : Pipes /** * @return \Generator */ + #[\Override] public function process(FlowContext $context) : \Generator { return batches(from_pipeline($this->pipeline), $this->size)->extract($context); } + #[\Override] public function source() : Extractor { return $this->pipeline->source(); diff --git a/src/core/etl/src/Flow/ETL/Pipeline/CachingPipeline.php b/src/core/etl/src/Flow/ETL/Pipeline/CachingPipeline.php index 51b81ff2c..725407780 100644 --- a/src/core/etl/src/Flow/ETL/Pipeline/CachingPipeline.php +++ b/src/core/etl/src/Flow/ETL/Pipeline/CachingPipeline.php @@ -12,6 +12,7 @@ public function __construct(private Pipeline $pipeline, private ?string $id = nu { } + #[\Override] public function add(Loader|Transformer $pipe) : Pipeline { $this->pipeline->add($pipe); @@ -19,21 +20,25 @@ public function add(Loader|Transformer $pipe) : Pipeline return $this; } + #[\Override] public function has(string $transformerClass) : bool { return $this->pipeline->has($transformerClass); } + #[\Override] public function pipelines() : array { return [$this->pipeline]; } + #[\Override] public function pipes() : Pipes { return $this->pipeline->pipes(); } + #[\Override] public function process(FlowContext $context) : \Generator { $id = $this->id ?: $context->config->id(); @@ -60,6 +65,7 @@ public function process(FlowContext $context) : \Generator $context->cache()->set($id, $index); } + #[\Override] public function source() : Extractor { return $this->pipeline->source(); diff --git a/src/core/etl/src/Flow/ETL/Pipeline/CollectingPipeline.php b/src/core/etl/src/Flow/ETL/Pipeline/CollectingPipeline.php index c7952c010..49fc50b5c 100644 --- a/src/core/etl/src/Flow/ETL/Pipeline/CollectingPipeline.php +++ b/src/core/etl/src/Flow/ETL/Pipeline/CollectingPipeline.php @@ -15,6 +15,7 @@ public function __construct(private Pipeline $pipeline) { } + #[\Override] public function add(Loader|Transformer $pipe) : self { $this->pipeline->add($pipe); @@ -22,21 +23,25 @@ public function add(Loader|Transformer $pipe) : self return $this; } + #[\Override] public function has(string $transformerClass) : bool { return $this->pipeline->has($transformerClass); } + #[\Override] public function pipelines() : array { return [$this->pipeline]; } + #[\Override] public function pipes() : Pipes { return $this->pipeline->pipes(); } + #[\Override] public function process(FlowContext $context) : \Generator { $rows = new Rows(); @@ -48,6 +53,7 @@ public function process(FlowContext $context) : \Generator yield $rows; } + #[\Override] public function source() : Extractor { return $this->pipeline->source(); diff --git a/src/core/etl/src/Flow/ETL/Pipeline/ConstrainedPipeline.php b/src/core/etl/src/Flow/ETL/Pipeline/ConstrainedPipeline.php index 3785ae1aa..74a9c5534 100644 --- a/src/core/etl/src/Flow/ETL/Pipeline/ConstrainedPipeline.php +++ b/src/core/etl/src/Flow/ETL/Pipeline/ConstrainedPipeline.php @@ -26,6 +26,7 @@ public function __construct(private readonly Pipeline $pipeline, private readonl } } + #[\Override] public function add(Loader|Transformer $pipe) : self { $this->pipeline->add($pipe); @@ -33,6 +34,7 @@ public function add(Loader|Transformer $pipe) : self return $this; } + #[\Override] public function has(string $transformerClass) : bool { return $this->pipeline->has($transformerClass); @@ -41,16 +43,19 @@ public function has(string $transformerClass) : bool /** * @return array */ + #[\Override] public function pipelines() : array { return [$this->pipeline]; } + #[\Override] public function pipes() : Pipes { return $this->pipeline->pipes(); } + #[\Override] public function process(FlowContext $context) : \Generator { foreach ($this->pipeline->process($context) as $rows) { @@ -72,6 +77,7 @@ public function process(FlowContext $context) : \Generator } } + #[\Override] public function source() : Extractor { return $this->pipeline->source(); diff --git a/src/core/etl/src/Flow/ETL/Pipeline/GroupByPipeline.php b/src/core/etl/src/Flow/ETL/Pipeline/GroupByPipeline.php index 49f03e794..12ae42cb2 100644 --- a/src/core/etl/src/Flow/ETL/Pipeline/GroupByPipeline.php +++ b/src/core/etl/src/Flow/ETL/Pipeline/GroupByPipeline.php @@ -12,6 +12,7 @@ public function __construct(public GroupBy $groupBy, private Pipeline $pipeline) { } + #[\Override] public function add(Loader|Transformer $pipe) : self { $this->pipeline->add($pipe); @@ -19,21 +20,25 @@ public function add(Loader|Transformer $pipe) : self return $this; } + #[\Override] public function has(string $transformerClass) : bool { return $this->pipeline->has($transformerClass); } + #[\Override] public function pipelines() : array { return [$this->pipeline]; } + #[\Override] public function pipes() : Pipes { return $this->pipeline->pipes(); } + #[\Override] public function process(FlowContext $context) : \Generator { foreach ($this->pipeline->process($context) as $nextRows) { @@ -43,6 +48,7 @@ public function process(FlowContext $context) : \Generator yield $this->groupBy->result($context); } + #[\Override] public function source() : Extractor { return $this->pipeline->source(); diff --git a/src/core/etl/src/Flow/ETL/Pipeline/HashJoin/Bucket.php b/src/core/etl/src/Flow/ETL/Pipeline/HashJoin/Bucket.php index 7535029e0..a906a75ad 100644 --- a/src/core/etl/src/Flow/ETL/Pipeline/HashJoin/Bucket.php +++ b/src/core/etl/src/Flow/ETL/Pipeline/HashJoin/Bucket.php @@ -38,6 +38,7 @@ public function add(Row $row) : void $this->rows = null; } + #[\Override] public function count() : int { return \count($this->rowsArray); diff --git a/src/core/etl/src/Flow/ETL/Pipeline/HashJoinPipeline.php b/src/core/etl/src/Flow/ETL/Pipeline/HashJoinPipeline.php index 6d77abf73..246b342b0 100644 --- a/src/core/etl/src/Flow/ETL/Pipeline/HashJoinPipeline.php +++ b/src/core/etl/src/Flow/ETL/Pipeline/HashJoinPipeline.php @@ -26,6 +26,7 @@ public function __construct( $this->extractor = from_rows(rows()); } + #[\Override] public function add(Loader|Transformer $pipe) : Pipeline { $this->left->add($pipe); @@ -33,21 +34,25 @@ public function add(Loader|Transformer $pipe) : Pipeline return $this; } + #[\Override] public function has(string $transformerClass) : bool { return $this->left->has($transformerClass); } + #[\Override] public function pipelines() : array { return [$this->left]; } + #[\Override] public function pipes() : Pipes { return $this->left->pipes(); } + #[\Override] public function process(FlowContext $context) : \Generator { $leftReferences = refs(...$this->expression->left()); @@ -119,6 +124,7 @@ public function process(FlowContext $context) : \Generator } } + #[\Override] public function source() : Extractor { return $this->extractor; diff --git a/src/core/etl/src/Flow/ETL/Pipeline/LinkedPipeline.php b/src/core/etl/src/Flow/ETL/Pipeline/LinkedPipeline.php index 0ebd958e3..c9695dca2 100644 --- a/src/core/etl/src/Flow/ETL/Pipeline/LinkedPipeline.php +++ b/src/core/etl/src/Flow/ETL/Pipeline/LinkedPipeline.php @@ -25,6 +25,7 @@ public function __construct( $this->nextPipeline = new SynchronousPipeline(new PipelineExtractor($this->pipeline)); } + #[\Override] public function add(Loader|Transformer $pipe) : Pipeline { $this->nextPipeline->add($pipe); @@ -32,6 +33,7 @@ public function add(Loader|Transformer $pipe) : Pipeline return $this; } + #[\Override] public function has(string $transformerClass) : bool { return $this->pipeline->has($transformerClass); @@ -40,21 +42,25 @@ public function has(string $transformerClass) : bool /** * @return array */ + #[\Override] public function pipelines() : array { return [$this->pipeline, $this->nextPipeline]; } + #[\Override] public function pipes() : Pipes { return $this->pipeline->pipes()->merge($this->nextPipeline->pipes()); } + #[\Override] public function process(FlowContext $context) : \Generator { return $this->nextPipeline->process($context); } + #[\Override] public function source() : Extractor { return $this->pipeline->source(); diff --git a/src/core/etl/src/Flow/ETL/Pipeline/OffsetPipeline.php b/src/core/etl/src/Flow/ETL/Pipeline/OffsetPipeline.php index 3af6d14d2..429485e38 100644 --- a/src/core/etl/src/Flow/ETL/Pipeline/OffsetPipeline.php +++ b/src/core/etl/src/Flow/ETL/Pipeline/OffsetPipeline.php @@ -22,6 +22,7 @@ public function __construct(private Pipeline $pipeline, private int $offset) } } + #[\Override] public function add(Loader|Transformer $pipe) : self { $this->pipeline->add($pipe); @@ -29,21 +30,25 @@ public function add(Loader|Transformer $pipe) : self return $this; } + #[\Override] public function has(string $transformerClass) : bool { return $this->pipeline->has($transformerClass); } + #[\Override] public function pipelines() : array { return [$this->pipeline]; } + #[\Override] public function pipes() : Pipes { return $this->pipeline->pipes(); } + #[\Override] public function process(FlowContext $context) : \Generator { if ($this->offset === 0) { @@ -75,6 +80,7 @@ public function process(FlowContext $context) : \Generator } } + #[\Override] public function source() : Extractor { return $this->pipeline->source(); diff --git a/src/core/etl/src/Flow/ETL/Pipeline/Optimizer/BatchSizeOptimization.php b/src/core/etl/src/Flow/ETL/Pipeline/Optimizer/BatchSizeOptimization.php index 56184c77e..f7bff5c8d 100644 --- a/src/core/etl/src/Flow/ETL/Pipeline/Optimizer/BatchSizeOptimization.php +++ b/src/core/etl/src/Flow/ETL/Pipeline/Optimizer/BatchSizeOptimization.php @@ -50,6 +50,7 @@ public function __construct(private readonly int $batchSize = 1000, ?array $supp } } + #[\Override] public function isFor(Loader|Transformer $element, Pipeline $pipeline) : bool { // Pipeline is already batching so we don't need to optimize it @@ -70,6 +71,7 @@ public function isFor(Loader|Transformer $element, Pipeline $pipeline) : bool return false; } + #[\Override] public function optimize(Loader|Transformer $element, Pipeline $pipeline) : Pipeline { if ($pipeline instanceof BatchingPipeline) { diff --git a/src/core/etl/src/Flow/ETL/Pipeline/Optimizer/LimitOptimization.php b/src/core/etl/src/Flow/ETL/Pipeline/Optimizer/LimitOptimization.php index c879d23e3..f16b43c74 100644 --- a/src/core/etl/src/Flow/ETL/Pipeline/Optimizer/LimitOptimization.php +++ b/src/core/etl/src/Flow/ETL/Pipeline/Optimizer/LimitOptimization.php @@ -48,6 +48,7 @@ final class LimitOptimization implements Optimization LimitTransformer::class, ]; + #[\Override] public function isFor(Loader|Transformer $element, Pipeline $pipeline) : bool { return $element instanceof LimitTransformer @@ -55,6 +56,7 @@ public function isFor(Loader|Transformer $element, Pipeline $pipeline) : bool && $pipeline->source() instanceof LimitableExtractor; } + #[\Override] public function optimize(Loader|Transformer $element, Pipeline $pipeline) : Pipeline { /** @var LimitableExtractor $extractor */ diff --git a/src/core/etl/src/Flow/ETL/Pipeline/PartitioningPipeline.php b/src/core/etl/src/Flow/ETL/Pipeline/PartitioningPipeline.php index d11dee83c..e5cc7ca34 100644 --- a/src/core/etl/src/Flow/ETL/Pipeline/PartitioningPipeline.php +++ b/src/core/etl/src/Flow/ETL/Pipeline/PartitioningPipeline.php @@ -41,6 +41,7 @@ public function __construct( $this->hashAlgorithm = new NativePHPHash(); } + #[\Override] public function add(Loader|Transformer $pipe) : Pipeline { $this->pipeline->add($pipe); @@ -48,6 +49,7 @@ public function add(Loader|Transformer $pipe) : Pipeline return $this; } + #[\Override] public function has(string $transformerClass) : bool { return $this->pipeline->has($transformerClass); @@ -56,11 +58,13 @@ public function has(string $transformerClass) : bool /** * @return array */ + #[\Override] public function pipelines() : array { return [$this->pipeline]; } + #[\Override] public function pipes() : Pipes { return $this->pipeline->pipes(); @@ -69,6 +73,7 @@ public function pipes() : Pipes /** * @return \Generator */ + #[\Override] public function process(FlowContext $context) : \Generator { /** @@ -107,6 +112,7 @@ public function process(FlowContext $context) : \Generator )->extract($context); } + #[\Override] public function source() : Extractor { return $this->pipeline->source(); diff --git a/src/core/etl/src/Flow/ETL/Pipeline/SortingPipeline.php b/src/core/etl/src/Flow/ETL/Pipeline/SortingPipeline.php index 4b75f1d16..5e9f1be70 100644 --- a/src/core/etl/src/Flow/ETL/Pipeline/SortingPipeline.php +++ b/src/core/etl/src/Flow/ETL/Pipeline/SortingPipeline.php @@ -18,6 +18,7 @@ public function __construct(private Pipeline $pipeline, private References $refs { } + #[\Override] public function add(Loader|Transformer $pipe) : Pipeline { $this->pipeline->add($pipe); @@ -25,16 +26,19 @@ public function add(Loader|Transformer $pipe) : Pipeline return $this; } + #[\Override] public function has(string $transformerClass) : bool { return $this->pipeline->has($transformerClass); } + #[\Override] public function pipelines() : array { return [$this->pipeline]; } + #[\Override] public function pipes() : Pipes { return $this->pipeline->pipes(); @@ -43,6 +47,7 @@ public function pipes() : Pipes /** * @return \Generator */ + #[\Override] public function process(FlowContext $context) : \Generator { try { @@ -78,6 +83,7 @@ public function process(FlowContext $context) : \Generator return $extractor->extract($context); } + #[\Override] public function source() : Extractor { return $this->pipeline->source(); diff --git a/src/core/etl/src/Flow/ETL/Pipeline/SynchronousPipeline.php b/src/core/etl/src/Flow/ETL/Pipeline/SynchronousPipeline.php index 82ea8a1fa..90e886391 100644 --- a/src/core/etl/src/Flow/ETL/Pipeline/SynchronousPipeline.php +++ b/src/core/etl/src/Flow/ETL/Pipeline/SynchronousPipeline.php @@ -23,6 +23,7 @@ public function __construct(?Extractor $extractor = null) $this->extractor = $extractor ?? from_rows(new Rows()); } + #[\Override] public function add(Loader|Transformer $pipe) : self { $this->pipes->add($pipe); @@ -30,16 +31,19 @@ public function add(Loader|Transformer $pipe) : self return $this; } + #[\Override] public function has(string $transformerClass) : bool { return $this->pipes->has($transformerClass); } + #[\Override] public function pipes() : Pipes { return $this->pipes; } + #[\Override] public function process(FlowContext $context) : \Generator { $generator = $this->extractor->extract($context); @@ -89,6 +93,7 @@ public function process(FlowContext $context) : \Generator } } + #[\Override] public function source() : Extractor { return $this->extractor; diff --git a/src/core/etl/src/Flow/ETL/Pipeline/VoidPipeline.php b/src/core/etl/src/Flow/ETL/Pipeline/VoidPipeline.php index 09f785e0f..0bb06b101 100644 --- a/src/core/etl/src/Flow/ETL/Pipeline/VoidPipeline.php +++ b/src/core/etl/src/Flow/ETL/Pipeline/VoidPipeline.php @@ -12,26 +12,31 @@ public function __construct(private Pipeline $pipeline) { } + #[\Override] public function add(Loader|Transformer $pipe) : self { return $this; } + #[\Override] public function has(string $transformerClass) : bool { return $this->pipeline->has($transformerClass); } + #[\Override] public function pipelines() : array { return [$this->pipeline]; } + #[\Override] public function pipes() : Pipes { return $this->pipeline->pipes(); } + #[\Override] public function process(FlowContext $context) : \Generator { foreach ($this->pipeline->process($context) as $rows) { @@ -41,6 +46,7 @@ public function process(FlowContext $context) : \Generator yield new Rows(); } + #[\Override] public function source() : Extractor { return $this->pipeline->source(); diff --git a/src/core/etl/src/Flow/ETL/Pipeline/WindowFunctionPipeline.php b/src/core/etl/src/Flow/ETL/Pipeline/WindowFunctionPipeline.php index 8f6b58523..28fab98ee 100644 --- a/src/core/etl/src/Flow/ETL/Pipeline/WindowFunctionPipeline.php +++ b/src/core/etl/src/Flow/ETL/Pipeline/WindowFunctionPipeline.php @@ -21,6 +21,7 @@ public function __construct( ) { } + #[\Override] public function add(Loader|Transformer $pipe) : Pipeline { $this->pipeline->add($pipe); @@ -28,16 +29,19 @@ public function add(Loader|Transformer $pipe) : Pipeline return $this; } + #[\Override] public function has(string $transformerClass) : bool { return $this->pipeline->has($transformerClass); } + #[\Override] public function pipelines() : array { return [$this->pipeline]; } + #[\Override] public function pipes() : Pipes { return $this->pipeline->pipes(); @@ -46,6 +50,7 @@ public function pipes() : Pipes /** * @return \Generator */ + #[\Override] public function process(FlowContext $context) : \Generator { $currentPartitionKey = null; @@ -79,6 +84,7 @@ public function process(FlowContext $context) : \Generator } } + #[\Override] public function source() : Extractor { return $this->pipeline->source(); diff --git a/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Exponential.php b/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Exponential.php index d7940175d..6e381fdb6 100644 --- a/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Exponential.php +++ b/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Exponential.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function delay(int $attempt) : Duration { $calculatedDelay = Duration::fromMicroseconds( diff --git a/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Fixed.php b/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Fixed.php index b602e63d7..1e8f658ef 100644 --- a/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Fixed.php +++ b/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Fixed.php @@ -13,6 +13,7 @@ public function __construct(private Duration $duration) { } + #[\Override] public function delay(int $attempt) : Duration { return $this->duration; diff --git a/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Fixed/FixedMilliseconds.php b/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Fixed/FixedMilliseconds.php index 1ce347b13..e0a7b5b2a 100644 --- a/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Fixed/FixedMilliseconds.php +++ b/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Fixed/FixedMilliseconds.php @@ -14,6 +14,7 @@ public function __construct(private int $milliseconds) } + #[\Override] public function delay(int $attempt) : Duration { return Duration::fromMilliseconds($this->milliseconds); diff --git a/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Jitter.php b/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Jitter.php index 2471beef9..541a59a7b 100644 --- a/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Jitter.php +++ b/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Jitter.php @@ -19,6 +19,7 @@ public function __construct( } } + #[\Override] public function delay(int $attempt) : Duration { $baseDelay = $this->delayFactory->delay($attempt); diff --git a/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Linear.php b/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Linear.php index 4623a96d9..a4adf911b 100644 --- a/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Linear.php +++ b/src/core/etl/src/Flow/ETL/Retry/DelayFactory/Linear.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function delay(int $attempt) : Duration { return Duration::fromMicroseconds( diff --git a/src/core/etl/src/Flow/ETL/Retry/RetriesRecord.php b/src/core/etl/src/Flow/ETL/Retry/RetriesRecord.php index 0efef2064..e248b3277 100644 --- a/src/core/etl/src/Flow/ETL/Retry/RetriesRecord.php +++ b/src/core/etl/src/Flow/ETL/Retry/RetriesRecord.php @@ -24,6 +24,7 @@ public function attempts() : array return $this->attempts; } + #[\Override] public function count() : int { return \count($this->attempts); diff --git a/src/core/etl/src/Flow/ETL/Retry/RetryStrategy/AnyThrowable.php b/src/core/etl/src/Flow/ETL/Retry/RetryStrategy/AnyThrowable.php index d2ae23cd5..942b8eb4c 100644 --- a/src/core/etl/src/Flow/ETL/Retry/RetryStrategy/AnyThrowable.php +++ b/src/core/etl/src/Flow/ETL/Retry/RetryStrategy/AnyThrowable.php @@ -16,6 +16,7 @@ public function __construct(private int $limit) } } + #[\Override] public function shouldRetry(\Throwable $exception, int $attemptNumber) : bool { return $attemptNumber <= $this->limit; diff --git a/src/core/etl/src/Flow/ETL/Retry/RetryStrategy/OnExceptionTypes.php b/src/core/etl/src/Flow/ETL/Retry/RetryStrategy/OnExceptionTypes.php index 212637827..d3dabc58e 100644 --- a/src/core/etl/src/Flow/ETL/Retry/RetryStrategy/OnExceptionTypes.php +++ b/src/core/etl/src/Flow/ETL/Retry/RetryStrategy/OnExceptionTypes.php @@ -40,6 +40,7 @@ public function __construct(array $exceptionTypes, private int $limit) $this->exceptionTypes = $exceptionTypes; } + #[\Override] public function shouldRetry(\Throwable $exception, int $attemptNumber) : bool { if ($attemptNumber > $this->limit) { diff --git a/src/core/etl/src/Flow/ETL/Row/Comparator/NativeComparator.php b/src/core/etl/src/Flow/ETL/Row/Comparator/NativeComparator.php index 303e75523..0960414a5 100644 --- a/src/core/etl/src/Flow/ETL/Row/Comparator/NativeComparator.php +++ b/src/core/etl/src/Flow/ETL/Row/Comparator/NativeComparator.php @@ -9,6 +9,7 @@ final class NativeComparator implements Comparator { + #[\Override] public function equals(Row $row, Row $nextRow) : bool { return $row->isEqual($nextRow); diff --git a/src/core/etl/src/Flow/ETL/Row/Entries.php b/src/core/etl/src/Flow/ETL/Row/Entries.php index a11dc7a0c..6abc3fda3 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entries.php +++ b/src/core/etl/src/Flow/ETL/Row/Entries.php @@ -73,6 +73,7 @@ public function all() : array return \array_values($this->entries); } + #[\Override] public function count() : int { return \count($this->entries); @@ -119,6 +120,7 @@ public function getAll(string|Reference ...$references) : self /** * @return \Iterator> */ + #[\Override] public function getIterator() : \Iterator { return new \ArrayIterator($this->all()); @@ -202,6 +204,7 @@ public function merge(self $entries) : self * * @throws InvalidArgumentException */ + #[\Override] public function offsetExists($offset) : bool { if (!\is_string($offset)) { @@ -218,6 +221,7 @@ public function offsetExists($offset) : bool * * @return Entry */ + #[\Override] public function offsetGet($offset) : Entry { if (!\is_string($offset)) { @@ -231,6 +235,7 @@ public function offsetGet($offset) : Entry throw new InvalidArgumentException("Entry {$offset} does not exists."); } + #[\Override] public function offsetSet(mixed $offset, mixed $value) : void { throw new RuntimeException('In order to add new rows use Entries::add(Entry $entry) : self'); @@ -241,6 +246,7 @@ public function offsetSet(mixed $offset, mixed $value) : void * * @throws RuntimeException */ + #[\Override] public function offsetUnset(mixed $offset) : void { throw new RuntimeException('In order to add new rows use Entries::remove(string $name) : self'); diff --git a/src/core/etl/src/Flow/ETL/Row/Entry.php b/src/core/etl/src/Flow/ETL/Row/Entry.php index a38fc4c20..ad076b270 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry.php @@ -12,6 +12,7 @@ */ interface Entry extends \Stringable { + #[\Override] public function __toString() : string; /** diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/BooleanEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/BooleanEntry.php index 585816d96..8b8699f19 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/BooleanEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/BooleanEntry.php @@ -37,6 +37,7 @@ public function __construct(private readonly string $name, private readonly ?boo $this->type = type_boolean(); } + #[\Override] public function __toString() : string { return $this->toString(); @@ -45,16 +46,19 @@ public function __toString() : string /** * @return Definition */ + #[\Override] public function definition() : Definition { return new Definition($this->name, $this->type, $this->value === null, $this->metadata); } + #[\Override] public function duplicate() : Entry { return new self($this->name, $this->value, $this->metadata); } + #[\Override] public function is(string|Reference $name) : bool { if ($name instanceof Reference) { @@ -64,16 +68,19 @@ public function is(string|Reference $name) : bool return $this->name === $name; } + #[\Override] public function isEqual(Entry $entry) : bool { return $this->is($entry->name()) && $entry instanceof self && type_equals($this->type, $entry->type) && $this->value() === $entry->value(); } + #[\Override] public function map(callable $mapper) : Entry { return new self($this->name, $mapper($this->value())); } + #[\Override] public function name() : string { return $this->name; @@ -82,11 +89,13 @@ public function name() : string /** * @throws InvalidArgumentException */ + #[\Override] public function rename(string $name) : Entry { return new self($name, $this->value); } + #[\Override] public function toString() : string { if ($this->value === null) { @@ -96,16 +105,19 @@ public function toString() : string return $this->value() ? 'true' : 'false'; } + #[\Override] public function type() : Type { return $this->type; } + #[\Override] public function value() : ?bool { return $this->value; } + #[\Override] public function withValue(mixed $value) : Entry { return new self($this->name, type_optional($this->type())->assert($value), $this->metadata); diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/DateEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/DateEntry.php index 74579c14b..945c797d4 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/DateEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/DateEntry.php @@ -53,21 +53,25 @@ public function __construct(private readonly string $name, \DateTimeInterface|st $this->type = type_date(); } + #[\Override] public function __toString() : string { return $this->toString(); } + #[\Override] public function definition() : Definition { return new Definition($this->name, $this->type, $this->value === null, $this->metadata); } + #[\Override] public function duplicate() : self { return new self($this->name, $this->value ? clone $this->value : null, $this->metadata); } + #[\Override] public function is(string|Reference $name) : bool { if ($name instanceof Reference) { @@ -77,26 +81,31 @@ public function is(string|Reference $name) : bool return $this->name === $name; } + #[\Override] public function isEqual(Entry $entry) : bool { return $this->is($entry->name()) && $entry instanceof self && type_equals($this->type, $entry->type) && $this->value() == $entry->value(); } + #[\Override] public function map(callable $mapper) : self { return new self($this->name, $mapper($this->value)); } + #[\Override] public function name() : string { return $this->name; } + #[\Override] public function rename(string $name) : self { return new self($name, $this->value); } + #[\Override] public function toString() : string { $value = $this->value; @@ -108,16 +117,19 @@ public function toString() : string return $value->format('Y-m-d'); } + #[\Override] public function type() : Type { return $this->type; } + #[\Override] public function value() : ?\DateTimeInterface { return $this->value; } + #[\Override] public function withValue(mixed $value) : self { return new self($this->name, type_optional($this->type())->assert($value), $this->metadata); diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/DateTimeEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/DateTimeEntry.php index 4f43c4ff5..cceab7b2b 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/DateTimeEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/DateTimeEntry.php @@ -54,21 +54,25 @@ public function __construct( $this->type = type_datetime(); } + #[\Override] public function __toString() : string { return $this->toString(); } + #[\Override] public function definition() : Definition { return new Definition($this->name, $this->type, $this->value === null, $this->metadata); } + #[\Override] public function duplicate() : self { return new self($this->name, $this->value ? clone $this->value : null, $this->metadata); } + #[\Override] public function is(string|Reference $name) : bool { if ($name instanceof Reference) { @@ -78,26 +82,31 @@ public function is(string|Reference $name) : bool return $this->name === $name; } + #[\Override] public function isEqual(Entry $entry) : bool { return $this->is($entry->name()) && $entry instanceof self && type_equals($this->type, $entry->type) && $this->value() == $entry->value(); } + #[\Override] public function map(callable $mapper) : self { return new self($this->name, $mapper($this->value)); } + #[\Override] public function name() : string { return $this->name; } + #[\Override] public function rename(string $name) : self { return new self($name, $this->value); } + #[\Override] public function toString() : string { $value = $this->value; @@ -109,16 +118,19 @@ public function toString() : string return $value->format(\DateTimeInterface::ATOM); } + #[\Override] public function type() : Type { return $this->type; } + #[\Override] public function value() : ?\DateTimeInterface { return $this->value; } + #[\Override] public function withValue(mixed $value) : self { return new self($this->name, type_optional($this->type())->assert($value), $this->metadata); diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/EnumEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/EnumEntry.php index ff5c60c0a..447e99a70 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/EnumEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/EnumEntry.php @@ -32,6 +32,7 @@ public function __construct( $this->type = type_enum($this->value === null ? \UnitEnum::class : $this->value::class); } + #[\Override] public function __toString() : string { if ($this->value === null) { @@ -41,16 +42,19 @@ public function __toString() : string return $this->value->name; } + #[\Override] public function definition() : Definition { return new Definition($this->name, $this->type, $this->value === null, $this->metadata); } + #[\Override] public function duplicate() : self { return new self($this->name, $this->value, $this->metadata); } + #[\Override] public function is(string|Reference $name) : bool { if ($name instanceof Reference) { @@ -60,26 +64,31 @@ public function is(string|Reference $name) : bool return $this->name === $name; } + #[\Override] public function isEqual(Entry $entry) : bool { return $entry instanceof self && type_equals($this->type, $entry->type) && $this->value === $entry->value; } + #[\Override] public function map(callable $mapper) : self { return new self($this->name, $mapper($this->value())); } + #[\Override] public function name() : string { return $this->name; } + #[\Override] public function rename(string $name) : self { return new self($name, $this->value); } + #[\Override] public function toString() : string { if ($this->value === null) { @@ -89,16 +98,19 @@ public function toString() : string return $this->value->name; } + #[\Override] public function type() : Type { return $this->type; } + #[\Override] public function value() : ?\UnitEnum { return $this->value; } + #[\Override] public function withValue(mixed $value) : self { return new self($this->name, type_optional($this->type())->assert($value), $this->metadata); diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/FloatEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/FloatEntry.php index 3570b2f0b..ecc6175b1 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/FloatEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/FloatEntry.php @@ -42,21 +42,25 @@ public function __construct( $this->type = type_float(); } + #[\Override] public function __toString() : string { return $this->toString(); } + #[\Override] public function definition() : Definition { return new Definition($this->name, $this->type, $this->value === null, $this->metadata); } + #[\Override] public function duplicate() : self { return new self($this->name, $this->value, $this->metadata); } + #[\Override] public function is(string|Reference $name) : bool { if ($name instanceof Reference) { @@ -66,6 +70,7 @@ public function is(string|Reference $name) : bool return $this->name === $name; } + #[\Override] public function isEqual(Entry $entry) : bool { $entryValue = $entry->value(); @@ -92,11 +97,13 @@ public function isEqual(Entry $entry) : bool && \bccomp((string) $thisValue, (string) $entryValue) === 0; } + #[\Override] public function map(callable $mapper) : self { return new self($this->name, $mapper($this->value())); } + #[\Override] public function name() : string { return $this->name; @@ -105,11 +112,13 @@ public function name() : string /** * @throws InvalidArgumentException */ + #[\Override] public function rename(string $name) : self { return new self($name, $this->value); } + #[\Override] public function toString() : string { if ($this->value === null) { @@ -119,16 +128,19 @@ public function toString() : string return \number_format($this->value, 6, '.', ''); } + #[\Override] public function type() : Type { return $this->type; } + #[\Override] public function value() : ?float { return $this->value; } + #[\Override] public function withValue(mixed $value) : self { return new self($this->name, type_optional($this->type())->assert($value), $this->metadata); diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/HTMLElementEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/HTMLElementEntry.php index fc21b7f24..14a4af5b7 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/HTMLElementEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/HTMLElementEntry.php @@ -42,6 +42,7 @@ public function __construct( $this->type = type_html_element(); } + #[\Override] public function __toString() : string { if ($this->value === null) { @@ -51,16 +52,19 @@ public function __toString() : string return $this->toString(); } + #[\Override] public function definition() : Definition { return new Definition($this->name, $this->type, $this->value === null, $this->metadata); } + #[\Override] public function duplicate() : self { return new self($this->name, type_optional(type_instance_of(HTMLElement::class))->assert($this->value ? $this->value->cloneNode(true) : null), $this->metadata); } + #[\Override] public function is(Reference|string $name) : bool { if ($name instanceof Reference) { @@ -70,6 +74,7 @@ public function is(Reference|string $name) : bool return $this->name === $name; } + #[\Override] public function isEqual(Entry $entry) : bool { if (!$entry instanceof self || !$this->is($entry->name())) { @@ -83,6 +88,7 @@ public function isEqual(Entry $entry) : bool return $this->value?->C14N() === $entry->value?->C14N(); } + #[\Override] public function map(callable $mapper) : self { $mappedValue = $mapper($this->value()); @@ -91,16 +97,19 @@ public function map(callable $mapper) : self return new self($this->name, $mappedValue); } + #[\Override] public function name() : string { return $this->name; } + #[\Override] public function rename(string $name) : self { return new self($name, $this->value); } + #[\Override] public function toString() : string { if ($this->value === null) { @@ -110,16 +119,19 @@ public function toString() : string return $this->value->innerHTML; } + #[\Override] public function type() : Type { return $this->type; } + #[\Override] public function value() : ?HTMLElement { return $this->value; } + #[\Override] public function withValue(mixed $value) : self { return new self($this->name, type_optional($this->type())->assert($value), $this->metadata); diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/HTMLEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/HTMLEntry.php index d9f977dc1..29b9cee05 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/HTMLEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/HTMLEntry.php @@ -41,21 +41,25 @@ public function __construct( $this->type = type_html(); } + #[\Override] public function __toString() : string { return $this->toString(); } + #[\Override] public function definition() : Definition { return new Definition($this->name, $this->type, null === $this->value, $this->metadata); } + #[\Override] public function duplicate() : self { return new self($this->name, $this->value ? clone $this->value : null, $this->metadata); } + #[\Override] public function is(Reference|string $name) : bool { if ($name instanceof Reference) { @@ -65,6 +69,7 @@ public function is(Reference|string $name) : bool return $this->name === $name; } + #[\Override] public function isEqual(Entry $entry) : bool { if (!$entry instanceof self || !$this->is($entry->name())) { @@ -78,21 +83,25 @@ public function isEqual(Entry $entry) : bool return $entry->value()?->saveHtml() === $this->value?->saveHtml(); } + #[\Override] public function map(callable $mapper) : self { return new self($this->name, $mapper($this->value)); } + #[\Override] public function name() : string { return $this->name; } + #[\Override] public function rename(string $name) : self { return new self($name, $this->value); } + #[\Override] public function toString() : string { if (null === $this->value) { @@ -102,16 +111,19 @@ public function toString() : string return $this->value->saveHtml(); } + #[\Override] public function type() : Type { return $this->type; } + #[\Override] public function value() : ?HTMLDocument { return $this->value; } + #[\Override] public function withValue(mixed $value) : self { return new self($this->name, type_optional($this->type())->assert($value), $this->metadata); diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/IntegerEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/IntegerEntry.php index ce6fc0822..3355ba21d 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/IntegerEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/IntegerEntry.php @@ -40,21 +40,25 @@ public function __construct( $this->type = type_integer(); } + #[\Override] public function __toString() : string { return $this->toString(); } + #[\Override] public function definition() : Definition { return new Definition($this->name, $this->type, $this->value === null, $this->metadata); } + #[\Override] public function duplicate() : self { return new self($this->name, $this->value, $this->metadata); } + #[\Override] public function is(string|Reference $name) : bool { if ($name instanceof Reference) { @@ -64,16 +68,19 @@ public function is(string|Reference $name) : bool return $this->name === $name; } + #[\Override] public function isEqual(Entry $entry) : bool { return $this->is($entry->name()) && $entry instanceof self && type_equals($this->type, $entry->type) && $this->value() === $entry->value(); } + #[\Override] public function map(callable $mapper) : self { return new self($this->name, $mapper($this->value())); } + #[\Override] public function name() : string { return $this->name; @@ -82,11 +89,13 @@ public function name() : string /** * @throws InvalidArgumentException */ + #[\Override] public function rename(string $name) : self { return new self($name, $this->value); } + #[\Override] public function toString() : string { if ($this->value === null) { @@ -96,16 +105,19 @@ public function toString() : string return (string) $this->value(); } + #[\Override] public function type() : Type { return $this->type; } + #[\Override] public function value() : ?int { return $this->value; } + #[\Override] public function withValue(mixed $value) : self { return new self($this->name, type_optional($this->type())->assert($value), $this->metadata); diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/JsonEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/JsonEntry.php index aad78f6fd..b7bd99719 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/JsonEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/JsonEntry.php @@ -85,6 +85,7 @@ public static function object(string $name, ?array $value, ?Metadata $metadata = return $entry; } + #[\Override] public function __toString() : string { return $this->toString(); @@ -95,11 +96,13 @@ public function __toString() : string * * @phpstan-ignore-next-line */ + #[\Override] public function definition() : Definition { return new Definition($this->name, $this->type, $this->value === null, $this->metadata); } + #[\Override] public function duplicate() : Entry { $entry = new self($this->name, $this->value, $this->metadata); @@ -108,6 +111,7 @@ public function duplicate() : Entry return $entry; } + #[\Override] public function is(string|Reference $name) : bool { if ($name instanceof Reference) { @@ -117,6 +121,7 @@ public function is(string|Reference $name) : bool return $this->name === $name; } + #[\Override] public function isEqual(Entry $entry) : bool { $entryValue = $entry instanceof self ? $entry->value : $entry->value(); @@ -139,6 +144,7 @@ public function isEqual(Entry $entry) : bool return $this->is($entry->name()) && $entry instanceof self && type_equals($this->type, $entry->type) && (new ArrayComparison())->equals($thisValue, \is_array($entryValue) ? $entryValue : null); } + #[\Override] public function map(callable $mapper) : Entry { $mappedValue = new self($this->name, $mapper($this->value())); @@ -147,11 +153,13 @@ public function map(callable $mapper) : Entry return $mappedValue; } + #[\Override] public function name() : string { return $this->name; } + #[\Override] public function rename(string $name) : Entry { $entry = new self($name, $this->value); @@ -160,6 +168,7 @@ public function rename(string $name) : Entry return $entry; } + #[\Override] public function toString() : string { if ($this->value === null) { @@ -178,16 +187,19 @@ public function toString() : string * * @phpstan-ignore-next-line */ + #[\Override] public function type() : Type { return $this->type; } + #[\Override] public function value() : ?array { return $this->value; } + #[\Override] public function withValue(mixed $value) : Entry { return new self($this->name, type_optional($this->type())->assert($value), $this->metadata); diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/ListEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/ListEntry.php index bc9b4e97c..d8d0646fe 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/ListEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/ListEntry.php @@ -52,21 +52,25 @@ public function __construct( $this->type = $type; } + #[\Override] public function __toString() : string { return $this->toString(); } + #[\Override] public function definition() : Definition { return new Definition($this->name, $this->type, $this->value === null, $this->metadata); } + #[\Override] public function duplicate() : Entry { return new self($this->name, $this->value, $this->type, $this->metadata); } + #[\Override] public function is(string|Reference $name) : bool { if ($name instanceof Reference) { @@ -76,6 +80,7 @@ public function is(string|Reference $name) : bool return $this->name === $name; } + #[\Override] public function isEqual(Entry $entry) : bool { $entryValue = $entry->value(); @@ -101,21 +106,25 @@ public function isEqual(Entry $entry) : bool && (new ArrayComparison())->equals($thisValue, \is_array($entryValue) ? $entryValue : null); } + #[\Override] public function map(callable $mapper) : Entry { return new self($this->name, $mapper($this->value), $this->type); } + #[\Override] public function name() : string { return $this->name; } + #[\Override] public function rename(string $name) : Entry { return new self($name, $this->value, $this->type); } + #[\Override] public function toString() : string { if ($this->value === null) { @@ -125,16 +134,19 @@ public function toString() : string return \json_encode($this->value(), JSON_THROW_ON_ERROR); } + #[\Override] public function type() : Type { return $this->type; } + #[\Override] public function value() : ?array { return $this->value; } + #[\Override] public function withValue(mixed $value) : Entry { return new self($this->name, type_optional($this->type())->assert($value), $this->type); diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/MapEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/MapEntry.php index 8a1049a55..d74afcb84 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/MapEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/MapEntry.php @@ -53,21 +53,25 @@ public function __construct( $this->type = $type; } + #[\Override] public function __toString() : string { return $this->toString(); } + #[\Override] public function definition() : Definition { return new Definition($this->name, $this->type, $this->value === null, $this->metadata); } + #[\Override] public function duplicate() : Entry { return new self($this->name, $this->value, $this->type, $this->metadata); } + #[\Override] public function is(string|Reference $name) : bool { if ($name instanceof Reference) { @@ -77,6 +81,7 @@ public function is(string|Reference $name) : bool return $this->name === $name; } + #[\Override] public function isEqual(Entry $entry) : bool { $entryValue = $entry->value(); @@ -102,21 +107,25 @@ public function isEqual(Entry $entry) : bool && (new ArrayComparison())->equals($thisValue, \is_array($entryValue) ? $entryValue : null); } + #[\Override] public function map(callable $mapper) : Entry { return new self($this->name, $mapper($this->value), $this->type); } + #[\Override] public function name() : string { return $this->name; } + #[\Override] public function rename(string $name) : Entry { return new self($name, $this->value, $this->type); } + #[\Override] public function toString() : string { if ($this->value === null) { @@ -126,16 +135,19 @@ public function toString() : string return \json_encode($this->value(), JSON_THROW_ON_ERROR); } + #[\Override] public function type() : Type { return $this->type; } + #[\Override] public function value() : ?array { return $this->value; } + #[\Override] public function withValue(mixed $value) : Entry { return new self($this->name, type_optional($this->type())->assert($value), $this->type); diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/StringEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/StringEntry.php index d0d81c500..697561feb 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/StringEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/StringEntry.php @@ -66,11 +66,13 @@ public static function uppercase(string $name, string $value) : self return new self($name, \mb_strtoupper($value)); } + #[\Override] public function __toString() : string { return $this->toString(); } + #[\Override] public function definition() : Definition { return new Definition( @@ -83,11 +85,13 @@ public function definition() : Definition ); } + #[\Override] public function duplicate() : self { return new self($this->name, $this->value, $this->metadata); } + #[\Override] public function is(string|Reference $name) : bool { if ($name instanceof Reference) { @@ -97,16 +101,19 @@ public function is(string|Reference $name) : bool return $this->name === $name; } + #[\Override] public function isEqual(Entry $entry) : bool { return $this->is($entry->name()) && $entry instanceof self && type_equals($this->type, $entry->type) && $this->value() === $entry->value(); } + #[\Override] public function map(callable $mapper) : self { return new self($this->name, $mapper($this->value())); } + #[\Override] public function name() : string { return $this->name; @@ -115,6 +122,7 @@ public function name() : string /** * @throws InvalidArgumentException */ + #[\Override] public function rename(string $name) : self { return new self($name, $this->value); @@ -125,6 +133,7 @@ public function toLowercase() : self return new self($this->name, $this->value ? \mb_strtolower($this->value) : null); } + #[\Override] public function toString() : string { $value = $this->value(); @@ -136,16 +145,19 @@ public function toString() : string return $value; } + #[\Override] public function type() : Type { return $this->type; } + #[\Override] public function value() : ?string { return $this->value; } + #[\Override] public function withValue(mixed $value) : self { return new self($this->name, type_optional($this->type())->assert($value), $this->metadata); diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/StructureEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/StructureEntry.php index 34b418822..8dbceb62b 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/StructureEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/StructureEntry.php @@ -56,21 +56,25 @@ public function __construct( $this->type = $type; } + #[\Override] public function __toString() : string { return $this->toString(); } + #[\Override] public function definition() : Definition { return new Definition($this->name, $this->type, $this->value === null, $this->metadata); } + #[\Override] public function duplicate() : Entry { return new self($this->name, $this->value, $this->type, $this->metadata); } + #[\Override] public function is(string|Reference $name) : bool { if ($name instanceof Reference) { @@ -80,6 +84,7 @@ public function is(string|Reference $name) : bool return $this->name === $name; } + #[\Override] public function isEqual(Entry $entry) : bool { $entryValue = $entry->value(); @@ -100,21 +105,25 @@ public function isEqual(Entry $entry) : bool return $this->is($entry->name()) && $entry instanceof self && type_equals($this->type, $entry->type) && (new ArrayComparison())->equals($thisValue, \is_array($entryValue) ? $entryValue : null); } + #[\Override] public function map(callable $mapper) : Entry { return new self($this->name, $mapper($this->value), $this->type); } + #[\Override] public function name() : string { return $this->name; } + #[\Override] public function rename(string $name) : Entry { return new self($name, $this->value, $this->type); } + #[\Override] public function toString() : string { if ($this->value === null) { @@ -127,16 +136,19 @@ public function toString() : string /** * @return Type> */ + #[\Override] public function type() : Type { return $this->type; } + #[\Override] public function value() : ?array { return $this->value; } + #[\Override] public function withValue(mixed $value) : Entry { return new self($this->name, type_optional($this->type())->assert($value), $this->type); diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/TimeEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/TimeEntry.php index 11ab24f21..ec3cf6acb 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/TimeEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/TimeEntry.php @@ -137,21 +137,25 @@ public static function fromString(string $name, string $time) : self return new self($name, $time); } + #[\Override] public function __toString() : string { return $this->toString(); } + #[\Override] public function definition() : Definition { return new Definition($this->name, $this->type, $this->value === null, $this->metadata); } + #[\Override] public function duplicate() : self { return new self($this->name, $this->value ? clone $this->value : null, $this->metadata); } + #[\Override] public function is(string|Reference $name) : bool { if ($name instanceof Reference) { @@ -161,6 +165,7 @@ public function is(string|Reference $name) : bool return $this->name === $name; } + #[\Override] public function isEqual(Entry $entry) : bool { $entryValue = $entry->value(); @@ -183,21 +188,25 @@ public function isEqual(Entry $entry) : bool && date_interval_to_microseconds($thisValue) == date_interval_to_microseconds($entryValue); } + #[\Override] public function map(callable $mapper) : self { return new self($this->name, $mapper($this->value)); } + #[\Override] public function name() : string { return $this->name; } + #[\Override] public function rename(string $name) : self { return new self($name, $this->value); } + #[\Override] public function toString() : string { $value = $this->value; @@ -215,16 +224,19 @@ public function toString() : string return sprintf('%02d:%02d:%02d', $totalHours, $value->i, $value->s); } + #[\Override] public function type() : Type { return $this->type; } + #[\Override] public function value() : ?\DateInterval { return $this->value; } + #[\Override] public function withValue(mixed $value) : self { return new self($this->name, type_optional($this->type())->assert($value), $this->metadata); diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/UuidEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/UuidEntry.php index 8a2fd7c02..3ce858f46 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/UuidEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/UuidEntry.php @@ -54,21 +54,25 @@ public static function from(string $name, string $value) : self return new self($name, Uuid::fromString($value)); } + #[\Override] public function __toString() : string { return $this->toString(); } + #[\Override] public function definition() : Definition { return new Definition($this->name, $this->type, $this->value === null, $this->metadata); } + #[\Override] public function duplicate() : self { return new self($this->name, $this->value ? new Uuid($this->value->toString()) : null, $this->metadata); } + #[\Override] public function is(string|Reference $name) : bool { if ($name instanceof Reference) { @@ -78,6 +82,7 @@ public function is(string|Reference $name) : bool return $this->name === $name; } + #[\Override] public function isEqual(Entry $entry) : bool { $entryValue = $entry->value(); @@ -97,11 +102,13 @@ public function isEqual(Entry $entry) : bool return $this->is($entry->name()) && $entry instanceof self && type_equals($this->type, $entry->type) && $this->value?->isEqual($entryValue); } + #[\Override] public function map(callable $mapper) : self { return new self($this->name, $mapper($this->value)); } + #[\Override] public function name() : string { return $this->name; @@ -110,11 +117,13 @@ public function name() : string /** * @throws InvalidArgumentException */ + #[\Override] public function rename(string $name) : self { return new self($name, $this->value); } + #[\Override] public function toString() : string { if ($this->value === null) { @@ -124,16 +133,19 @@ public function toString() : string return $this->value->toString(); } + #[\Override] public function type() : Type { return $this->type; } + #[\Override] public function value() : ?Uuid { return $this->value; } + #[\Override] public function withValue(mixed $value) : self { return new self($this->name, type_optional($this->type())->assert($value), $this->metadata); diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/XMLElementEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/XMLElementEntry.php index c1c6c7541..4ac6e72ca 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/XMLElementEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/XMLElementEntry.php @@ -56,6 +56,7 @@ public function __serialize() : array ]; } + #[\Override] public function __toString() : string { if ($this->value === null) { @@ -94,16 +95,19 @@ public function __unserialize(array $data) : void $this->value = (new \DOMDocument())->importNode($domDocument->documentElement, true); } + #[\Override] public function definition() : Definition { return new Definition($this->name, $this->type, $this->value === null, $this->metadata); } + #[\Override] public function duplicate() : self { return new self($this->name, type_optional(type_instance_of(\DOMElement::class))->assert($this->value ? $this->value->cloneNode(true) : null), $this->metadata); } + #[\Override] public function is(Reference|string $name) : bool { if ($name instanceof Reference) { @@ -113,6 +117,7 @@ public function is(Reference|string $name) : bool return $this->name === $name; } + #[\Override] public function isEqual(Entry $entry) : bool { if (!$entry instanceof self || !$this->is($entry->name())) { @@ -126,6 +131,7 @@ public function isEqual(Entry $entry) : bool return $this->value?->C14N() === $entry->value?->C14N(); } + #[\Override] public function map(callable $mapper) : self { $mappedValue = $mapper($this->value()); @@ -134,16 +140,19 @@ public function map(callable $mapper) : self return new self($this->name, $mappedValue); } + #[\Override] public function name() : string { return $this->name; } + #[\Override] public function rename(string $name) : self { return new self($name, $this->value); } + #[\Override] public function toString() : string { if ($this->value === null) { @@ -154,16 +163,19 @@ public function toString() : string return $this->value->ownerDocument->saveXML($this->value); } + #[\Override] public function type() : Type { return $this->type; } + #[\Override] public function value() : ?\DOMElement { return $this->value; } + #[\Override] public function withValue(mixed $value) : self { return new self($this->name, type_optional($this->type())->assert($value), $this->metadata); diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/XMLEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/XMLEntry.php index 643709774..f4b446d11 100644 --- a/src/core/etl/src/Flow/ETL/Row/Entry/XMLEntry.php +++ b/src/core/etl/src/Flow/ETL/Row/Entry/XMLEntry.php @@ -58,6 +58,7 @@ public function __serialize() : array ]; } + #[\Override] public function __toString() : string { if ($this->value === null) { @@ -96,16 +97,19 @@ public function __unserialize(array $data) : void $this->value = $doc; } + #[\Override] public function definition() : Definition { return new Definition($this->name, $this->type, $this->value === null, $this->metadata); } + #[\Override] public function duplicate() : self { return new self($this->name, $this->value ? clone $this->value : null, $this->metadata); } + #[\Override] public function is(Reference|string $name) : bool { if ($name instanceof Reference) { @@ -115,6 +119,7 @@ public function is(Reference|string $name) : bool return $this->name === $name; } + #[\Override] public function isEqual(Entry $entry) : bool { if (!$entry instanceof self || !$this->is($entry->name())) { @@ -132,6 +137,7 @@ public function isEqual(Entry $entry) : bool return $entry->value()?->C14N() === $this->value?->C14N(); } + #[\Override] public function map(callable $mapper) : self { $mappedValue = $mapper($this->value()); @@ -140,16 +146,19 @@ public function map(callable $mapper) : self return new self($this->name, $mappedValue); } + #[\Override] public function name() : string { return $this->name; } + #[\Override] public function rename(string $name) : self { return new self($name, $this->value); } + #[\Override] public function toString() : string { if ($this->value === null) { @@ -160,16 +169,19 @@ public function toString() : string return $this->value->saveXML($this->value->documentElement); } + #[\Override] public function type() : Type { return $this->type; } + #[\Override] public function value() : ?\DOMDocument { return $this->value; } + #[\Override] public function withValue(mixed $value) : self { return new self($this->name, type_optional($this->type())->assert($value), $this->metadata); diff --git a/src/core/etl/src/Flow/ETL/Row/EntryReference.php b/src/core/etl/src/Flow/ETL/Row/EntryReference.php index c5cdfed40..8257cb566 100644 --- a/src/core/etl/src/Flow/ETL/Row/EntryReference.php +++ b/src/core/etl/src/Flow/ETL/Row/EntryReference.php @@ -26,11 +26,13 @@ public static function init(string|Reference $ref) : Reference return $ref; } + #[\Override] public function __toString() : string { return $this->name(); } + #[\Override] public function as(string $alias) : self { $this->alias = $alias; @@ -45,6 +47,7 @@ public function asc() : self return $this; } + #[\Override] public function base() : string { return $this->entry; @@ -57,16 +60,19 @@ public function desc() : self return $this; } + #[\Override] public function eval(Row $row, FlowContext $context) : mixed { return $row->valueOf($this->entry); } + #[\Override] public function hasAlias() : bool { return $this->alias !== null; } + #[\Override] public function is(Reference $ref) : bool { return $this->name() === $ref->name(); @@ -77,11 +83,13 @@ public function list() : ListFunctions return new ListFunctions($this); } + #[\Override] public function name() : string { return $this->alias ?? $this->entry; } + #[\Override] public function sort() : SortOrder { return $this->sort; @@ -92,6 +100,7 @@ public function structure() : StructureFunctions return new StructureFunctions($this); } + #[\Override] public function to() : string { return $this->entry; diff --git a/src/core/etl/src/Flow/ETL/Row/Formatter/ASCIISchemaFormatter.php b/src/core/etl/src/Flow/ETL/Row/Formatter/ASCIISchemaFormatter.php index b9d212a29..2d38e8c79 100644 --- a/src/core/etl/src/Flow/ETL/Row/Formatter/ASCIISchemaFormatter.php +++ b/src/core/etl/src/Flow/ETL/Row/Formatter/ASCIISchemaFormatter.php @@ -17,6 +17,7 @@ public function __construct(private bool $asTable = false, private bool $withMet { } + #[\Override] public function format(Schema $schema) : string { if ($this->asTable) { diff --git a/src/core/etl/src/Flow/ETL/Row/References.php b/src/core/etl/src/Flow/ETL/Row/References.php index 0c0ad89ad..6f8d534ee 100644 --- a/src/core/etl/src/Flow/ETL/Row/References.php +++ b/src/core/etl/src/Flow/ETL/Row/References.php @@ -57,6 +57,7 @@ public function all() : array return \array_values($this->refs); } + #[\Override] public function count() : int { return \count($this->refs); @@ -74,6 +75,7 @@ public function first() : Reference /** * @return \Traversable */ + #[\Override] public function getIterator() : \Traversable { return new \ArrayIterator($this->refs); @@ -111,6 +113,7 @@ public function names() : array * * @return bool */ + #[\Override] public function offsetExists($offset) : bool { return \array_key_exists($offset, $this->refs); @@ -123,6 +126,7 @@ public function offsetExists($offset) : bool * * @return Reference */ + #[\Override] public function offsetGet($offset) : Reference { if ($this->offsetExists($offset)) { @@ -132,11 +136,13 @@ public function offsetGet($offset) : Reference throw new InvalidArgumentException("Reference {$offset} does not exists."); } + #[\Override] public function offsetSet(mixed $offset, mixed $value) : void { throw new InvalidArgumentException('Method not implemented.'); } + #[\Override] public function offsetUnset(mixed $offset) : void { throw new InvalidArgumentException('Method not implemented.'); diff --git a/src/core/etl/src/Flow/ETL/Rows.php b/src/core/etl/src/Flow/ETL/Rows.php index d7ca5d0cf..aa6c2772f 100644 --- a/src/core/etl/src/Flow/ETL/Rows.php +++ b/src/core/etl/src/Flow/ETL/Rows.php @@ -97,6 +97,7 @@ public function chunks(int $size) : \Generator } } + #[\Override] public function count() : int { return \count($this->rows); @@ -277,6 +278,7 @@ public function flatMap(callable $callable) : self /** * @return \Iterator */ + #[\Override] public function getIterator() : \Iterator { return new \ArrayIterator($this->rows); @@ -542,6 +544,7 @@ public function merge(self $rows) : self * * @throws InvalidArgumentException */ + #[\Override] public function offsetExists($offset) : bool { if (!\is_int($offset)) { @@ -556,6 +559,7 @@ public function offsetExists($offset) : bool * * @throws InvalidArgumentException */ + #[\Override] public function offsetGet($offset) : Row { if ($this->offsetExists($offset)) { @@ -565,6 +569,7 @@ public function offsetGet($offset) : Row throw new InvalidArgumentException("Row {$offset} does not exists."); } + #[\Override] public function offsetSet(mixed $offset, mixed $value) : void { throw new RuntimeException('In order to add new rows use Rows::add(Row $row) : self'); @@ -575,6 +580,7 @@ public function offsetSet(mixed $offset, mixed $value) : void * * @throws RuntimeException */ + #[\Override] public function offsetUnset(mixed $offset) : void { throw new RuntimeException('In order to remove rows use Rows::remove(int $offset) : self'); diff --git a/src/core/etl/src/Flow/ETL/Schema.php b/src/core/etl/src/Flow/ETL/Schema.php index c3f2df7a4..1983e3228 100644 --- a/src/core/etl/src/Flow/ETL/Schema.php +++ b/src/core/etl/src/Flow/ETL/Schema.php @@ -122,6 +122,7 @@ public function addMetadata(string $definition, string $name, int|string|bool|fl return $this; } + #[\Override] public function count() : int { return \count($this->definitions); diff --git a/src/core/etl/src/Flow/ETL/Schema/Formatter/JsonSchemaFormatter.php b/src/core/etl/src/Flow/ETL/Schema/Formatter/JsonSchemaFormatter.php index de714ab15..6c26fd4f1 100644 --- a/src/core/etl/src/Flow/ETL/Schema/Formatter/JsonSchemaFormatter.php +++ b/src/core/etl/src/Flow/ETL/Schema/Formatter/JsonSchemaFormatter.php @@ -13,6 +13,7 @@ public function __construct(private bool $pretty = false) { } + #[\Override] public function format(Schema $schema) : string { if ($this->pretty) { diff --git a/src/core/etl/src/Flow/ETL/Schema/Formatter/PHPSchemaFormatter.php b/src/core/etl/src/Flow/ETL/Schema/Formatter/PHPSchemaFormatter.php index bb6e1ea4c..54f3ab82f 100644 --- a/src/core/etl/src/Flow/ETL/Schema/Formatter/PHPSchemaFormatter.php +++ b/src/core/etl/src/Flow/ETL/Schema/Formatter/PHPSchemaFormatter.php @@ -34,6 +34,7 @@ public function __construct( /** * @param Schema $schema */ + #[\Override] public function format(Schema $schema) : string { $reflection = new \ReflectionFunction("\Flow\ETL\DSL\schema"); diff --git a/src/core/etl/src/Flow/ETL/Schema/Validator/EvolvingValidator.php b/src/core/etl/src/Flow/ETL/Schema/Validator/EvolvingValidator.php index d97f0196f..dbef2f5f9 100644 --- a/src/core/etl/src/Flow/ETL/Schema/Validator/EvolvingValidator.php +++ b/src/core/etl/src/Flow/ETL/Schema/Validator/EvolvingValidator.php @@ -22,6 +22,7 @@ final class EvolvingValidator implements SchemaValidator * @param Schema $expected * @param Schema $given */ + #[\Override] public function isValid(Schema $expected, Schema $given) : bool { if ($given->count() < $expected->count()) { diff --git a/src/core/etl/src/Flow/ETL/Schema/Validator/SelectiveValidator.php b/src/core/etl/src/Flow/ETL/Schema/Validator/SelectiveValidator.php index 5987731b3..9893318c3 100644 --- a/src/core/etl/src/Flow/ETL/Schema/Validator/SelectiveValidator.php +++ b/src/core/etl/src/Flow/ETL/Schema/Validator/SelectiveValidator.php @@ -13,6 +13,7 @@ */ final class SelectiveValidator implements SchemaValidator { + #[\Override] public function isValid(Schema $expected, Schema $given) : bool { foreach ($expected->definitions() as $expectedDefinition) { diff --git a/src/core/etl/src/Flow/ETL/Schema/Validator/StrictValidator.php b/src/core/etl/src/Flow/ETL/Schema/Validator/StrictValidator.php index 336c319b7..832307211 100644 --- a/src/core/etl/src/Flow/ETL/Schema/Validator/StrictValidator.php +++ b/src/core/etl/src/Flow/ETL/Schema/Validator/StrictValidator.php @@ -17,6 +17,7 @@ final class StrictValidator implements SchemaValidator * @param Schema $expected * @param Schema $given */ + #[\Override] public function isValid(Schema $expected, Schema $given) : bool { if ($expected->count() !== $given->count()) { diff --git a/src/core/etl/src/Flow/ETL/Sort/ExternalSort.php b/src/core/etl/src/Flow/ETL/Sort/ExternalSort.php index 55fa3ffe9..8bb6571f3 100644 --- a/src/core/etl/src/Flow/ETL/Sort/ExternalSort.php +++ b/src/core/etl/src/Flow/ETL/Sort/ExternalSort.php @@ -38,6 +38,7 @@ public function __construct( } } + #[\Override] public function sortBy(Pipeline $pipeline, FlowContext $context, References $refs) : Extractor { $sortedBuckets = []; diff --git a/src/core/etl/src/Flow/ETL/Sort/ExternalSort/BucketsCache/FilesystemBucketsCache.php b/src/core/etl/src/Flow/ETL/Sort/ExternalSort/BucketsCache/FilesystemBucketsCache.php index 5107ee077..a17af21db 100644 --- a/src/core/etl/src/Flow/ETL/Sort/ExternalSort/BucketsCache/FilesystemBucketsCache.php +++ b/src/core/etl/src/Flow/ETL/Sort/ExternalSort/BucketsCache/FilesystemBucketsCache.php @@ -33,6 +33,7 @@ public function __construct( /** * @return \Generator */ + #[\Override] public function get(string $bucketId) : \Generator { $path = $this->keyPath($bucketId); @@ -50,6 +51,7 @@ public function get(string $bucketId) : \Generator $stream->close(); } + #[\Override] public function remove(string $bucketId) : void { // we want to remove not only cache file but entire directory @@ -60,6 +62,7 @@ public function remove(string $bucketId) : void * @param string $bucketId * @param iterable|Rows $rows */ + #[\Override] public function set(string $bucketId, iterable $rows) : void { $path = $this->keyPath($bucketId); diff --git a/src/core/etl/src/Flow/ETL/Sort/ExternalSort/RowsMinHeap.php b/src/core/etl/src/Flow/ETL/Sort/ExternalSort/RowsMinHeap.php index 39e8a43b5..157097a68 100644 --- a/src/core/etl/src/Flow/ETL/Sort/ExternalSort/RowsMinHeap.php +++ b/src/core/etl/src/Flow/ETL/Sort/ExternalSort/RowsMinHeap.php @@ -21,6 +21,7 @@ public function __construct(Reference ...$refs) $this->ref = References::init(...$refs); } + #[\Override] public function __debugInfo() : array { $clone = clone $this; @@ -37,11 +38,13 @@ public function __debugInfo() : array /** * @return BucketRow */ + #[\Override] public function extract() : mixed { return parent::extract(); } + #[\Override] #[\ReturnTypeWillChange] public function insert(mixed $value) : void { @@ -56,6 +59,7 @@ public function insert(mixed $value) : void * @param BucketRow $value1 * @param BucketRow $value2 */ + #[\Override] protected function compare($value1, $value2) : int { $leftValues = []; diff --git a/src/core/etl/src/Flow/ETL/Sort/MemorySort.php b/src/core/etl/src/Flow/ETL/Sort/MemorySort.php index 3e54c6944..bed40a255 100644 --- a/src/core/etl/src/Flow/ETL/Sort/MemorySort.php +++ b/src/core/etl/src/Flow/ETL/Sort/MemorySort.php @@ -34,6 +34,7 @@ public function __construct( } } + #[\Override] public function sortBy(Pipeline $pipeline, FlowContext $context, References $refs) : Extractor { $memoryConsumption = new Consumption(); diff --git a/src/core/etl/src/Flow/ETL/Time/FakeSleep.php b/src/core/etl/src/Flow/ETL/Time/FakeSleep.php index 86aefc974..d3ff5e177 100644 --- a/src/core/etl/src/Flow/ETL/Time/FakeSleep.php +++ b/src/core/etl/src/Flow/ETL/Time/FakeSleep.php @@ -13,6 +13,7 @@ final class FakeSleep implements Sleep private int $totalMicroseconds = 0; + #[\Override] public function for(Duration $duration) : void { $this->sleepDurations[] = $duration; diff --git a/src/core/etl/src/Flow/ETL/Time/SystemSleep.php b/src/core/etl/src/Flow/ETL/Time/SystemSleep.php index 9acc7d50c..10b2838fa 100644 --- a/src/core/etl/src/Flow/ETL/Time/SystemSleep.php +++ b/src/core/etl/src/Flow/ETL/Time/SystemSleep.php @@ -6,6 +6,7 @@ final class SystemSleep implements Sleep { + #[\Override] public function for(Duration $duration) : void { \usleep($duration->microseconds()); diff --git a/src/core/etl/src/Flow/ETL/Transformation/AddRowIndex.php b/src/core/etl/src/Flow/ETL/Transformation/AddRowIndex.php index bd8cc55e6..836452b61 100644 --- a/src/core/etl/src/Flow/ETL/Transformation/AddRowIndex.php +++ b/src/core/etl/src/Flow/ETL/Transformation/AddRowIndex.php @@ -14,6 +14,7 @@ public function __construct(private string $indexColumn = 'index', private Start { } + #[\Override] public function transform(DataFrame $dataFrame) : DataFrame { $index = $this->startFrom === StartFrom::ZERO ? 0 : 1; diff --git a/src/core/etl/src/Flow/ETL/Transformation/BatchBy.php b/src/core/etl/src/Flow/ETL/Transformation/BatchBy.php index f6a38b3d1..40f628d76 100644 --- a/src/core/etl/src/Flow/ETL/Transformation/BatchBy.php +++ b/src/core/etl/src/Flow/ETL/Transformation/BatchBy.php @@ -24,6 +24,7 @@ public function __construct( } } + #[\Override] public function transform(DataFrame $dataFrame) : DataFrame { return $dataFrame->batchBy($this->column, $this->minSize); diff --git a/src/core/etl/src/Flow/ETL/Transformation/BatchSize.php b/src/core/etl/src/Flow/ETL/Transformation/BatchSize.php index 5b3712a99..11d73d3e6 100644 --- a/src/core/etl/src/Flow/ETL/Transformation/BatchSize.php +++ b/src/core/etl/src/Flow/ETL/Transformation/BatchSize.php @@ -27,6 +27,7 @@ public function __construct(private int $size) } } + #[\Override] public function transform(DataFrame $dataFrame) : DataFrame { return $dataFrame->batchSize($this->size); diff --git a/src/core/etl/src/Flow/ETL/Transformation/Drop.php b/src/core/etl/src/Flow/ETL/Transformation/Drop.php index 3496ce8e6..2a72abab7 100644 --- a/src/core/etl/src/Flow/ETL/Transformation/Drop.php +++ b/src/core/etl/src/Flow/ETL/Transformation/Drop.php @@ -16,6 +16,7 @@ public function __construct(string|Reference ...$entries) $this->references = References::init(...$entries); } + #[\Override] public function transform(DataFrame $dataFrame) : DataFrame { return $dataFrame->drop(...$this->references->all()); diff --git a/src/core/etl/src/Flow/ETL/Transformation/Limit.php b/src/core/etl/src/Flow/ETL/Transformation/Limit.php index edbd22022..c50ec5928 100644 --- a/src/core/etl/src/Flow/ETL/Transformation/Limit.php +++ b/src/core/etl/src/Flow/ETL/Transformation/Limit.php @@ -12,6 +12,7 @@ public function __construct(private ?int $limit) { } + #[\Override] public function transform(DataFrame $dataFrame) : DataFrame { return $dataFrame->limit($this->limit); diff --git a/src/core/etl/src/Flow/ETL/Transformation/MaskColumns.php b/src/core/etl/src/Flow/ETL/Transformation/MaskColumns.php index d702d2632..d6d9e7ffc 100644 --- a/src/core/etl/src/Flow/ETL/Transformation/MaskColumns.php +++ b/src/core/etl/src/Flow/ETL/Transformation/MaskColumns.php @@ -20,6 +20,7 @@ public function __construct(private array $columns = [], private string $mask = { } + #[\Override] public function transform(DataFrame $dataFrame) : DataFrame { foreach ($this->columns as $column) { diff --git a/src/core/etl/src/Flow/ETL/Transformation/Select.php b/src/core/etl/src/Flow/ETL/Transformation/Select.php index 0aac97544..a40f1e914 100644 --- a/src/core/etl/src/Flow/ETL/Transformation/Select.php +++ b/src/core/etl/src/Flow/ETL/Transformation/Select.php @@ -16,6 +16,7 @@ public function __construct(string|Reference ...$entries) $this->references = References::init(...$entries); } + #[\Override] public function transform(DataFrame $dataFrame) : DataFrame { return $dataFrame->select(...$this->references->all()); diff --git a/src/core/etl/src/Flow/ETL/Transformations.php b/src/core/etl/src/Flow/ETL/Transformations.php index f0c025d0b..5b650dd4b 100644 --- a/src/core/etl/src/Flow/ETL/Transformations.php +++ b/src/core/etl/src/Flow/ETL/Transformations.php @@ -20,6 +20,7 @@ public function __construct(Transformation ...$transformations) $this->transformations = \array_values($transformations); } + #[\Override] public function transform(DataFrame $dataFrame) : DataFrame { foreach ($this->transformations as $transformation) { diff --git a/src/core/etl/src/Flow/ETL/Transformer/AutoCastTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/AutoCastTransformer.php index e054d3420..dc503d5bc 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/AutoCastTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/AutoCastTransformer.php @@ -14,6 +14,7 @@ public function __construct(private AutoCaster $caster) { } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { return $rows->map(fn (Row $row) => $row->map(fn (Entry $entry) => $context->entryFactory()->create($entry->name(), $this->caster->cast($entry->value())))); diff --git a/src/core/etl/src/Flow/ETL/Transformer/CallbackRowTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/CallbackRowTransformer.php index 8f6fc75a0..5c9cfacc0 100755 --- a/src/core/etl/src/Flow/ETL/Transformer/CallbackRowTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/CallbackRowTransformer.php @@ -21,6 +21,7 @@ public function __construct(callable $callable) $this->callable = $callable; } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { return $rows->map($this->callable); diff --git a/src/core/etl/src/Flow/ETL/Transformer/CrossJoinRowsTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/CrossJoinRowsTransformer.php index 6dc06e44f..0a2ca81e8 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/CrossJoinRowsTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/CrossJoinRowsTransformer.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { return $rows->joinCross($this->rows(), $this->prefix); diff --git a/src/core/etl/src/Flow/ETL/Transformer/DropDuplicatesTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/DropDuplicatesTransformer.php index d2a6b76fa..5214a4448 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/DropDuplicatesTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/DropDuplicatesTransformer.php @@ -31,6 +31,7 @@ public function __construct(string|Reference ...$entries) $this->hashAlgorithm = new NativePHPHash(); } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { $newRows = []; diff --git a/src/core/etl/src/Flow/ETL/Transformer/DropEntriesTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/DropEntriesTransformer.php index b3eecb81f..c9ef9be7a 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/DropEntriesTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/DropEntriesTransformer.php @@ -16,6 +16,7 @@ public function __construct(string|Reference ...$names) $this->refs = References::init(...$names); } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { $transformer = fn (Row $row) : Row => $row->remove(...$this->refs); diff --git a/src/core/etl/src/Flow/ETL/Transformer/DropPartitionsTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/DropPartitionsTransformer.php index ddc2ef190..a7e76c904 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/DropPartitionsTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/DropPartitionsTransformer.php @@ -13,6 +13,7 @@ public function __construct(private bool $dropPartitionColumns = false) } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { if ($rows->isPartitioned()) { diff --git a/src/core/etl/src/Flow/ETL/Transformer/DuplicateRowTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/DuplicateRowTransformer.php index db045c9d0..05bdf8fde 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/DuplicateRowTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/DuplicateRowTransformer.php @@ -25,6 +25,7 @@ public function __construct( $this->entries = $entries; } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { $duplicatedRows = \Flow\ETL\DSL\rows(); diff --git a/src/core/etl/src/Flow/ETL/Transformer/EntryNameStyleConverterTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/EntryNameStyleConverterTransformer.php index b55269aea..e13fd603c 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/EntryNameStyleConverterTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/EntryNameStyleConverterTransformer.php @@ -25,6 +25,7 @@ public function __construct(OldStringStyles|StringStyles $style) } } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { $rowTransformer = function (Row $row) : Row { diff --git a/src/core/etl/src/Flow/ETL/Transformer/JoinEachRowsTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/JoinEachRowsTransformer.php index 8c8fe43de..c8efef7ca 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/JoinEachRowsTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/JoinEachRowsTransformer.php @@ -39,6 +39,7 @@ public static function right(DataFrameFactory $right, Expression $condition) : s /** * @throws InvalidArgumentException */ + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { $rightRows = $this->factory->from($rows)->fetch(); diff --git a/src/core/etl/src/Flow/ETL/Transformer/LimitTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/LimitTransformer.php index 6804d2c48..679d5309b 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/LimitTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/LimitTransformer.php @@ -18,6 +18,7 @@ public function __construct(public readonly int $limit) } } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { $this->rowsCount += $rows->count(); diff --git a/src/core/etl/src/Flow/ETL/Transformer/OrderEntries/CombinedComparator.php b/src/core/etl/src/Flow/ETL/Transformer/OrderEntries/CombinedComparator.php index 801287cc6..aa8e08833 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/OrderEntries/CombinedComparator.php +++ b/src/core/etl/src/Flow/ETL/Transformer/OrderEntries/CombinedComparator.php @@ -12,6 +12,7 @@ public function __construct(private Comparator $first, private Comparator $secon { } + #[\Override] public function compare(Entry $left, Entry $right) : int { $result = $this->first->compare($left, $right); diff --git a/src/core/etl/src/Flow/ETL/Transformer/OrderEntries/NameComparator.php b/src/core/etl/src/Flow/ETL/Transformer/OrderEntries/NameComparator.php index 5d335b995..519a63cdf 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/OrderEntries/NameComparator.php +++ b/src/core/etl/src/Flow/ETL/Transformer/OrderEntries/NameComparator.php @@ -16,6 +16,7 @@ public function __construct(private Order $order = Order::ASC) * @param Entry $left * @param Entry $right */ + #[\Override] public function compare(Entry $left, Entry $right) : int { if ($this->order === Order::ASC) { diff --git a/src/core/etl/src/Flow/ETL/Transformer/OrderEntries/TypeComparator.php b/src/core/etl/src/Flow/ETL/Transformer/OrderEntries/TypeComparator.php index 118db3c97..2ba7d416e 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/OrderEntries/TypeComparator.php +++ b/src/core/etl/src/Flow/ETL/Transformer/OrderEntries/TypeComparator.php @@ -16,6 +16,7 @@ public function __construct(private TypePriorities $priorities = new TypePriorit * @param Entry $left * @param Entry $right */ + #[\Override] public function compare(Entry $left, Entry $right) : int { $leftTypePriority = $this->priorities->for($left); diff --git a/src/core/etl/src/Flow/ETL/Transformer/OrderEntriesTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/OrderEntriesTransformer.php index 4e1eba3fb..31061e72c 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/OrderEntriesTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/OrderEntriesTransformer.php @@ -14,6 +14,7 @@ public function __construct(private Comparator $comparator) { } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { return $rows->map(function (Row $row) : Row { diff --git a/src/core/etl/src/Flow/ETL/Transformer/Rename/RenameCaseEntryStrategy.php b/src/core/etl/src/Flow/ETL/Transformer/Rename/RenameCaseEntryStrategy.php index 22642f722..2359fda4b 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/Rename/RenameCaseEntryStrategy.php +++ b/src/core/etl/src/Flow/ETL/Transformer/Rename/RenameCaseEntryStrategy.php @@ -24,6 +24,7 @@ public function __construct( } } + #[\Override] public function rename(Row $row, Entry $entry, FlowContext $context) : Row { return $row->rename($entry->name(), $this->style->convert($entry->name())); diff --git a/src/core/etl/src/Flow/ETL/Transformer/Rename/RenameReplaceEntryStrategy.php b/src/core/etl/src/Flow/ETL/Transformer/Rename/RenameReplaceEntryStrategy.php index 123cff489..c88454521 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/Rename/RenameReplaceEntryStrategy.php +++ b/src/core/etl/src/Flow/ETL/Transformer/Rename/RenameReplaceEntryStrategy.php @@ -18,6 +18,7 @@ public function __construct( ) { } + #[\Override] public function rename(Row $row, Entry $entry, FlowContext $context) : Row { return $row->rename($entry->name(), \str_replace($this->search, $this->replace, $entry->name())); diff --git a/src/core/etl/src/Flow/ETL/Transformer/RenameAllCaseTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/RenameAllCaseTransformer.php index dd8492120..87ac62405 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/RenameAllCaseTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/RenameAllCaseTransformer.php @@ -36,6 +36,7 @@ public function __construct( } } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { return $rows->map(function (Row $row) use ($context) : Row { diff --git a/src/core/etl/src/Flow/ETL/Transformer/RenameEachEntryTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/RenameEachEntryTransformer.php index 3f7346318..9b4c02ec4 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/RenameEachEntryTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/RenameEachEntryTransformer.php @@ -27,6 +27,7 @@ public function __construct(RenameEntryStrategy ...$strategies) $this->strategies = $strategies; } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { return $rows->map(function (Row $row) use ($context) : Row { diff --git a/src/core/etl/src/Flow/ETL/Transformer/RenameEntryTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/RenameEntryTransformer.php index 167e0133c..f78ebdbaf 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/RenameEntryTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/RenameEntryTransformer.php @@ -12,6 +12,7 @@ public function __construct(private string $from, private string $to) { } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { return $rows->map(fn (Row $row) : Row => $row->rename($this->from, $this->to)); diff --git a/src/core/etl/src/Flow/ETL/Transformer/RenameStrReplaceAllEntriesTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/RenameStrReplaceAllEntriesTransformer.php index bc5a9c120..f42bda9c0 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/RenameStrReplaceAllEntriesTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/RenameStrReplaceAllEntriesTransformer.php @@ -20,6 +20,7 @@ public function __construct( $this->transformer = new RenameReplaceEntryStrategy($this->search, $this->replace); } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { return $rows->map(function (Row $row) use ($context) : Row { diff --git a/src/core/etl/src/Flow/ETL/Transformer/ScalarFunctionFilterTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/ScalarFunctionFilterTransformer.php index fe2da175f..eaeba04e1 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/ScalarFunctionFilterTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/ScalarFunctionFilterTransformer.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { return $rows->filter(function (Row $r) use ($context) : bool { diff --git a/src/core/etl/src/Flow/ETL/Transformer/ScalarFunctionTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/ScalarFunctionTransformer.php index cd5fca14d..c307554e6 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/ScalarFunctionTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/ScalarFunctionTransformer.php @@ -20,6 +20,7 @@ public function __construct( ) { } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { if ($this->function instanceof ExpandResults) { diff --git a/src/core/etl/src/Flow/ETL/Transformer/SelectEntriesTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/SelectEntriesTransformer.php index 1204e6c9d..1661564c0 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/SelectEntriesTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/SelectEntriesTransformer.php @@ -17,6 +17,7 @@ public function __construct(string|Reference ...$refs) $this->refs = References::init(...$refs); } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { $newRows = []; diff --git a/src/core/etl/src/Flow/ETL/Transformer/SerializeTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/SerializeTransformer.php index 0fc0266de..f0444930e 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/SerializeTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/SerializeTransformer.php @@ -14,6 +14,7 @@ public function __construct(private Reference|string $target, private bool $stan { } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { $target = $this->target instanceof Reference ? $this->target : ref($this->target); diff --git a/src/core/etl/src/Flow/ETL/Transformer/UnserializeTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/UnserializeTransformer.php index 38f380938..0735d99a8 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/UnserializeTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/UnserializeTransformer.php @@ -20,6 +20,7 @@ public function __construct(private Reference|string $source, private bool $merg { } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { $source = $this->source instanceof Reference ? $this->source : ref($this->source); diff --git a/src/core/etl/src/Flow/ETL/Transformer/UntilTransformer.php b/src/core/etl/src/Flow/ETL/Transformer/UntilTransformer.php index 0269c3b4b..ce7fb6956 100644 --- a/src/core/etl/src/Flow/ETL/Transformer/UntilTransformer.php +++ b/src/core/etl/src/Flow/ETL/Transformer/UntilTransformer.php @@ -16,6 +16,7 @@ public function __construct(private readonly ScalarFunction $function) { } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { if ($this->limitReached) { diff --git a/src/core/etl/src/Flow/Serializer/Base64Serializer.php b/src/core/etl/src/Flow/Serializer/Base64Serializer.php index 04545c37e..60b2e2a80 100644 --- a/src/core/etl/src/Flow/Serializer/Base64Serializer.php +++ b/src/core/etl/src/Flow/Serializer/Base64Serializer.php @@ -12,11 +12,13 @@ public function __construct(private Serializer $serializer) { } + #[\Override] public function serialize(object $serializable) : string { return \base64_encode($this->serializer->serialize($serializable)); } + #[\Override] public function unserialize(string $serialized, array $classes) : object { $decodedString = \base64_decode($serialized, true); diff --git a/src/core/etl/src/Flow/Serializer/CompressingSerializer.php b/src/core/etl/src/Flow/Serializer/CompressingSerializer.php index fb7764302..85016500f 100644 --- a/src/core/etl/src/Flow/Serializer/CompressingSerializer.php +++ b/src/core/etl/src/Flow/Serializer/CompressingSerializer.php @@ -12,6 +12,7 @@ public function __construct(private Serializer $serializer, private int $compres { } + #[\Override] public function serialize(object $serializable) : string { if (!\function_exists('gzcompress')) { @@ -31,6 +32,7 @@ public function serialize(object $serializable) : string return $content; } + #[\Override] public function unserialize(string $serialized, array $classes) : object { if (!\function_exists('gzcompress')) { diff --git a/src/core/etl/src/Flow/Serializer/NativePHPSerializer.php b/src/core/etl/src/Flow/Serializer/NativePHPSerializer.php index b02131040..ee327b343 100644 --- a/src/core/etl/src/Flow/Serializer/NativePHPSerializer.php +++ b/src/core/etl/src/Flow/Serializer/NativePHPSerializer.php @@ -12,11 +12,13 @@ public function __construct() { } + #[\Override] public function serialize(object $serializable) : string { return \serialize($serializable); } + #[\Override] public function unserialize(string $serialized, array $classes) : object { $value = \unserialize($serialized, ['allowed_classes' => true]); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Double/AddStampToStringEntryTransformer.php b/src/core/etl/tests/Flow/ETL/Tests/Double/AddStampToStringEntryTransformer.php index a997ef9af..da6d79a2f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Double/AddStampToStringEntryTransformer.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Double/AddStampToStringEntryTransformer.php @@ -19,6 +19,7 @@ public static function divideBySemicolon(string $entryName, string $stamp) : sel return new self($entryName, $stamp, ':'); } + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { return $rows->map( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Double/EmptyExtractor.php b/src/core/etl/tests/Flow/ETL/Tests/Double/EmptyExtractor.php index 844b0d29a..b202f7a65 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Double/EmptyExtractor.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Double/EmptyExtractor.php @@ -9,6 +9,7 @@ final class EmptyExtractor implements Extractor { + #[\Override] public function extract(FlowContext $context) : \Generator { yield rows(); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Double/FakeExtractor.php b/src/core/etl/tests/Flow/ETL/Tests/Double/FakeExtractor.php index 8032e4e3f..83254b24c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Double/FakeExtractor.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Double/FakeExtractor.php @@ -84,6 +84,7 @@ enum_schema('enum', BackedStringEnum::class), * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { for ($i = 0; $i < $this->total; $i++) { diff --git a/src/core/etl/tests/Flow/ETL/Tests/Double/FakeRandomOrdersExtractor.php b/src/core/etl/tests/Flow/ETL/Tests/Double/FakeRandomOrdersExtractor.php index 75e8888c1..c05cf929f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Double/FakeRandomOrdersExtractor.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Double/FakeRandomOrdersExtractor.php @@ -53,6 +53,7 @@ public static function schema() : Schema ); } + #[\Override] public function extract(FlowContext $context) : \Generator { foreach ($this->rawData() as $row) { diff --git a/src/core/etl/tests/Flow/ETL/Tests/Double/FakeStaticOrdersExtractor.php b/src/core/etl/tests/Flow/ETL/Tests/Double/FakeStaticOrdersExtractor.php index aa52f6caa..8563fb5ae 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Double/FakeStaticOrdersExtractor.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Double/FakeStaticOrdersExtractor.php @@ -52,6 +52,7 @@ public static function schema() : Schema ); } + #[\Override] public function extract(FlowContext $context) : \Generator { foreach ($this->rawData() as $row) { diff --git a/src/core/etl/tests/Flow/ETL/Tests/Double/SpyLoader.php b/src/core/etl/tests/Flow/ETL/Tests/Double/SpyLoader.php index 312cce4e2..cc80f1478 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Double/SpyLoader.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Double/SpyLoader.php @@ -15,6 +15,7 @@ final class SpyLoader implements Loader public int $loadsCount = 0; + #[\Override] public function load(Rows $rows, FlowContext $context) : void { $this->loadedRows[] = $rows; diff --git a/src/core/etl/tests/Flow/ETL/Tests/FlowIntegrationTestCase.php b/src/core/etl/tests/Flow/ETL/Tests/FlowIntegrationTestCase.php index 9e0eed177..8e04b1609 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/FlowIntegrationTestCase.php +++ b/src/core/etl/tests/Flow/ETL/Tests/FlowIntegrationTestCase.php @@ -25,6 +25,7 @@ abstract class FlowIntegrationTestCase extends FlowTestCase private string $baseMemoryLimit; + #[\Override] protected function setUp() : void { $this->baseMemoryLimit = (\ini_get('memory_limit')) ?: '-1'; @@ -39,6 +40,7 @@ protected function setUp() : void \mkdir($this->cacheDir->path(), recursive: true); } + #[\Override] protected function tearDown() : void { if (\ini_get('memory_limit') !== $this->baseMemoryLimit) { diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Cache/FilesystemCacheTestSuite.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Cache/FilesystemCacheTestSuite.php index b4bb71bd2..86e4929e2 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Cache/FilesystemCacheTestSuite.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Cache/FilesystemCacheTestSuite.php @@ -10,6 +10,7 @@ final class FilesystemCacheTestSuite extends CacheBaseTestSuite { + #[\Override] protected function cache() : Cache { return new FilesystemCache( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Cache/InMemoryCacheTestSuite.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Cache/InMemoryCacheTestSuite.php index b203d7eff..a292c6658 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Cache/InMemoryCacheTestSuite.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Cache/InMemoryCacheTestSuite.php @@ -9,6 +9,7 @@ final class InMemoryCacheTestSuite extends CacheBaseTestSuite { + #[\Override] protected function cache() : Cache { return new InMemoryCache(); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Cache/PSRSimpleFilesystemCacheTestSuite.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Cache/PSRSimpleFilesystemCacheTestSuite.php index f753b77b9..a038ddfbf 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Cache/PSRSimpleFilesystemCacheTestSuite.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Cache/PSRSimpleFilesystemCacheTestSuite.php @@ -11,6 +11,7 @@ final class PSRSimpleFilesystemCacheTestSuite extends CacheBaseTestSuite { + #[\Override] protected function cache() : Cache { return new PSRSimpleCache(new Psr16Cache(new FilesystemAdapter(directory: __DIR__ . '/var/psr-simple-file-cache'))); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Cache/PSRSimpleRedisCacheTestSuite.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Cache/PSRSimpleRedisCacheTestSuite.php index a76e7e635..ecc5c36ef 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Cache/PSRSimpleRedisCacheTestSuite.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Cache/PSRSimpleRedisCacheTestSuite.php @@ -11,6 +11,7 @@ final class PSRSimpleRedisCacheTestSuite extends CacheBaseTestSuite { + #[\Override] protected function cache() : Cache { return new PSRSimpleCache(new Psr16Cache(new RedisAdapter( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/BranchingTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/BranchingTest.php index 7251a5891..cf857ce09 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/BranchingTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/BranchingTest.php @@ -70,6 +70,7 @@ public function test_branching_with_transformation() : void ref('group')->equals(lit('A')), to_memory($memoryA = new ArrayMemory()), )->withTransformation(new class implements Transformation { + #[\Override] public function transform(DataFrame $dataFrame) : DataFrame { return $dataFrame->withEntry('group_name', lit('A')); @@ -81,6 +82,7 @@ public function transform(DataFrame $dataFrame) : DataFrame ref('group')->isIn(lit(['B', 'C'])), to_memory($memoryBC = new ArrayMemory()), )->withTransformation(new class implements Transformation { + #[\Override] public function transform(DataFrame $dataFrame) : DataFrame { return $dataFrame->withEntry('group_name', lit('BC')); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/CacheTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/CacheTest.php index 3a5fe8496..9f7ab0102 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/CacheTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/CacheTest.php @@ -25,6 +25,7 @@ public function __construct(int $rowsets) $this->extractor = new FakeExtractor($rowsets); } + #[\Override] public function extract(FlowContext $context) : \Generator { $this->extractions++; diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/DisplayTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/DisplayTest.php index ac1a0eeab..f6a893a78 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/DisplayTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/DisplayTest.php @@ -37,6 +37,7 @@ public function test_display() : void /** * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { for ($i = 0; $i < 20; $i++) { @@ -107,6 +108,7 @@ public function test_display_partitioned() : void /** * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { for ($i = 0; $i < 5; $i++) { diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/JoinEachTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/JoinEachTest.php index 67747e643..d83a6ff0e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/JoinEachTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/JoinEachTest.php @@ -33,6 +33,7 @@ public function test_join_each() : void ->batchSize(4) ->joinEach( new class implements DataFrameFactory { + #[\Override] public function from(Rows $rows) : DataFrame { return data_frame()->process( @@ -85,6 +86,7 @@ public function test_join_each_without_prefix() : void ->batchSize(4) ->joinEach( new class implements DataFrameFactory { + #[\Override] public function from(Rows $rows) : DataFrame { return data_frame()->process( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/LimitTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/LimitTest.php index 5347815f6..d3e5165de 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/LimitTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/LimitTest.php @@ -65,6 +65,7 @@ public function test_fetch_without_limit() : void * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { for ($i = 0; $i < 20; $i++) { @@ -86,6 +87,7 @@ public function test_limit() : void * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { for ($i = 0; $i < 1000; $i++) { @@ -131,6 +133,7 @@ public function test_limit_when_transformation_is_expanding_rows_extracted_from_ * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { for ($i = 0; $i < 1000; $i++) { @@ -171,6 +174,7 @@ public function test_limit_with_batch_size() : void * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { for ($i = 0; $i < 1000; $i++) { @@ -194,6 +198,7 @@ public function test_limit_with_collecting() : void * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { for ($i = 0; $i < 100; $i++) { @@ -217,6 +222,7 @@ public function test_with_total_rows_below_the_limit() : void * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { for ($i = 0; $i < 5; $i++) { diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/OffsetTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/OffsetTest.php index 777519035..b634a0970 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/OffsetTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/OffsetTest.php @@ -123,6 +123,7 @@ public function test_offset_with_batch_size() : void * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { for ($i = 0; $i < 10; $i++) { @@ -157,6 +158,7 @@ public function test_offset_with_collect() : void * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { for ($i = 0; $i < 5; $i++) { @@ -188,6 +190,7 @@ public function test_offset_with_expanding_transformations() : void * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { for ($i = 0; $i < 100; $i++) { @@ -256,6 +259,7 @@ public function test_offset_with_multiple_batches() : void * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { for ($i = 0; $i < 10; $i++) { diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/FilesystemStreamsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/FilesystemStreamsTest.php index 3dd4237dc..0ed9281db 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/FilesystemStreamsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/FilesystemStreamsTest.php @@ -135,6 +135,7 @@ public function test_write_to_stdout() : void self::assertCount(1, $streams); } + #[\Override] protected function streams() : FilesystemStreams { return new FilesystemStreams($this->fstab()); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/FilesystemStreamsTestCase.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/FilesystemStreamsTestCase.php index 0ed4d99db..7db6136be 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/FilesystemStreamsTestCase.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/FilesystemStreamsTestCase.php @@ -9,6 +9,7 @@ abstract class FilesystemStreamsTestCase extends FlowIntegrationTestCase { + #[\Override] protected function filesDirectory() : string { return __DIR__ . '/tmp'; diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/NotPartitioned/AppendModeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/NotPartitioned/AppendModeTest.php index 733f7b4a9..6c93e7b6c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/NotPartitioned/AppendModeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/NotPartitioned/AppendModeTest.php @@ -62,6 +62,7 @@ public function test_open_stream_for_non_existing_file() : void self::assertSame('non-existing-file.txt', $files[0]->path->basename()); } + #[\Override] protected function streams() : FilesystemStreams { $streams = new FilesystemStreams($this->fstab()); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/NotPartitioned/ExceptionIfExistsModeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/NotPartitioned/ExceptionIfExistsModeTest.php index d19e7a9ab..ca342606e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/NotPartitioned/ExceptionIfExistsModeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/NotPartitioned/ExceptionIfExistsModeTest.php @@ -49,6 +49,7 @@ public function test_open_stream_for_non_existing_file() : void self::assertSame('some content', \file_get_contents($file->path())); } + #[\Override] protected function streams() : FilesystemStreams { $streams = new FilesystemStreams($this->fstab()); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/NotPartitioned/IgnoreModeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/NotPartitioned/IgnoreModeTest.php index 3f2b9cc8d..5447a11b6 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/NotPartitioned/IgnoreModeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/NotPartitioned/IgnoreModeTest.php @@ -51,6 +51,7 @@ public function test_open_stream_for_non_existing_file() : void self::assertSame('some content', \file_get_contents($path->path())); } + #[\Override] protected function streams() : FilesystemStreams { $streams = new FilesystemStreams($this->fstab()); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/NotPartitioned/OverwriteModeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/NotPartitioned/OverwriteModeTest.php index 2108f6911..26ec214a4 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/NotPartitioned/OverwriteModeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/NotPartitioned/OverwriteModeTest.php @@ -54,6 +54,7 @@ public function test_open_stream_for_non_existing_file() : void self::assertSame('some content', \file_get_contents($path->path())); } + #[\Override] protected function streams() : FilesystemStreams { $streams = new FilesystemStreams($this->fstab()); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/Partitioned/AppendModeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/Partitioned/AppendModeTest.php index 732f35c3e..55727e071 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/Partitioned/AppendModeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/Partitioned/AppendModeTest.php @@ -90,6 +90,7 @@ public function test_open_stream_for_non_existing_partition() : void self::assertSame('appended content', \file_get_contents($files[0]->path->path())); } + #[\Override] protected function streams() : FilesystemStreams { $streams = new FilesystemStreams($this->fstab()); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/Partitioned/ExceptionIfExistsModeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/Partitioned/ExceptionIfExistsModeTest.php index 2723d4729..d40f59806 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/Partitioned/ExceptionIfExistsModeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/Partitioned/ExceptionIfExistsModeTest.php @@ -79,6 +79,7 @@ public function test_open_stream_for_non_existing_partition() : void self::assertSame('file content', \file_get_contents($files[0]->path->path())); } + #[\Override] protected function streams() : FilesystemStreams { $streams = new FilesystemStreams($this->fstab()); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/Partitioned/IgnoreModeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/Partitioned/IgnoreModeTest.php index a36ced952..395671be9 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/Partitioned/IgnoreModeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/Partitioned/IgnoreModeTest.php @@ -87,6 +87,7 @@ public function test_open_stream_for_non_existing_partition() : void self::assertSame('appended content', \file_get_contents($files[0]->path->path())); } + #[\Override] protected function streams() : FilesystemStreams { $streams = new FilesystemStreams($this->fstab()); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/Partitioned/OverwriteModeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/Partitioned/OverwriteModeTest.php index d8e2795d1..7a0b9becc 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/Partitioned/OverwriteModeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Filesystem/FilesystemStreams/Partitioned/OverwriteModeTest.php @@ -111,6 +111,7 @@ public function test_open_stream_for_non_existing_partition_with_custom_schema() self::assertSame('new content', \file_get_contents($files[0]->path->path())); } + #[\Override] protected function streams() : FilesystemStreams { $streams = new FilesystemStreams($this->fstab()); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/DataFrameTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/DataFrameTest.php index 1bec62a43..87a2c151a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/DataFrameTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/DataFrameTest.php @@ -122,6 +122,7 @@ public function test_encapsulate_transformations() : void ) ) ->rows(new class implements Transformation { + #[\Override] public function transform(DataFrame $dataFrame) : DataFrame { return $dataFrame @@ -131,6 +132,7 @@ public function transform(DataFrame $dataFrame) : DataFrame }) ->rows( new class implements Transformation { + #[\Override] public function transform(DataFrame $dataFrame) : DataFrame { return $dataFrame->drop('gender') @@ -188,6 +190,7 @@ public function test_filter() : void * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { for ($i = 1; $i <= 10; $i++) { @@ -291,6 +294,7 @@ public function test_map() : void * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { for ($i = 1; $i <= 10; $i++) { @@ -348,6 +352,7 @@ public function test_pipeline() : void * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { yield rows(row(integer_entry('id', 101), boolean_entry('deleted', false), new DateTimeEntry('expiration-date', new \DateTimeImmutable('2020-08-24')), string_entry('phase', null))); @@ -357,6 +362,7 @@ public function extract(FlowContext $context) : \Generator }; $addStampStringEntry = new class implements Transformer { + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { return $rows->map( @@ -369,6 +375,7 @@ public function transform(Rows $rows, FlowContext $context) : Rows /** @var array */ public array $result = []; + #[\Override] public function load(Rows $rows, FlowContext $context) : void { $this->result = \array_merge($this->result, $rows->toArray()); @@ -379,6 +386,7 @@ public function load(Rows $rows, FlowContext $context) : void ->onError(new IgnoreError()) ->rows($addStampStringEntry) ->rows(new class implements Transformer { + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { throw new \RuntimeException('Unexpected exception'); @@ -523,6 +531,7 @@ public function test_with_batch_size() : void * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { yield rows(row(integer_entry('id', 1)), row(integer_entry('id', 2)), row(integer_entry('id', 3)), row(integer_entry('id', 4)), row(integer_entry('id', 5)), row(integer_entry('id', 6)), row(integer_entry('id', 7)), row(integer_entry('id', 8)), row(integer_entry('id', 9)), row(integer_entry('id', 10))); @@ -531,6 +540,7 @@ public function extract(FlowContext $context) : \Generator ) ->with( new class implements Transformer { + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { return $rows->map(fn (Row $row) => $row->rename('id', 'new_id')); @@ -540,6 +550,7 @@ public function transform(Rows $rows, FlowContext $context) : Rows ->batchSize(2) ->load( new class implements Loader { + #[\Override] public function load(Rows $rows, FlowContext $context) : void { Assert::assertCount(2, $rows); @@ -558,6 +569,7 @@ public function test_with_collecting() : void * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { yield rows(row(integer_entry('id', 1))); @@ -568,6 +580,7 @@ public function extract(FlowContext $context) : \Generator ) ->with( new class implements Transformer { + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { return $rows->map(fn (Row $row) => $row->rename('id', 'new_id')); @@ -577,6 +590,7 @@ public function transform(Rows $rows, FlowContext $context) : Rows ->collect() ->load( new class implements Loader { + #[\Override] public function load(Rows $rows, FlowContext $context) : void { Assert::assertCount(3, $rows); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/ETLErrorHandlingTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/ETLErrorHandlingTest.php index f474cc62e..aaab9bb68 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/ETLErrorHandlingTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/ETLErrorHandlingTest.php @@ -18,6 +18,7 @@ public function test_default_handler() : void * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { yield \Flow\ETL\DSL\rows(row(integer_entry('id', 101), boolean_entry('deleted', false), new DateTimeEntry('expiration-date', new \DateTimeImmutable('2020-08-24')), string_entry('phase', null))); @@ -27,6 +28,7 @@ public function extract(FlowContext $context) : \Generator }; $brokenTransformer = new class implements Transformer { + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { throw new \RuntimeException('Transformer Exception'); @@ -37,6 +39,7 @@ public function transform(Rows $rows, FlowContext $context) : Rows /** @var array */ public array $result = []; + #[\Override] public function load(Rows $rows, FlowContext $context) : void { $this->result = \array_merge($this->result, $rows->toArray()); @@ -62,6 +65,7 @@ public function test_ignore_error_handler() : void * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { yield \Flow\ETL\DSL\rows(row(integer_entry('id', 101), boolean_entry('deleted', false), new DateTimeEntry('expiration-date', new \DateTimeImmutable('2020-08-24')), string_entry('phase', null))); @@ -71,6 +75,7 @@ public function extract(FlowContext $context) : \Generator }; $brokenTransformer = new class implements Transformer { + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { throw new \RuntimeException('Transformer Exception'); @@ -81,6 +86,7 @@ public function transform(Rows $rows, FlowContext $context) : Rows /** @var array */ public array $result = []; + #[\Override] public function load(Rows $rows, FlowContext $context) : void { $this->result = \array_merge($this->result, $rows->toArray()); @@ -121,6 +127,7 @@ public function test_skip_rows_handler() : void * * @return \Generator */ + #[\Override] public function extract(FlowContext $context) : \Generator { yield \Flow\ETL\DSL\rows(row(integer_entry('id', 101), boolean_entry('deleted', false), new DateTimeEntry('expiration-date', new \DateTimeImmutable('2020-08-24')), string_entry('phase', null))); @@ -130,6 +137,7 @@ public function extract(FlowContext $context) : \Generator }; $brokenTransformer = new class implements Transformer { + #[\Override] public function transform(Rows $rows, FlowContext $context) : Rows { if ($rows->first()->valueOf('id') === 101) { @@ -144,6 +152,7 @@ public function transform(Rows $rows, FlowContext $context) : Rows /** @var array */ public array $result = []; + #[\Override] public function load(Rows $rows, FlowContext $context) : void { $this->result = \array_merge($this->result, $rows->toArray()); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Extractor/ChainExtractorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Extractor/ChainExtractorTest.php index 77d64a4b1..a1127e24c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Extractor/ChainExtractorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Extractor/ChainExtractorTest.php @@ -13,6 +13,7 @@ public function test_chain_extractor() : void { $extractor = from_all( new class implements Extractor { + #[\Override] public function extract(FlowContext $context) : \Generator { yield rows(row(int_entry('id', 1))); @@ -20,6 +21,7 @@ public function extract(FlowContext $context) : \Generator } }, new class implements Extractor { + #[\Override] public function extract(FlowContext $context) : \Generator { yield rows(row(int_entry('id', 3))); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/DOMElementParentTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/DOMElementParentTest.php index 01a0c4242..7d962b383 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/DOMElementParentTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/DOMElementParentTest.php @@ -24,7 +24,7 @@ public function test_html_fails_when_parent_not_available_in_strict_mode() : voi $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('DOMElementParent requires non-null DOMNode or HTMLElement.'); - ref('value')->domElementParent()->eval(row($context->entryFactory()->create('value', $element->documentElement->parentElement)), $context); + ref('value')->domElementParent()->eval(row($context->entryFactory()->create('value', $element->documentElement?->parentElement)), $context); } #[RequiresPhp('>= 8.4')] @@ -73,7 +73,7 @@ public function test_xml_getting_parent_element() : void self::assertEquals( $xml->documentElement, /* @phpstan-ignore-next-line */ - ref('value')->domElementParent()->eval(row(flow_context(config())->entryFactory()->create('value', $xml->documentElement->firstChild)), flow_context()) + ref('value')->domElementParent()->eval(row(flow_context(config())->entryFactory()->create('value', $xml->documentElement?->firstChild)), flow_context()) ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/UuidTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/UuidTest.php index e856a2b72..615991e5a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/UuidTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Function/UuidTest.php @@ -12,6 +12,7 @@ final class UuidTest extends FlowTestCase { + #[\Override] protected function setUp() : void { if (!\class_exists(Uuid::class) && !\class_exists(\Symfony\Component\Uid\Uuid::class)) { diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Loader/RetryLoaderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Loader/RetryLoaderTest.php index e05eeb3eb..4bb09c418 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Loader/RetryLoaderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Loader/RetryLoaderTest.php @@ -50,6 +50,7 @@ public function test_retry_loader_does_not_create_duplicates_retries_same_rows() public int $loads = 0; + #[\Override] public function load(Rows $rows, FlowContext $context) : void { $this->loads++; diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Loader/TransformerLoaderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Loader/TransformerLoaderTest.php index 3a9fec52d..c303f297b 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Loader/TransformerLoaderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Loader/TransformerLoaderTest.php @@ -50,6 +50,7 @@ public function test_transformer_loader_with_closure() : void \assert($closure_loader instanceof Loader); $transformer = to_transformation( new class implements Transformation { + #[\Override] public function transform(DataFrame $data_frame) : DataFrame { return $data_frame; @@ -89,6 +90,7 @@ public function test_transformer_loader_with_transformation() : void ->write( to_transformation( new class implements Transformation { + #[\Override] public function transform(DataFrame $dataFrame) : DataFrame { return $dataFrame->withEntry('id_string', ref('id')->cast(type_string())); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Pipeline/ClosureTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Pipeline/ClosureTest.php index ab0fc4a87..28fbacc5d 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Pipeline/ClosureTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Pipeline/ClosureTest.php @@ -21,11 +21,13 @@ public function test_loader_closure() : void public int $rowsLoaded = 0; + #[\Override] public function load(Rows $rows, FlowContext $context) : void { $this->rowsLoaded++; } + #[\Override] public function closure(FlowContext $context) : void { $this->closureCalled = true; diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Pipeline/OffsetPipelineTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Pipeline/OffsetPipelineTest.php index 474b5e62a..7cafef4ab 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Pipeline/OffsetPipelineTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Pipeline/OffsetPipelineTest.php @@ -147,6 +147,7 @@ public function test_process_with_empty_pipeline() : void public function test_process_with_multiple_batches_offset_skips_entire_batches() : void { $pipeline = new SynchronousPipeline(new class implements Extractor { + #[\Override] public function extract(FlowContext $context) : \Generator { yield rows( @@ -180,6 +181,7 @@ public function extract(FlowContext $context) : \Generator public function test_process_with_multiple_batches_offset_spanning_batches() : void { $pipeline = new SynchronousPipeline(new class implements Extractor { + #[\Override] public function extract(FlowContext $context) : \Generator { yield rows( @@ -219,6 +221,7 @@ public function extract(FlowContext $context) : \Generator public function test_process_with_multiple_batches_offset_within_first_batch() : void { $pipeline = new SynchronousPipeline(new class implements Extractor { + #[\Override] public function extract(FlowContext $context) : \Generator { yield rows( @@ -287,6 +290,7 @@ public function test_process_with_offset_larger_than_batch_size() : void public function test_process_with_offset_resulting_in_empty_batch() : void { $pipeline = new SynchronousPipeline(new class implements Extractor { + #[\Override] public function extract(FlowContext $context) : \Generator { yield rows( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/EnumEntryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/EnumEntryTest.php index 058741183..4636cd440 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/EnumEntryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/EnumEntryTest.php @@ -20,7 +20,7 @@ public function test_creating_backed_int_enum_entry() : void ); self::assertSame( 1, - $enum->value()->value, + $enum->value()?->value, ); } @@ -34,7 +34,7 @@ public function test_creating_backed_string_enum_entry() : void ); self::assertSame( 'one', - $enum->value()->value, + $enum->value()?->value, ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/UuidEntryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/UuidEntryTest.php index bd2f53300..dc69299bd 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/UuidEntryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/UuidEntryTest.php @@ -44,6 +44,7 @@ public static function valid_string_entries() : \Generator yield ['9a419c18-fc21-4481-9dea-5e9cf057d137']; } + #[\Override] protected function setUp() : void { if (!\class_exists(\Ramsey\Uuid\Uuid::class) && !\class_exists(\Symfony\Component\Uid\Uuid::class)) { diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/XMLElementEntryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/XMLElementEntryTest.php index 9c848acf7..a71366803 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/XMLElementEntryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/Entry/XMLElementEntryTest.php @@ -18,11 +18,11 @@ public function test_create_from_dom_document() : void $document->loadXML('User Name01'); /* @phpstan-ignore-next-line */ - $entry = xml_element_entry('node', $document->documentElement->firstChild); + $entry = xml_element_entry('node', $document->documentElement?->firstChild); self::assertInstanceOf(\DOMElement::class, $entry->value()); self::assertSame('User Name', $entry->toString()); - self::assertSame($document->documentElement, $entry->value()->parentNode); + self::assertSame($document->documentElement, $entry->value()?->parentNode); } public function test_create_from_string() : void @@ -62,6 +62,6 @@ public function test_serialization() : void self::assertTrue($entry->isEqual(type_instance_of(XMLElementEntry::class)->assert($unserialized))); self::assertInstanceOf(\DOMElement::class, $entry->value()); - self::assertEquals($element->attributes, $entry->value()->attributes); + self::assertEquals($element->attributes, $entry->value()?->attributes); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/EntryFactoryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/EntryFactoryTest.php index 4a99ee602..f26e40e3a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/EntryFactoryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Row/EntryFactoryTest.php @@ -74,6 +74,7 @@ public static function provide_unrecognized_data() : \Generator ]; } + #[\Override] protected function setUp() : void { $this->entryFactory = flow_context(config())->entryFactory(); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Transformer/JoinEachRowsTransformerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Transformer/JoinEachRowsTransformerTest.php index bc663190b..ae765ecb3 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Transformer/JoinEachRowsTransformerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Transformer/JoinEachRowsTransformerTest.php @@ -21,6 +21,7 @@ public function test_inner_join_rows() : void ); $right = new class implements DataFrameFactory { + #[\Override] public function from(Rows $rows) : DataFrame { return data_frame()->process( @@ -52,6 +53,7 @@ public function test_left_join_rows() : void row(int_entry('id', 3), str_entry('country', 'FR')), ); $right = new class implements DataFrameFactory { + #[\Override] public function from(Rows $rows) : DataFrame { return data_frame()->process( @@ -84,6 +86,7 @@ public function test_right_join_rows() : void row(int_entry('id', 3), str_entry('country', 'FR')), ); $right = new class implements DataFrameFactory { + #[\Override] public function from(Rows $rows) : DataFrame { return data_frame()->process( diff --git a/src/core/etl/tests/Flow/Serializer/Tests/Unit/CompressingSerializerTest.php b/src/core/etl/tests/Flow/Serializer/Tests/Unit/CompressingSerializerTest.php index 91035abfd..9e0de81f4 100644 --- a/src/core/etl/tests/Flow/Serializer/Tests/Unit/CompressingSerializerTest.php +++ b/src/core/etl/tests/Flow/Serializer/Tests/Unit/CompressingSerializerTest.php @@ -12,6 +12,7 @@ final class CompressingSerializerTest extends TestCase { + #[\Override] protected function setUp() : void { if (!\function_exists('gzcompress')) { diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/AuthorizationFactory/SharedKeyFactory.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/AuthorizationFactory/SharedKeyFactory.php index 91b5d3e29..b59fcbca1 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/AuthorizationFactory/SharedKeyFactory.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/AuthorizationFactory/SharedKeyFactory.php @@ -17,6 +17,7 @@ public function __construct( ) { } + #[\Override] public function for(RequestInterface $request) : string { $signature = $this->computeSignature( diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService.php index 27555249c..cd03b4bd1 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService.php @@ -48,6 +48,7 @@ public function __construct( * @throws AzureException * @throws ClientExceptionInterface */ + #[\Override] public function copyBlob(string $fromBlob, string $toBlob, CopyBlobOptions $options = new CopyBlobOptions()) : void { $request = $this->httpFactory->put( @@ -66,7 +67,7 @@ public function copyBlob(string $fromBlob, string $toBlob, CopyBlobOptions $opti )); foreach ($options->toHeaders() as $header => $value) { - $request = $request->withHeader($header, (string) $value); + $request = $request->withHeader($header, $value); } $this->logger->info('Azure - Blob Service - Copy Blob', ['request' => $request]); @@ -89,6 +90,7 @@ public function copyBlob(string $fromBlob, string $toBlob, CopyBlobOptions $opti * @throws AzureException * @throws ClientExceptionInterface */ + #[\Override] public function deleteBlob(string $blob, DeleteBlobOptions $options = new DeleteBlobOptions()) : void { $request = $this->httpFactory->delete( @@ -102,7 +104,7 @@ public function deleteBlob(string $blob, DeleteBlobOptions $options = new Delete $request = $request->withHeader('date', \gmdate('D, d M Y H:i:s T', time())); foreach ($options->toHeaders() as $header => $value) { - $request = $request->withHeader($header, (string) $value); + $request = $request->withHeader($header, $value); } $this->logger->info('Azure - Blob Service - Delete Blob', ['request' => $request]); @@ -124,6 +126,7 @@ public function deleteBlob(string $blob, DeleteBlobOptions $options = new Delete * @throws AzureException * @throws ClientExceptionInterface */ + #[\Override] public function deleteContainer(DeleteContainerOptions $options = new DeleteContainerOptions()) : void { $request = $this->httpFactory->delete( @@ -137,7 +140,7 @@ public function deleteContainer(DeleteContainerOptions $options = new DeleteCont $request = $request->withHeader('date', \gmdate('D, d M Y H:i:s T', time())); foreach ($options->toHeaders() as $header => $value) { - $request = $request->withHeader($header, (string) $value); + $request = $request->withHeader($header, $value); } $this->logger->info('Azure - Blob Service - Delete Container', ['request' => $request]); @@ -159,6 +162,7 @@ public function deleteContainer(DeleteContainerOptions $options = new DeleteCont * @throws AzureException * @throws ClientExceptionInterface */ + #[\Override] public function getBlob(string $blob, GetBlobOptions $options = new GetBlobOptions()) : BlobContent { $request = $this->httpFactory->get( @@ -173,7 +177,7 @@ public function getBlob(string $blob, GetBlobOptions $options = new GetBlobOptio $request = $request->withHeader('date', \gmdate('D, d M Y H:i:s T', time())); foreach ($options->toHeaders() as $header => $value) { - $request = $request->withHeader($header, (string) $value); + $request = $request->withHeader($header, $value); } $this->logger->info('Azure - Blob Service - Get Blob', ['request' => $request]); @@ -197,6 +201,7 @@ public function getBlob(string $blob, GetBlobOptions $options = new GetBlobOptio * @throws AzureException * @throws ClientExceptionInterface */ + #[\Override] public function getBlobProperties(string $blob, GetBlobPropertiesOptions $options = new GetBlobPropertiesOptions()) : ?BlobProperties { $request = $this->httpFactory->get( @@ -211,7 +216,7 @@ public function getBlobProperties(string $blob, GetBlobPropertiesOptions $option $request = $request->withHeader('date', \gmdate('D, d M Y H:i:s T', time())); foreach ($options->toHeaders() as $header => $value) { - $request = $request->withHeader($header, (string) $value); + $request = $request->withHeader($header, $value); } $this->logger->info('Azure - Blob Service - Get Blob Properties', ['request' => $request]); @@ -235,6 +240,7 @@ public function getBlobProperties(string $blob, GetBlobPropertiesOptions $option return new BlobProperties($response); } + #[\Override] public function getBlockBlobBlockList(string $blob, GetBlockBlobBlockListOptions $options = new GetBlockBlobBlockListOptions()) : BlockList { $request = $this->httpFactory->get( @@ -251,7 +257,7 @@ public function getBlockBlobBlockList(string $blob, GetBlockBlobBlockListOptions $request = $request->withHeader('date', \gmdate('D, d M Y H:i:s T', time())); foreach ($options->toHeaders() as $header => $value) { - $request = $request->withHeader($header, (string) $value); + $request = $request->withHeader($header, $value); } $this->logger->info('Azure - Blob Service - Get Block Blob Block List', ['request' => $request]); @@ -339,6 +345,7 @@ public function getBlockBlobBlockList(string $blob, GetBlockBlobBlockListOptions * @throws AzureException * @throws ClientExceptionInterface */ + #[\Override] public function getContainerProperties(GetContainerPropertiesOptions $options = new GetContainerPropertiesOptions()) : ?ContainerProperties { $request = $this->httpFactory->get( @@ -355,7 +362,7 @@ public function getContainerProperties(GetContainerPropertiesOptions $options = $request = $request->withHeader('date', \gmdate('D, d M Y H:i:s T', time())); foreach ($options->toHeaders() as $header => $value) { - $request = $request->withHeader($header, (string) $value); + $request = $request->withHeader($header, $value); } $this->logger->info('Azure - Blob Service - Get Container Properties', ['request' => $request]); @@ -384,6 +391,7 @@ public function getContainerProperties(GetContainerPropertiesOptions $options = * * @return \Generator */ + #[\Override] public function listBlobs(ListBlobOptions $options = new ListBlobOptions()) : \Generator { $request = $this->httpFactory->get( @@ -400,7 +408,7 @@ public function listBlobs(ListBlobOptions $options = new ListBlobOptions()) : \G $request = $request->withHeader('date', \gmdate('D, d M Y H:i:s T', time())); foreach ($options->toHeaders() as $header => $value) { - $request = $request->withHeader($header, (string) $value); + $request = $request->withHeader($header, $value); } $this->logger->info('Azure - Blob Service - List Blobs', ['request' => $request]); @@ -455,6 +463,7 @@ public function listBlobs(ListBlobOptions $options = new ListBlobOptions()) : \G * * @throws AzureException */ + #[\Override] public function putBlockBlob(string $path, $content = null, ?int $size = null, PutBlockBlobOptions $options = new PutBlockBlobOptions()) : void { if ($content !== null) { @@ -481,7 +490,7 @@ public function putBlockBlob(string $path, $content = null, ?int $size = null, P ->withHeader('date', \gmdate('D, d M Y H:i:s T', time())); foreach ($options->toHeaders() as $header => $value) { - $request = $request->withHeader($header, (string) $value); + $request = $request->withHeader($header, $value); } if ($content) { @@ -515,6 +524,7 @@ public function putBlockBlob(string $path, $content = null, ?int $size = null, P * @throws AzureException * @throws ClientExceptionInterface */ + #[\Override] public function putBlockBlobBlock(string $path, string $blockId, $content, int $size, PutBlockBlobBlockOptions $options = new PutBlockBlobBlockOptions()) : void { $request = $this->httpFactory->put( @@ -534,7 +544,7 @@ public function putBlockBlobBlock(string $path, string $blockId, $content, int $ ->withHeader('content-length', (string) $size); foreach ($options->toHeaders() as $header => $value) { - $request = $request->withHeader($header, (string) $value); + $request = $request->withHeader($header, $value); } $request = $request @@ -558,6 +568,7 @@ public function putBlockBlobBlock(string $path, string $blockId, $content, int $ * @throws AzureException * @throws ClientExceptionInterface */ + #[\Override] public function putBlockBlobBlockList(string $path, BlockList $blockList, PutBlockBlobBlockListOptions $options = new PutBlockBlobBlockListOptions(), Serializer $serializer = new SimpleXMLSerializer()) : void { $request = $this->httpFactory->put( @@ -602,6 +613,7 @@ public function putBlockBlobBlockList(string $path, BlockList $blockList, PutBlo * @throws AzureException * @throws ClientExceptionInterface */ + #[\Override] public function putContainer(CreateContainerOptions $options = new CreateContainerOptions()) : void { $request = $this->httpFactory->put( @@ -618,7 +630,7 @@ public function putContainer(CreateContainerOptions $options = new CreateContain $request = $request->withHeader('date', \gmdate('D, d M Y H:i:s T', time())); foreach ($options->toHeaders() as $header => $value) { - $request = $request->withHeader($header, (string) $value); + $request = $request->withHeader($header, $value); } $this->logger->info('Azure - Blob Service - Put Container', ['request' => $request]); diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/CopyBlob/CopyBlobOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/CopyBlob/CopyBlobOptions.php index 7c5cd65ab..dae41d52a 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/CopyBlob/CopyBlobOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/CopyBlob/CopyBlobOptions.php @@ -35,6 +35,7 @@ final class CopyBlobOptions implements EndpointOptions /** * @return array */ + #[\Override] public function toHeaders() : array { $headers = []; @@ -61,6 +62,7 @@ public function toHeaders() : array /** * @return array */ + #[\Override] public function toURIParameters() : array { $uriParameters = []; diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/CreateContainer/CreateContainerOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/CreateContainer/CreateContainerOptions.php index 839a13a56..b414bb617 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/CreateContainer/CreateContainerOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/CreateContainer/CreateContainerOptions.php @@ -21,6 +21,7 @@ final class CreateContainerOptions implements EndpointOptions /** * @return array */ + #[\Override] public function toHeaders() : array { $headers = []; @@ -42,6 +43,7 @@ public function toHeaders() : array /** * @return array */ + #[\Override] public function toURIParameters() : array { $uriParameters = []; diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/DeleteBlob/DeleteBlobOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/DeleteBlob/DeleteBlobOptions.php index b84084d6b..1349ca3aa 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/DeleteBlob/DeleteBlobOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/DeleteBlob/DeleteBlobOptions.php @@ -29,6 +29,7 @@ final class DeleteBlobOptions implements EndpointOptions /** * @return array */ + #[\Override] public function toHeaders() : array { $headers = []; @@ -56,6 +57,7 @@ public function toHeaders() : array /** * @return array */ + #[\Override] public function toURIParameters() : array { $uriParameters = []; diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/DeleteContainer/DeleteContainerOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/DeleteContainer/DeleteContainerOptions.php index 68e330d56..4dc351452 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/DeleteContainer/DeleteContainerOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/DeleteContainer/DeleteContainerOptions.php @@ -21,6 +21,7 @@ final class DeleteContainerOptions implements EndpointOptions /** * @return array */ + #[\Override] public function toHeaders() : array { $headers = []; @@ -42,6 +43,7 @@ public function toHeaders() : array /** * @return array */ + #[\Override] public function toURIParameters() : array { $uriParameters = []; diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlob/GetBlobOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlob/GetBlobOptions.php index fc79c47bc..fd2c71706 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlob/GetBlobOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlob/GetBlobOptions.php @@ -39,6 +39,7 @@ final class GetBlobOptions implements EndpointOptions /** * @return array */ + #[\Override] public function toHeaders() : array { $headers = []; @@ -88,6 +89,7 @@ public function toHeaders() : array /** * @return array */ + #[\Override] public function toURIParameters() : array { $uriParameters = []; diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlobProperties/GetBlobPropertiesOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlobProperties/GetBlobPropertiesOptions.php index 8962c5b14..2e29fa833 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlobProperties/GetBlobPropertiesOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlobProperties/GetBlobPropertiesOptions.php @@ -31,6 +31,7 @@ final class GetBlobPropertiesOptions implements EndpointOptions /** * @return array */ + #[\Override] public function toHeaders() : array { $headers = []; @@ -64,6 +65,7 @@ public function toHeaders() : array /** * @return array */ + #[\Override] public function toURIParameters() : array { $uriParameters = []; diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlockBlobBlockList/GetBlockBlobBlockListOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlockBlobBlockList/GetBlockBlobBlockListOptions.php index 8ffec614c..8e8626c7a 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlockBlobBlockList/GetBlockBlobBlockListOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetBlockBlobBlockList/GetBlockBlobBlockListOptions.php @@ -28,6 +28,7 @@ final class GetBlockBlobBlockListOptions implements EndpointOptions /** * @return array */ + #[\Override] public function toHeaders() : array { $headers = []; @@ -49,6 +50,7 @@ public function toHeaders() : array /** * @return array */ + #[\Override] public function toURIParameters() : array { $uriParameters = []; diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetContainerProperties/GetContainerPropertiesOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetContainerProperties/GetContainerPropertiesOptions.php index ad72d386d..2c1315b94 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetContainerProperties/GetContainerPropertiesOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/GetContainerProperties/GetContainerPropertiesOptions.php @@ -23,6 +23,7 @@ final class GetContainerPropertiesOptions implements EndpointOptions /** * @return array */ + #[\Override] public function toHeaders() : array { $headers = []; @@ -44,6 +45,7 @@ public function toHeaders() : array /** * @return array */ + #[\Override] public function toURIParameters() : array { $uriParameters = []; diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/ListBlobs/ListBlobOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/ListBlobs/ListBlobOptions.php index b3ab0eca9..0a18eb98a 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/ListBlobs/ListBlobOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/ListBlobs/ListBlobOptions.php @@ -38,6 +38,7 @@ public function __construct() /** * @return array */ + #[\Override] public function toHeaders() : array { $headers = []; @@ -55,6 +56,7 @@ public function toHeaders() : array /** * @return array|int|string> */ + #[\Override] public function toURIParameters() : array { $uriParameters = []; diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/PutBlockBlob/PutBlockBlobOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/PutBlockBlob/PutBlockBlobOptions.php index 1efc9b6ce..9399a2b31 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/PutBlockBlob/PutBlockBlobOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/PutBlockBlob/PutBlockBlobOptions.php @@ -25,6 +25,7 @@ final class PutBlockBlobOptions implements EndpointOptions /** * @return array */ + #[\Override] public function toHeaders() : array { $headers = []; @@ -56,6 +57,7 @@ public function toHeaders() : array /** * @return array */ + #[\Override] public function toURIParameters() : array { $uriParameters = []; diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/PutBlockBlobBlock/PutBlockBlobBlockOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/PutBlockBlobBlock/PutBlockBlobBlockOptions.php index a3943b07d..8eed61de6 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/PutBlockBlobBlock/PutBlockBlobBlockOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/PutBlockBlobBlock/PutBlockBlobBlockOptions.php @@ -25,6 +25,7 @@ final class PutBlockBlobBlockOptions implements EndpointOptions /** * @return array */ + #[\Override] public function toHeaders() : array { $headers = []; @@ -55,6 +56,7 @@ public function toHeaders() : array /** * @return array */ + #[\Override] public function toURIParameters() : array { $uriParameters = []; diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/PutBlockBlobBlockList/PutBlockBlobBlockListOptions.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/PutBlockBlobBlockList/PutBlockBlobBlockListOptions.php index 5138317d9..c84cc5397 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/PutBlockBlobBlockList/PutBlockBlobBlockListOptions.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/PutBlockBlobBlockList/PutBlockBlobBlockListOptions.php @@ -27,6 +27,7 @@ final class PutBlockBlobBlockListOptions implements EndpointOptions /** * @return array */ + #[\Override] public function toHeaders() : array { $headers = []; @@ -61,6 +62,7 @@ public function toHeaders() : array /** * @return array */ + #[\Override] public function toURIParameters() : array { $uriParameters = []; diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/PutBlockBlobBlockList/SimpleXMLSerializer.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/PutBlockBlobBlockList/SimpleXMLSerializer.php index 1bfabb0eb..40b5b08f7 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/PutBlockBlobBlockList/SimpleXMLSerializer.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/PutBlockBlobBlockList/SimpleXMLSerializer.php @@ -17,6 +17,7 @@ public function __construct() } } + #[\Override] public function serialize(mixed $data) : string { if (!$data instanceof BlockList) { diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/URLFactory/AzureURLFactory.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/URLFactory/AzureURLFactory.php index 1dd5f453d..ec8acb57f 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/URLFactory/AzureURLFactory.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/URLFactory/AzureURLFactory.php @@ -14,6 +14,7 @@ public function __construct(private string $host = 'blob.core.windows.net') } + #[\Override] public function create(Configuration $configuration, ?string $path = null, array $queryParameters = []) : string { return \sprintf( diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/URLFactory/AzuriteURLFactory.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/URLFactory/AzuriteURLFactory.php index 45d3d1c2f..56cb6ea6b 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/URLFactory/AzuriteURLFactory.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService/URLFactory/AzuriteURLFactory.php @@ -13,6 +13,7 @@ public function __construct(private string $host = '127.0.0.1', private string $ { } + #[\Override] public function create(Configuration $configuration, ?string $path = null, array $queryParameters = []) : string { return \sprintf( diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/Normalizer/SimpleXMLNormalizer.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/Normalizer/SimpleXMLNormalizer.php index 468be3835..9804e3cdd 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/Normalizer/SimpleXMLNormalizer.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/Normalizer/SimpleXMLNormalizer.php @@ -19,6 +19,7 @@ public function __construct() /** * @return array */ + #[\Override] public function toArray(string $data) : array { return $this->normalize(new \SimpleXMLElement($data)); diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/MySQLDialect.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/MySQLDialect.php index 7c6985761..fda6ea5db 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/MySQLDialect.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/MySQLDialect.php @@ -20,6 +20,7 @@ public function __construct(private AbstractPlatform $platform) * * @return string */ + #[\Override] public function prepareDelete(TableDefinition $table, BulkData $bulkData) : string { $columns = $bulkData->columns()->all(); @@ -49,6 +50,7 @@ public function prepareDelete(TableDefinition $table, BulkData $bulkData) : stri * * @return string */ + #[\Override] public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?InsertOptions $options = null) : string { if ($options === null) { @@ -98,6 +100,7 @@ public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?Inser * * @return string */ + #[\Override] public function prepareUpdate(TableDefinition $table, BulkData $bulkData, ?UpdateOptions $options = null) : string { return \sprintf( diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/MySQLInsertOptions.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/MySQLInsertOptions.php index 47405ff52..0db1de75c 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/MySQLInsertOptions.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/MySQLInsertOptions.php @@ -21,6 +21,7 @@ public function __construct( ) { } + #[\Override] public static function fromArray(array $options) : InsertOptions { $options = type_structure( @@ -39,6 +40,7 @@ public static function fromArray(array $options) : InsertOptions ); } + #[\Override] public static function new() : self { return new self(); diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/MySQLUpdateOptions.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/MySQLUpdateOptions.php index a04cc1355..574b4cd78 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/MySQLUpdateOptions.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/MySQLUpdateOptions.php @@ -8,11 +8,13 @@ final class MySQLUpdateOptions implements UpdateOptions { + #[\Override] public static function fromArray(array $options) : UpdateOptions { return new self(); } + #[\Override] public static function new() : UpdateOptions { return new self(); diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/PostgreSQLDialect.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/PostgreSQLDialect.php index f902f5653..58159d448 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/PostgreSQLDialect.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/PostgreSQLDialect.php @@ -20,6 +20,7 @@ public function __construct(private AbstractPlatform $platform) * * @return string */ + #[\Override] public function prepareDelete(TableDefinition $table, BulkData $bulkData) : string { $columns = $bulkData->columns()->all(); @@ -49,6 +50,7 @@ public function prepareDelete(TableDefinition $table, BulkData $bulkData) : stri * * @return string */ + #[\Override] public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?InsertOptions $options = null) : string { if ($options === null) { @@ -110,6 +112,7 @@ public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?Inser * * @return string */ + #[\Override] public function prepareUpdate(TableDefinition $table, BulkData $bulkData, ?UpdateOptions $options = null) : string { if ($options === null) { diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/PostgreSQLInsertOptions.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/PostgreSQLInsertOptions.php index 196dba144..353c9d9f4 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/PostgreSQLInsertOptions.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/PostgreSQLInsertOptions.php @@ -24,6 +24,7 @@ public function __construct( /** * @param array $options */ + #[\Override] public static function fromArray(array $options) : InsertOptions { $options = type_structure( @@ -43,6 +44,7 @@ public static function fromArray(array $options) : InsertOptions ); } + #[\Override] public static function new() : self { return new self(); diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/PostgreSQLUpdateOptions.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/PostgreSQLUpdateOptions.php index 8ef707972..aff7cf5db 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/PostgreSQLUpdateOptions.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/PostgreSQLUpdateOptions.php @@ -22,6 +22,7 @@ public function __construct( /** * @param array $options */ + #[\Override] public static function fromArray(array $options) : UpdateOptions { $options = type_structure( @@ -37,6 +38,7 @@ public static function fromArray(array $options) : UpdateOptions ); } + #[\Override] public static function new() : UpdateOptions { return new self(); diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/SqliteDialect.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/SqliteDialect.php index 9844f331f..de6c5280f 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/SqliteDialect.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/SqliteDialect.php @@ -19,6 +19,7 @@ public function __construct(private AbstractPlatform $platform) * * @return string */ + #[\Override] public function prepareDelete(TableDefinition $table, BulkData $bulkData) : string { $columns = $bulkData->columns()->all(); @@ -42,6 +43,7 @@ public function prepareDelete(TableDefinition $table, BulkData $bulkData) : stri ); } + #[\Override] public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?InsertOptions $options = null) : string { if ($options === null) { @@ -82,6 +84,7 @@ public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?Inser ); } + #[\Override] public function prepareUpdate(TableDefinition $table, BulkData $bulkData, ?UpdateOptions $updateOptions = null) : string { return \sprintf( diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/SqliteInsertOptions.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/SqliteInsertOptions.php index c8181d838..4f2523f21 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/SqliteInsertOptions.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/SqliteInsertOptions.php @@ -23,6 +23,7 @@ public function __construct( /** * @param array $options */ + #[\Override] public static function fromArray(array $options) : InsertOptions { $options = type_structure( @@ -41,6 +42,7 @@ public static function fromArray(array $options) : InsertOptions ); } + #[\Override] public static function new() : self { return new self(); diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/SqliteUpdateOptions.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/SqliteUpdateOptions.php index 0ffc140f2..a27b5db42 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/SqliteUpdateOptions.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/SqliteUpdateOptions.php @@ -8,11 +8,13 @@ final class SqliteUpdateOptions implements UpdateOptions { + #[\Override] public static function fromArray(array $options) : UpdateOptions { return new self(); } + #[\Override] public static function new() : UpdateOptions { return new self(); diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/QueryFactory/DbalQueryFactory.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/QueryFactory/DbalQueryFactory.php index f098d2f08..288056af6 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/QueryFactory/DbalQueryFactory.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/QueryFactory/DbalQueryFactory.php @@ -19,6 +19,7 @@ final class DbalQueryFactory implements QueryFactory * * @return string */ + #[\Override] public function delete(AbstractPlatform $platform, TableDefinition $table, BulkData $bulkData) : string { return (new DbalPlatform($platform))->dialect()->prepareDelete($table, $bulkData); @@ -34,6 +35,7 @@ public function delete(AbstractPlatform $platform, TableDefinition $table, BulkD * * @return string */ + #[\Override] public function insert(AbstractPlatform $platform, TableDefinition $table, BulkData $bulkData, ?InsertOptions $options = null) : string { return (new DbalPlatform($platform))->dialect()->prepareInsert($table, $bulkData, $options); @@ -49,6 +51,7 @@ public function insert(AbstractPlatform $platform, TableDefinition $table, BulkD * * @return string */ + #[\Override] public function update(AbstractPlatform $platform, TableDefinition $table, BulkData $bulkData, ?UpdateOptions $options = null) : string { return (new DbalPlatform($platform))->dialect()->prepareUpdate($table, $bulkData, $options); diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Context/ProxyLogger.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Context/ProxyLogger.php index 76e8ee92f..01cafcc29 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Context/ProxyLogger.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Context/ProxyLogger.php @@ -17,6 +17,7 @@ public function __construct() $this->logger = new NullLogger(); } + #[\Override] public function log($level, $message, array $context = []) : void { if (!isset($context['sql'])) { diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/IntegrationTestCase.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/IntegrationTestCase.php index 2db38f12c..0543ee3c5 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/IntegrationTestCase.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/IntegrationTestCase.php @@ -20,6 +20,7 @@ public function __construct(string $name) parent::__construct($name); } + #[\Override] protected function tearDown() : void { $this->databaseContext->dropAllTables(); diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/MysqlIntegrationTestCase.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/MysqlIntegrationTestCase.php index e5e811a64..a2e9c6108 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/MysqlIntegrationTestCase.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/MysqlIntegrationTestCase.php @@ -11,6 +11,7 @@ abstract class MysqlIntegrationTestCase extends IntegrationTestCase { + #[\Override] protected function setUp() : void { $this->databaseContext = new DatabaseContext( diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/PostgreSqlIntegrationTestCase.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/PostgreSqlIntegrationTestCase.php index 36b4aadc2..f4c8173cb 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/PostgreSqlIntegrationTestCase.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/PostgreSqlIntegrationTestCase.php @@ -11,6 +11,7 @@ abstract class PostgreSqlIntegrationTestCase extends IntegrationTestCase { + #[\Override] protected function setUp() : void { $this->databaseContext = new DatabaseContext( diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/SqliteIntegrationTestCase.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/SqliteIntegrationTestCase.php index a6fdf04f9..79f27afc8 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/SqliteIntegrationTestCase.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/SqliteIntegrationTestCase.php @@ -12,6 +12,7 @@ abstract class SqliteIntegrationTestCase extends IntegrationTestCase { + #[\Override] protected function setUp() : void { $path = type_string()->assert(\getenv('SQLITE_DATABASE_PATH')); diff --git a/src/lib/filesystem/src/Flow/Filesystem/Local/Memory/MemoryStream.php b/src/lib/filesystem/src/Flow/Filesystem/Local/Memory/MemoryStream.php index 4cd3ea420..58d58b000 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Local/Memory/MemoryStream.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Local/Memory/MemoryStream.php @@ -25,6 +25,7 @@ public function __destruct() } } + #[\Override] public function append(string $data) : DestinationStream { fwrite($this->handle, $data); @@ -35,10 +36,12 @@ public function append(string $data) : DestinationStream /** * We are not closing memory streams, in order to cleanup memory use rm on Memory Filesystem. */ + #[\Override] public function close() : void { } + #[\Override] public function content() : string { \fseek($this->handle, 0); @@ -52,6 +55,7 @@ public function content() : string return $content; } + #[\Override] public function fromResource($resource) : DestinationStream { stream_copy_to_stream($resource, $this->handle); @@ -59,11 +63,13 @@ public function fromResource($resource) : DestinationStream return $this; } + #[\Override] public function isOpen() : bool { return true; } + #[\Override] public function iterate(int $length = 1) : \Generator { \fseek($this->handle, 0); @@ -73,11 +79,13 @@ public function iterate(int $length = 1) : \Generator } } + #[\Override] public function path() : Path { return $this->path; } + #[\Override] public function read(int $length, int $offset) : string { \fseek($this->handle, $offset); @@ -85,6 +93,7 @@ public function read(int $length, int $offset) : string return (string) \fread($this->handle, $length); } + #[\Override] public function readLines(string $separator = "\n", ?int $length = null) : \Generator { \fseek($this->handle, 0); @@ -94,6 +103,7 @@ public function readLines(string $separator = "\n", ?int $length = null) : \Gene } } + #[\Override] public function size() : ?int { $stat = \fstat($this->handle); diff --git a/src/lib/filesystem/src/Flow/Filesystem/Local/MemoryFilesystem.php b/src/lib/filesystem/src/Flow/Filesystem/Local/MemoryFilesystem.php index 36a4a8209..0df5eb93f 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Local/MemoryFilesystem.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Local/MemoryFilesystem.php @@ -24,6 +24,7 @@ public function __construct(?\php_user_filter $filter = null) $this->memory = new Memory($filter); } + #[\Override] public function appendTo(Path $path) : DestinationStream { $this->protocol()->validateScheme($path); @@ -31,11 +32,13 @@ public function appendTo(Path $path) : DestinationStream return $this->memory->for($path); } + #[\Override] public function getSystemTmpDir() : Path { throw new RuntimeException('Memory does not have a system tmp directory'); } + #[\Override] public function list(Path $path, Filter $pathFilter = new KeepAll()) : \Generator { $this->protocol()->validateScheme($path); @@ -60,16 +63,19 @@ public function list(Path $path, Filter $pathFilter = new KeepAll()) : \Generato } } + #[\Override] public function mv(Path $from, Path $to) : bool { throw new RuntimeException('Cannot move files around in memory'); } + #[\Override] public function protocol() : Protocol { return new Protocol('memory'); } + #[\Override] public function readFrom(Path $path) : SourceStream { $this->protocol()->validateScheme($path); @@ -81,6 +87,7 @@ public function readFrom(Path $path) : SourceStream return $this->memory->for($path); } + #[\Override] public function rm(Path $path) : bool { $this->protocol()->validateScheme($path); @@ -107,6 +114,7 @@ public function rm(Path $path) : bool return $removed; } + #[\Override] public function status(Path $path) : ?FileStatus { $this->protocol()->validateScheme($path); @@ -128,6 +136,7 @@ public function status(Path $path) : ?FileStatus return null; } + #[\Override] public function writeTo(Path $path) : DestinationStream { $this->protocol()->validateScheme($path); diff --git a/src/lib/filesystem/src/Flow/Filesystem/Local/NativeLocalFilesystem.php b/src/lib/filesystem/src/Flow/Filesystem/Local/NativeLocalFilesystem.php index 8e7fec44d..41b7e8b5b 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Local/NativeLocalFilesystem.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Local/NativeLocalFilesystem.php @@ -17,6 +17,7 @@ */ final class NativeLocalFilesystem implements Filesystem { + #[\Override] public function appendTo(Path $path) : DestinationStream { if ($path->isEqual($this->getSystemTmpDir())) { @@ -38,11 +39,13 @@ public function appendTo(Path $path) : DestinationStream return NativeLocalDestinationStream::openAppend($path); } + #[\Override] public function getSystemTmpDir() : Path { return \Flow\Filesystem\DSL\path(\sys_get_temp_dir()); } + #[\Override] public function list(Path $path, Filter $pathFilter = new OnlyFiles()) : \Generator { $this->protocol()->validateScheme($path); @@ -65,6 +68,7 @@ public function list(Path $path, Filter $pathFilter = new OnlyFiles()) : \Genera } } + #[\Override] public function mv(Path $from, Path $to) : bool { $this->protocol()->validateScheme($from); @@ -81,11 +85,13 @@ public function mv(Path $from, Path $to) : bool return true; } + #[\Override] public function protocol() : Protocol { return new Protocol('file'); } + #[\Override] public function readFrom(Path $path) : SourceStream { $this->protocol()->validateScheme($path); @@ -103,6 +109,7 @@ public function readFrom(Path $path) : SourceStream return NativeLocalSourceStream::open($path); } + #[\Override] public function rm(Path $path) : bool { $this->protocol()->validateScheme($path); @@ -136,6 +143,7 @@ public function rm(Path $path) : bool return (bool) $deletedCount; } + #[\Override] public function status(Path $path) : ?FileStatus { $this->protocol()->validateScheme($path); @@ -156,6 +164,7 @@ public function status(Path $path) : ?FileStatus return null; } + #[\Override] public function writeTo(Path $path) : DestinationStream { if ($path->isEqual($this->getSystemTmpDir())) { diff --git a/src/lib/filesystem/src/Flow/Filesystem/Local/StdOut/StdOutDestinationStream.php b/src/lib/filesystem/src/Flow/Filesystem/Local/StdOut/StdOutDestinationStream.php index 9e7353e5a..8d8975431 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Local/StdOut/StdOutDestinationStream.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Local/StdOut/StdOutDestinationStream.php @@ -34,6 +34,7 @@ public function __construct(private readonly Path $path, ?\php_user_filter $filt } } + #[\Override] public function append(string $data) : DestinationStream { if (\is_resource($this->handle)) { @@ -43,6 +44,7 @@ public function append(string $data) : DestinationStream return $this; } + #[\Override] public function close() : void { if (\is_resource($this->handle)) { @@ -50,6 +52,7 @@ public function close() : void } } + #[\Override] public function fromResource($resource) : DestinationStream { if (\is_resource($this->handle)) { @@ -59,11 +62,13 @@ public function fromResource($resource) : DestinationStream return $this; } + #[\Override] public function isOpen() : bool { return \is_resource($this->handle); } + #[\Override] public function path() : Path { return $this->path; diff --git a/src/lib/filesystem/src/Flow/Filesystem/Local/StdOutFilesystem.php b/src/lib/filesystem/src/Flow/Filesystem/Local/StdOutFilesystem.php index 50c74e92a..00250655a 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Local/StdOutFilesystem.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Local/StdOutFilesystem.php @@ -16,6 +16,7 @@ public function __construct(private ?\php_user_filter $filter = null) { } + #[\Override] public function appendTo(Path $path) : DestinationStream { $this->protocol()->validateScheme($path); @@ -23,41 +24,49 @@ public function appendTo(Path $path) : DestinationStream return new StdOutDestinationStream($path, $this->filter); } + #[\Override] public function getSystemTmpDir() : Path { throw new RuntimeException('StdOut does not have a system tmp directory'); } + #[\Override] public function list(Path $path, Filter $pathFilter = new KeepAll()) : \Generator { yield from []; } + #[\Override] public function mv(Path $from, Path $to) : bool { throw new RuntimeException('Cannot move files around in stdout'); } + #[\Override] public function protocol() : Protocol { return new Protocol('stdout'); } + #[\Override] public function readFrom(Path $path) : SourceStream { throw new RuntimeException('Cannot read from stdout'); } + #[\Override] public function rm(Path $path) : bool { throw new RuntimeException('Cannot read from stdout'); } + #[\Override] public function status(Path $path) : ?FileStatus { return null; } + #[\Override] public function writeTo(Path $path) : DestinationStream { $this->protocol()->validateScheme($path); diff --git a/src/lib/filesystem/src/Flow/Filesystem/Local/StreamFilter/Intercept.php b/src/lib/filesystem/src/Flow/Filesystem/Local/StreamFilter/Intercept.php index 1cd9fc68f..a403f3a1e 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Local/StreamFilter/Intercept.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Local/StreamFilter/Intercept.php @@ -14,6 +14,7 @@ final class Intercept extends \php_user_filter * @param int $consumed * @param bool $closing */ + #[\Override] public function filter($in, $out, &$consumed, bool $closing) : int { while ($bucket = stream_bucket_make_writeable($in)) { diff --git a/src/lib/filesystem/src/Flow/Filesystem/Partitions.php b/src/lib/filesystem/src/Flow/Filesystem/Partitions.php index 4813030bc..2086aed42 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Partitions.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Partitions.php @@ -22,6 +22,7 @@ public function __construct(Partition ...$partitions) $this->partitions = \array_values($partitions); } + #[\Override] public function count() : int { return \count($this->partitions); @@ -38,6 +39,7 @@ public function get(string $name) : Partition throw new InvalidArgumentException("Partition with name: '{$name}' not found"); } + #[\Override] public function getIterator() : \Traversable { return new \ArrayIterator($this->partitions); @@ -68,6 +70,7 @@ public function id() : string return \hash('xxh128', $id); } + #[\Override] public function offsetExists(mixed $offset) : bool { return \array_key_exists($offset, $this->partitions); @@ -76,16 +79,19 @@ public function offsetExists(mixed $offset) : bool /** * @return Partition */ + #[\Override] public function offsetGet(mixed $offset) : mixed { return $this->partitions[$offset]; } + #[\Override] public function offsetSet(mixed $offset, mixed $value) : void { throw new RuntimeException('Partitions are immutable'); } + #[\Override] public function offsetUnset(mixed $offset) : void { throw new RuntimeException('Partitions are immutable'); diff --git a/src/lib/filesystem/src/Flow/Filesystem/Path/Filter/Filters.php b/src/lib/filesystem/src/Flow/Filesystem/Path/Filter/Filters.php index e65826363..e45feca60 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Path/Filter/Filters.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Path/Filter/Filters.php @@ -19,6 +19,7 @@ public function __construct(Filter ...$filters) $this->filters = $filters; } + #[\Override] public function accept(FileStatus $status) : bool { foreach ($this->filters as $filter) { diff --git a/src/lib/filesystem/src/Flow/Filesystem/Path/Filter/KeepAll.php b/src/lib/filesystem/src/Flow/Filesystem/Path/Filter/KeepAll.php index e9aa46884..e2f357732 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Path/Filter/KeepAll.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Path/Filter/KeepAll.php @@ -8,6 +8,7 @@ final class KeepAll implements Filter { + #[\Override] public function accept(FileStatus $status) : bool { return true; diff --git a/src/lib/filesystem/src/Flow/Filesystem/Path/Filter/OnlyFiles.php b/src/lib/filesystem/src/Flow/Filesystem/Path/Filter/OnlyFiles.php index eabef3428..73749029e 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Path/Filter/OnlyFiles.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Path/Filter/OnlyFiles.php @@ -9,6 +9,7 @@ final class OnlyFiles implements Filter { + #[\Override] public function accept(FileStatus $status) : bool { return $status->isFile(); diff --git a/src/lib/filesystem/src/Flow/Filesystem/Stream/Block/BlockVoidLifecycle.php b/src/lib/filesystem/src/Flow/Filesystem/Stream/Block/BlockVoidLifecycle.php index c0f145ace..b30ffc8fb 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Stream/Block/BlockVoidLifecycle.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Stream/Block/BlockVoidLifecycle.php @@ -12,6 +12,7 @@ public function create(int $size, Block $block) : void { } + #[\Override] public function filled(Block $block) : void { } diff --git a/src/lib/filesystem/src/Flow/Filesystem/Stream/Block/NativeLocalFileBlocksFactory.php b/src/lib/filesystem/src/Flow/Filesystem/Stream/Block/NativeLocalFileBlocksFactory.php index b9efecdce..be3a7fed1 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Stream/Block/NativeLocalFileBlocksFactory.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Stream/Block/NativeLocalFileBlocksFactory.php @@ -31,6 +31,7 @@ public function __construct(?string $blockLocation = null) $this->blockLocation = $blockLocation ?: \sys_get_temp_dir(); } + #[\Override] public function create(int $size) : Block { $id = generate_random_string(); diff --git a/src/lib/filesystem/src/Flow/Filesystem/Stream/MemorySourceStream.php b/src/lib/filesystem/src/Flow/Filesystem/Stream/MemorySourceStream.php index 663f6188b..ea02a15b1 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Stream/MemorySourceStream.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Stream/MemorySourceStream.php @@ -20,20 +20,24 @@ public function __construct(private string $content) } } + #[\Override] public function close() : void { } + #[\Override] public function content() : string { return $this->content; } + #[\Override] public function isOpen() : bool { return true; } + #[\Override] public function iterate(int $length = 1) : \Generator { foreach (\str_split($this->content, $length) as $chunk) { @@ -41,16 +45,19 @@ public function iterate(int $length = 1) : \Generator } } + #[\Override] public function path() : Path { return \Flow\Filesystem\DSL\path('memory://'); } + #[\Override] public function read(int $length, int $offset) : string { return \substr($this->content, $offset, $length); } + #[\Override] public function readLines(string $separator = "\n", ?int $length = null) : \Generator { /** @phpstan-ignore-next-line */ @@ -61,6 +68,7 @@ public function readLines(string $separator = "\n", ?int $length = null) : \Gene } } + #[\Override] public function size() : int { return \strlen($this->content); diff --git a/src/lib/filesystem/src/Flow/Filesystem/Stream/NativeLocalDestinationStream.php b/src/lib/filesystem/src/Flow/Filesystem/Stream/NativeLocalDestinationStream.php index 222e4a6af..7e321f5fc 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Stream/NativeLocalDestinationStream.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Stream/NativeLocalDestinationStream.php @@ -52,6 +52,7 @@ public static function openBlank(Path $path) : self return new self($path, $resource); } + #[\Override] public function append(string $data) : self { if (!$this->isOpen()) { @@ -64,6 +65,7 @@ public function append(string $data) : self return $this; } + #[\Override] public function close() : void { if (!\is_resource($this->handle)) { @@ -79,6 +81,7 @@ public function close() : void /** * @param resource $resource */ + #[\Override] public function fromResource($resource) : self { if (!\is_resource($resource)) { @@ -100,11 +103,13 @@ public function fromResource($resource) : self return $this; } + #[\Override] public function isOpen() : bool { return \is_resource($this->handle); } + #[\Override] public function path() : Path { return $this->path; diff --git a/src/lib/filesystem/src/Flow/Filesystem/Stream/NativeLocalSourceStream.php b/src/lib/filesystem/src/Flow/Filesystem/Stream/NativeLocalSourceStream.php index e38d078e9..21cff6816 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Stream/NativeLocalSourceStream.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Stream/NativeLocalSourceStream.php @@ -37,6 +37,7 @@ public static function open(Path $path) : self return new self($path, $resource); } + #[\Override] public function close() : void { if (!\is_resource($this->handle)) { @@ -49,6 +50,7 @@ public function close() : void $this->handle = null; } + #[\Override] public function content() : string { if (!$this->isOpen()) { @@ -66,6 +68,7 @@ public function content() : string return $content; } + #[\Override] public function isOpen() : bool { return \is_resource($this->handle); @@ -76,6 +79,7 @@ public function isOpen() : bool * * @return \Generator */ + #[\Override] public function iterate(int $length = 1) : \Generator { if (!$this->isOpen()) { @@ -95,11 +99,13 @@ public function iterate(int $length = 1) : \Generator } } + #[\Override] public function path() : Path { return $this->path; } + #[\Override] public function read(int $length, int $offset) : string { if (!$this->isOpen()) { @@ -118,6 +124,7 @@ public function read(int $length, int $offset) : string * * @return \Generator */ + #[\Override] public function readLines(string $separator = "\n", ?int $length = null) : \Generator { if (!$this->isOpen()) { @@ -137,6 +144,7 @@ public function readLines(string $separator = "\n", ?int $length = null) : \Gene } } + #[\Override] public function size() : int { $size = \filesize($this->path->path()); diff --git a/src/lib/filesystem/src/Flow/Filesystem/Stream/VoidStream.php b/src/lib/filesystem/src/Flow/Filesystem/Stream/VoidStream.php index 419b3dc97..0f9e0908d 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Stream/VoidStream.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Stream/VoidStream.php @@ -13,30 +13,36 @@ public function __construct(private Path $path) } + #[\Override] public function append(string $data) : self { return $this; } + #[\Override] public function close() : void { } + #[\Override] public function content() : string { return ''; } + #[\Override] public function fromResource($resource) : self { return $this; } + #[\Override] public function isOpen() : bool { return true; } + #[\Override] public function iterate(int $length = 1) : \Generator { /** @phpstan-ignore-next-line */ @@ -45,16 +51,19 @@ public function iterate(int $length = 1) : \Generator } } + #[\Override] public function path() : Path { return $this->path; } + #[\Override] public function read(int $length, int $offset) : string { return ''; } + #[\Override] public function readLines(string $separator = "\n", ?int $length = null) : \Generator { /** @phpstan-ignore-next-line */ @@ -63,6 +72,7 @@ public function readLines(string $separator = "\n", ?int $length = null) : \Gene } } + #[\Override] public function size() : int { return 0; diff --git a/src/lib/filesystem/src/Flow/Filesystem/Stream/VoidStreamWrapper.php b/src/lib/filesystem/src/Flow/Filesystem/Stream/VoidStreamWrapper.php index 1839f30ef..448bbab83 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Stream/VoidStreamWrapper.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Stream/VoidStreamWrapper.php @@ -13,6 +13,7 @@ final class VoidStreamWrapper implements StreamWrapper */ public $context; + #[\Override] public static function register() : void { if (!\in_array(self::PROTOCOL, \stream_get_wrappers(), true)) { @@ -20,55 +21,66 @@ public static function register() : void } } + #[\Override] public function stream_close() : void { } + #[\Override] public function stream_eof() : bool { return false; } + #[\Override] public function stream_flush() : bool { return true; } + #[\Override] public function stream_lock(int $operation) : bool { return true; } + #[\Override] public function stream_open(string $path, string $mode, int $options, ?string &$opened_path) : bool { return true; } + #[\Override] public function stream_read(int $count) : string|false { return false; } + #[\Override] public function stream_seek(int $offset, int $whence = SEEK_SET) : bool { return false; } + #[\Override] public function stream_stat() : array|false { return false; } + #[\Override] public function stream_tell() : int { return 0; } + #[\Override] public function stream_write(string $data) : int { return 0; } + #[\Override] public function url_stat(string $path, int $flags) : array|false { return false; diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Double/FakeNativeLocalFilesystem.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Double/FakeNativeLocalFilesystem.php index fb662921d..b69f5a983 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Double/FakeNativeLocalFilesystem.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Double/FakeNativeLocalFilesystem.php @@ -14,6 +14,7 @@ final class FakeNativeLocalFilesystem implements Filesystem { + #[\Override] public function appendTo(Path $path) : DestinationStream { if ($path->isEqual($this->getSystemTmpDir())) { @@ -35,11 +36,13 @@ public function appendTo(Path $path) : DestinationStream return NativeLocalDestinationStream::openAppend($path); } + #[\Override] public function getSystemTmpDir() : Path { return \Flow\Filesystem\DSL\path(\sys_get_temp_dir()); } + #[\Override] public function list(Path $path, Filter $pathFilter = new OnlyFiles()) : \Generator { $this->protocol()->validateScheme($path); @@ -62,6 +65,7 @@ public function list(Path $path, Filter $pathFilter = new OnlyFiles()) : \Genera } } + #[\Override] public function mv(Path $from, Path $to) : bool { $this->protocol()->validateScheme($from); @@ -78,11 +82,13 @@ public function mv(Path $from, Path $to) : bool return true; } + #[\Override] public function protocol() : Protocol { return new Protocol('fake'); } + #[\Override] public function readFrom(Path $path) : SourceStream { $this->protocol()->validateScheme($path); @@ -100,6 +106,7 @@ public function readFrom(Path $path) : SourceStream return NativeLocalSourceStream::open($path); } + #[\Override] public function rm(Path $path) : bool { $this->protocol()->validateScheme($path); @@ -133,6 +140,7 @@ public function rm(Path $path) : bool return (bool) $deletedCount; } + #[\Override] public function status(Path $path) : ?FileStatus { $this->protocol()->validateScheme($path); @@ -153,6 +161,7 @@ public function status(Path $path) : ?FileStatus return null; } + #[\Override] public function writeTo(Path $path) : DestinationStream { if ($path->isEqual($this->getSystemTmpDir())) { diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/Local/MemoryFilesystemTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/Local/MemoryFilesystemTest.php index d7372ab79..0f6cefa52 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/Local/MemoryFilesystemTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/Local/MemoryFilesystemTest.php @@ -93,7 +93,7 @@ public function test_file_status_on_pattern() : void self::assertTrue($fs->status(path_memory('/var/some_path_to/file.txt'))->isFile()); self::assertSame( 'memory://var/some_path_to/file.txt', - $fs->status(path_memory('/var/some_path_to/*.txt'))->path->uri() + $fs->status(path_memory('/var/some_path_to/*.txt'))?->path->uri() ); } diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/NativeLocalFilesystemTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/NativeLocalFilesystemTest.php index 9a204d11c..01ecda860 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/NativeLocalFilesystemTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/NativeLocalFilesystemTest.php @@ -14,6 +14,7 @@ final class NativeLocalFilesystemTest extends NativeLocalFilesystemTestCase { + #[\Override] protected function setUp() : void { if (!\file_exists(__DIR__ . '/var')) { diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/NativeLocalFilesystemTestCase.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/NativeLocalFilesystemTestCase.php index 5d13a3156..235056a5f 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/NativeLocalFilesystemTestCase.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/NativeLocalFilesystemTestCase.php @@ -10,6 +10,7 @@ abstract class NativeLocalFilesystemTestCase extends TestCase { + #[\Override] protected function setUp() : void { $fs = new NativeLocalFilesystem(); diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/NativeLocalFilesystemTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/NativeLocalFilesystemTest.php index b60fa4439..7fd149c6f 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/NativeLocalFilesystemTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/NativeLocalFilesystemTest.php @@ -16,6 +16,7 @@ final class NativeLocalFilesystemTest extends NativeLocalFilesystemTestCase { use OperatingSystem; + #[\Override] protected function setUp() : void { parent::setUp(); @@ -35,7 +36,7 @@ public function test_file_status_on_pattern_unix_uri_format() : void self::assertSame( 'file://' . ltrim(__DIR__, '/') . '/../var/some_path_to/file.txt', - $fs->status(path(__DIR__ . '/../var/some_path_to/*.txt'))->path->uri() + $fs->status(path(__DIR__ . '/../var/some_path_to/*.txt'))?->path->uri() ); $fs->rm(path(__DIR__ . '/../var/some_path_to')); diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/PathTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/PathTest.php index 3cbd886a3..0fcf45e57 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/PathTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/PathTest.php @@ -12,6 +12,7 @@ final class PathTest extends FlowIntegrationTestCase { use OperatingSystem; + #[\Override] protected function setUp() : void { parent::setUp(); diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/RealpathTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/RealpathTest.php index f2f8d5c76..d3b692054 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/RealpathTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/RealpathTest.php @@ -21,6 +21,7 @@ public static function double_dots_paths() : \Generator yield ['/path/more/nested/..//../file.txt', '/path/file.txt']; } + #[\Override] protected function setup() : void { parent::setUp(); diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/Stream/BlocksUnixSpecificTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/Stream/BlocksUnixSpecificTest.php index 206cbeadf..d3387f0b4 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/Stream/BlocksUnixSpecificTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/Stream/BlocksUnixSpecificTest.php @@ -17,6 +17,7 @@ final class BlocksUnixSpecificTest extends TestCase { use OperatingSystem; + #[\Override] protected function setUp() : void { parent::setUp(); diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/Stream/BlocksUnixTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/Stream/BlocksUnixTest.php index c302dc199..3ba501436 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/Stream/BlocksUnixTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Unix/Stream/BlocksUnixTest.php @@ -13,6 +13,7 @@ final class BlocksUnixTest extends TestCase { use OperatingSystem; + #[\Override] protected function setUp() : void { parent::setUp(); diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/NativeLocalFilesystemTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/NativeLocalFilesystemTest.php index 8257b1fd1..8982f209c 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/NativeLocalFilesystemTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/NativeLocalFilesystemTest.php @@ -12,6 +12,7 @@ final class NativeLocalFilesystemTest extends NativeLocalFilesystemTestCase { use OperatingSystem; + #[\Override] protected function setUp() : void { parent::setUp(); @@ -32,7 +33,7 @@ public function test_file_status_on_pattern_windows() : void $expectedUri = 'file://' . \str_replace('\\', '/', __DIR__ . '/../var/some_path_to/file.txt'); self::assertSame( $expectedUri, - $fs->status(path(__DIR__ . '/../var/some_path_to/*.txt'))->path->uri() + $fs->status(path(__DIR__ . '/../var/some_path_to/*.txt'))?->path->uri() ); $fs->rm(path(__DIR__ . '/../var/some_path_to')); diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/PathTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/PathTest.php index 423ac6c43..d549e4795 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/PathTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/PathTest.php @@ -12,6 +12,7 @@ final class PathTest extends FlowIntegrationTestCase { use OperatingSystem; + #[\Override] protected function setUp() : void { parent::setUp(); diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/RealpathTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/RealpathTest.php index 48e3cf80e..740a1eb71 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/RealpathTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/RealpathTest.php @@ -20,6 +20,7 @@ public static function windows_backslash_normalization() : \Generator yield ['D:\\Documents\\Projects', 'D:/Documents/Projects']; } + #[\Override] protected function setUp() : void { parent::setUp(); diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/Stream/BlocksWindowsSpecificTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/Stream/BlocksWindowsSpecificTest.php index 3a6cd60b0..43ca3b0ed 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/Stream/BlocksWindowsSpecificTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/Stream/BlocksWindowsSpecificTest.php @@ -18,6 +18,7 @@ final class BlocksWindowsSpecificTest extends TestCase { use OperatingSystem; + #[\Override] protected function setUp() : void { parent::setUp(); diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/Stream/BlocksWindowsTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/Stream/BlocksWindowsTest.php index 279e3bebf..1d4250e3e 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/Stream/BlocksWindowsTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/OS/Windows/Stream/BlocksWindowsTest.php @@ -14,6 +14,7 @@ final class BlocksWindowsTest extends TestCase { use OperatingSystem; + #[\Override] protected function setUp() : void { parent::setUp(); diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/PathTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/PathTest.php index 07e71d597..7e97dab8e 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/PathTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/PathTest.php @@ -69,6 +69,7 @@ public static function paths_with_static_parts() : \Generator yield '/nested/partition=[one]/*.csv' => ['file://nested', '/nested/partition=[one]/*.csv']; } + #[\Override] protected function setUp() : void { if (!\file_exists(__DIR__ . '/var')) { diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/PathTestCase.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/PathTestCase.php index 57d5bbb9f..dc0a29b3f 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/PathTestCase.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/PathTestCase.php @@ -65,6 +65,7 @@ public static function paths_with_static_parts() : \Generator yield '/nested/partition=[one]/*.csv' => ['file://nested', '/nested/partition=[one]/*.csv']; } + #[\Override] protected function setUp() : void { if (!\file_exists(__DIR__ . '/var')) { diff --git a/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadDDLCommand.php b/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadDDLCommand.php index cb14c8112..7001f6b4c 100644 --- a/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadDDLCommand.php +++ b/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadDDLCommand.php @@ -16,12 +16,14 @@ #[AsCommand(name: 'read:ddl', description: 'Read DDL from parquet file')] final class ReadDDLCommand extends Command { + #[\Override] protected function configure() : void { $this ->addArgument('file', InputArgument::REQUIRED, 'path to parquet file'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output) : int { $style = new SymfonyStyle($input, $output); diff --git a/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadDataCommand.php b/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadDataCommand.php index c30386c3a..7387f0639 100644 --- a/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadDataCommand.php +++ b/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadDataCommand.php @@ -18,6 +18,7 @@ #[AsCommand(name: 'read:data', description: 'Read data from parquet file')] final class ReadDataCommand extends Command { + #[\Override] protected function configure() : void { $this @@ -28,6 +29,7 @@ protected function configure() : void ->addOption('truncate', 't', InputOption::VALUE_OPTIONAL, 'Truncate values in cells to given length, use empty to not truncate the output', 20); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output) : int { $style = new SymfonyStyle($input, $output); diff --git a/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadMetadataCommand.php b/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadMetadataCommand.php index 2a6cfd255..ccf3376d6 100644 --- a/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadMetadataCommand.php +++ b/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadMetadataCommand.php @@ -19,6 +19,7 @@ #[AsCommand(name: 'read:metadata', description: 'Read metadata from parquet file')] final class ReadMetadataCommand extends Command { + #[\Override] protected function configure() : void { $this @@ -30,6 +31,7 @@ protected function configure() : void ->addOption('page-headers', null, InputOption::VALUE_NONE, 'Display page headers details'); } + #[\Override] protected function execute(InputInterface $input, OutputInterface $output) : int { $style = new SymfonyStyle($input, $output); diff --git a/src/lib/parquet/src/Flow/Parquet/BinaryReader/BinaryBufferReader.php b/src/lib/parquet/src/Flow/Parquet/BinaryReader/BinaryBufferReader.php index de9e547ac..d20eba8ef 100644 --- a/src/lib/parquet/src/Flow/Parquet/BinaryReader/BinaryBufferReader.php +++ b/src/lib/parquet/src/Flow/Parquet/BinaryReader/BinaryBufferReader.php @@ -22,16 +22,19 @@ public function __construct(private string $buffer, private ByteOrder $byteOrder $this->length = new DataSize($bits); } + #[\Override] public function length() : DataSize { return $this->length; } + #[\Override] public function position() : DataSize { return $this->position; } + #[\Override] public function readBits(int $total) : \Generator { $bytePosition = $this->position()->bytes(); @@ -58,6 +61,7 @@ public function readBits(int $total) : \Generator } } + #[\Override] public function readBooleans(int $total) : \Generator { foreach ($this->readBits($total) as $bit) { @@ -65,6 +69,7 @@ public function readBooleans(int $total) : \Generator } } + #[\Override] public function readByteArrays(int $total) : \Generator { $position = $this->position()->bytes(); @@ -93,6 +98,7 @@ public function readByteArrays(int $total) : \Generator $this->remainingLength->sub($position * 8); } + #[\Override] public function readBytes(int $total) : Bytes { $bytes = \array_values(\unpack('C*', \substr($this->buffer, $this->position()->bytes(), $total))); @@ -103,6 +109,7 @@ public function readBytes(int $total) : Bytes return new Bytes($bytes); } + #[\Override] public function readDecimals(int $total, int $byteLength, int $precision = 10, int $scale = 2) : \Generator { $allBytes = $this->readBytes($byteLength * $total)->toArray(); @@ -122,6 +129,7 @@ public function readDecimals(int $total, int $byteLength, int $precision = 10, i } } + #[\Override] public function readDoubles(int $total) : \Generator { $doubleBytes = \array_chunk($this->readBytes(8 * $total)->toArray(), 8); @@ -131,6 +139,7 @@ public function readDoubles(int $total) : \Generator } } + #[\Override] public function readFloats(int $total) : \Generator { $floatBytes = \array_chunk($this->readBytes(4 * $total)->toArray(), 4); @@ -140,6 +149,7 @@ public function readFloats(int $total) : \Generator } } + #[\Override] public function readInts16(int $total) : \Generator { $intBytes = \array_chunk($this->readBytes(2 * $total)->toArray(), 2); @@ -160,6 +170,7 @@ public function readInts16(int $total) : \Generator } } + #[\Override] public function readInts32(int $total) : \Generator { $intBytes = \array_chunk($this->readBytes(4 * $total)->toArray(), 4); @@ -179,6 +190,7 @@ public function readInts32(int $total) : \Generator } } + #[\Override] public function readInts64(int $total) : \Generator { $intBytes = \array_chunk($this->readBytes(8 * $total)->toArray(), 8); @@ -204,6 +216,7 @@ public function readInts64(int $total) : \Generator } } + #[\Override] public function readInts96(int $total) : \Generator { $intsData = \substr($this->buffer, $this->position()->bytes(), 12 * $total); @@ -222,6 +235,7 @@ public function readInts96(int $total) : \Generator $this->remainingLength->sub(12 * $total * 8); } + #[\Override] public function readStrings(int $total) : \Generator { $position = $this->position()->bytes(); @@ -247,6 +261,7 @@ public function readStrings(int $total) : \Generator $this->remainingLength->sub($position * 8); } + #[\Override] public function readUInts32(int $total) : \Generator { $intBytes = \array_chunk($this->readBytes(4 * $total)->toArray(), 4); @@ -260,6 +275,7 @@ public function readUInts32(int $total) : \Generator } } + #[\Override] public function readUInts64(int $total) : \Generator { $intBytes = \array_chunk($this->readBytes(8 * $total)->toArray(), 8); @@ -275,6 +291,7 @@ public function readUInts64(int $total) : \Generator } } + #[\Override] public function readVarInt() : int { $result = 0; @@ -295,17 +312,20 @@ public function readVarInt() : int return $result; } + #[\Override] public function remainingLength() : DataSize { return $this->remainingLength; } + #[\Override] public function seekBits(int $bits) : void { $this->position->add($bits); $this->length->sub($bits); } + #[\Override] public function seekBytes(int $bytes) : void { $this->position->add($bytes * 8); diff --git a/src/lib/parquet/src/Flow/Parquet/BinaryReader/Bytes.php b/src/lib/parquet/src/Flow/Parquet/BinaryReader/Bytes.php index 7ec794b2f..f0d459c73 100644 --- a/src/lib/parquet/src/Flow/Parquet/BinaryReader/Bytes.php +++ b/src/lib/parquet/src/Flow/Parquet/BinaryReader/Bytes.php @@ -26,12 +26,14 @@ public static function fromString(string $string, ByteOrder $byteOrder = ByteOrd } // Countable methods + #[\Override] public function count() : int { return \count($this->bytes); } // IteratorAggregate methods + #[\Override] public function getIterator() : \ArrayIterator { if ($this->iterator === null) { @@ -42,16 +44,19 @@ public function getIterator() : \ArrayIterator } // ArrayAccess methods + #[\Override] public function offsetExists($offset) : bool { return isset($this->bytes[$offset]); } + #[\Override] public function offsetGet($offset) : mixed { return $this->bytes[$offset]; } + #[\Override] public function offsetSet($offset, $value) : void { if ($offset === null) { @@ -61,6 +66,7 @@ public function offsetSet($offset, $value) : void } } + #[\Override] public function offsetUnset($offset) : void { unset($this->bytes[$offset]); diff --git a/src/lib/parquet/src/Flow/Parquet/BinaryWriter/BinaryBufferWriter.php b/src/lib/parquet/src/Flow/Parquet/BinaryWriter/BinaryBufferWriter.php index 24d946747..b9970ab52 100644 --- a/src/lib/parquet/src/Flow/Parquet/BinaryWriter/BinaryBufferWriter.php +++ b/src/lib/parquet/src/Flow/Parquet/BinaryWriter/BinaryBufferWriter.php @@ -13,16 +13,19 @@ public function __construct(private string &$buffer, private readonly ByteOrder $this->buffer = ''; } + #[\Override] public function append(string $buffer) : void { $this->buffer .= $buffer; } + #[\Override] public function length() : DataSize { return DataSize::fromBytes(\strlen($this->buffer)); } + #[\Override] public function writeBits(array $bits) : void { $byte = 0; @@ -48,6 +51,7 @@ public function writeBits(array $bits) : void } } + #[\Override] public function writeBooleans(array $values) : void { $bits = []; @@ -58,11 +62,13 @@ public function writeBooleans(array $values) : void $this->writeBits($bits); } + #[\Override] public function writeBytes(array $bytes) : void { $this->buffer .= \pack('C*', ...$bytes); } + #[\Override] public function writeDecimals(array $decimals, int $byteLength, int $precision = 10, int $scale = 2) : void { $isBigEndian = $this->byteOrder === ByteOrder::BIG_ENDIAN; @@ -90,6 +96,7 @@ public function writeDecimals(array $decimals, int $byteLength, int $precision = } } + #[\Override] public function writeDoubles(array $doubles) : void { $format = $this->byteOrder === ByteOrder::BIG_ENDIAN ? 'E' : 'e'; @@ -99,6 +106,7 @@ public function writeDoubles(array $doubles) : void } } + #[\Override] public function writeFloats(array $floats) : void { $format = $this->byteOrder === ByteOrder::BIG_ENDIAN ? 'G' : 'g'; @@ -108,6 +116,7 @@ public function writeFloats(array $floats) : void } } + #[\Override] public function writeInts16(array $ints) : void { $format = $this->byteOrder === ByteOrder::BIG_ENDIAN ? 'n' : 'v'; @@ -117,6 +126,7 @@ public function writeInts16(array $ints) : void } } + #[\Override] public function writeInts32(array $ints) : void { $format = $this->byteOrder === ByteOrder::BIG_ENDIAN ? 'N' : 'V'; @@ -126,6 +136,7 @@ public function writeInts32(array $ints) : void } } + #[\Override] public function writeInts64(array $ints) : void { $format = $this->byteOrder === ByteOrder::BIG_ENDIAN ? 'J' : 'P'; @@ -138,6 +149,7 @@ public function writeInts64(array $ints) : void /** * @param array $strings */ + #[\Override] public function writeStrings(array $strings) : void { $format = $this->byteOrder === ByteOrder::BIG_ENDIAN ? 'N' : 'V'; @@ -149,6 +161,7 @@ public function writeStrings(array $strings) : void } } + #[\Override] public function writeVarInts(array $values) : void { foreach ($values as $value) { diff --git a/src/lib/parquet/src/Flow/Parquet/Dremel/Validator/ColumnDataValidator.php b/src/lib/parquet/src/Flow/Parquet/Dremel/Validator/ColumnDataValidator.php index e8a254459..2db3774ff 100644 --- a/src/lib/parquet/src/Flow/Parquet/Dremel/Validator/ColumnDataValidator.php +++ b/src/lib/parquet/src/Flow/Parquet/Dremel/Validator/ColumnDataValidator.php @@ -10,6 +10,7 @@ final class ColumnDataValidator implements Validator { + #[\Override] public function validate(Column $column, mixed $data) : void { if ($column->repetition()?->isRequired()) { diff --git a/src/lib/parquet/src/Flow/Parquet/Dremel/Validator/DisabledValidator.php b/src/lib/parquet/src/Flow/Parquet/Dremel/Validator/DisabledValidator.php index 0dba06154..6d3690497 100644 --- a/src/lib/parquet/src/Flow/Parquet/Dremel/Validator/DisabledValidator.php +++ b/src/lib/parquet/src/Flow/Parquet/Dremel/Validator/DisabledValidator.php @@ -9,6 +9,7 @@ final class DisabledValidator implements Validator { + #[\Override] public function validate(Column $column, mixed $data) : void { } diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/Int32DateConverter.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/Int32DateConverter.php index 6faa71507..b71b03445 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/Int32DateConverter.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/Int32DateConverter.php @@ -11,11 +11,13 @@ final class Int32DateConverter implements Converter { + #[\Override] public function fromParquetType(mixed $data) : \DateTimeImmutable { return $this->numberOfDaysToDateTime(type_integer()->assert($data)); } + #[\Override] public function isFor(FlatColumn $column, Options $options) : bool { if ($column->type() === PhysicalType::INT32 && $column->logicalType()?->name() === LogicalType::DATE) { @@ -29,6 +31,7 @@ public function isFor(FlatColumn $column, Options $options) : bool return false; } + #[\Override] public function toParquetType(mixed $data) : int { if (!$data instanceof \DateTime && !$data instanceof \DateTimeImmutable) { diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/Int32DateTimeConverter.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/Int32DateTimeConverter.php index 4ab2c9e2e..2bdb4b7bd 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/Int32DateTimeConverter.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/Int32DateTimeConverter.php @@ -12,11 +12,13 @@ final class Int32DateTimeConverter implements Converter { + #[\Override] public function fromParquetType(mixed $data) : \DateTimeImmutable { return $this->millisecondsToDateTimeImmutable(type_integer()->assert($data)); } + #[\Override] public function isFor(FlatColumn $column, Options $options) : bool { if ($column->type() === PhysicalType::INT32 && $column->logicalType()?->name() === LogicalType::TIMESTAMP) { @@ -26,6 +28,7 @@ public function isFor(FlatColumn $column, Options $options) : bool return false; } + #[\Override] public function toParquetType(mixed $data) : int { return $this->dateTimeToMicroseconds(type_instance_of(\DateTimeInterface::class)->assert($data)); diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/Int64DateTimeConverter.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/Int64DateTimeConverter.php index 2c666faf6..67f021721 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/Int64DateTimeConverter.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/Int64DateTimeConverter.php @@ -11,11 +11,13 @@ final class Int64DateTimeConverter implements Converter { + #[\Override] public function fromParquetType(mixed $data) : \DateTimeImmutable { return $this->microsecondsToDateTimeImmutable(type_integer()->assert($data)); } + #[\Override] public function isFor(FlatColumn $column, Options $options) : bool { if ($column->type() === PhysicalType::INT64 && $column->logicalType()?->name() === LogicalType::TIMESTAMP) { @@ -25,6 +27,7 @@ public function isFor(FlatColumn $column, Options $options) : bool return false; } + #[\Override] public function toParquetType(mixed $data) : int { return $this->dateTimeToMicroseconds(type_instance_of(\DateTimeInterface::class)->assert($data)); diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/Int96DateTimeConverter.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/Int96DateTimeConverter.php index 94916102d..152afddcb 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/Int96DateTimeConverter.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/Int96DateTimeConverter.php @@ -13,11 +13,13 @@ final class Int96DateTimeConverter implements Converter { + #[\Override] public function fromParquetType(mixed $data) : \DateTimeImmutable { return $this->convertArrayOfBytesToDateTime(type_instance_of(Bytes::class)->assert($data)); } + #[\Override] public function isFor(FlatColumn $column, Options $options) : bool { if ($column->type() === PhysicalType::INT96 && $options->get(Option::INT_96_AS_DATETIME)) { @@ -30,6 +32,7 @@ public function isFor(FlatColumn $column, Options $options) : bool /** * @return array */ + #[\Override] public function toParquetType(mixed $data) : array { throw new RuntimeException("Converting DateTime to INT96 is deprecated and should not be used, please use INT64 to store \DateTime objects as number of microseconds since Jan 1 1970."); diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/JsonConverter.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/JsonConverter.php index 57205de6c..e3772cb53 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/JsonConverter.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/JsonConverter.php @@ -11,6 +11,7 @@ final class JsonConverter implements Converter { + #[\Override] public function fromParquetType(mixed $data) : string { if (!\is_string($data)) { @@ -20,6 +21,7 @@ public function fromParquetType(mixed $data) : string return $data; } + #[\Override] public function isFor(FlatColumn $column, Options $options) : bool { if ($column->logicalType()?->name() === LogicalType::JSON) { @@ -29,6 +31,7 @@ public function isFor(FlatColumn $column, Options $options) : bool return false; } + #[\Override] public function toParquetType(mixed $data) : string { if (!\is_string($data)) { diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/TimeConverter.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/TimeConverter.php index 46c09f7ae..68f132caf 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/TimeConverter.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/TimeConverter.php @@ -12,11 +12,13 @@ final class TimeConverter implements Converter { + #[\Override] public function fromParquetType(mixed $data) : \DateInterval { return $this->toDateInterval(type_integer()->assert($data)); } + #[\Override] public function isFor(FlatColumn $column, Options $options) : bool { if ($column->type() === PhysicalType::INT64 && $column->logicalType()?->name() === LogicalType::TIME) { @@ -26,6 +28,7 @@ public function isFor(FlatColumn $column, Options $options) : bool return false; } + #[\Override] public function toParquetType(mixed $data) : int { return $this->toInt(type_instance_of(\DateInterval::class)->assert($data)); diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/UuidConverter.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/UuidConverter.php index b280c3aa8..aef30ff32 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/UuidConverter.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Data/Converter/UuidConverter.php @@ -11,6 +11,7 @@ final class UuidConverter implements Converter { + #[\Override] public function fromParquetType(mixed $data) : string { if (!\is_string($data)) { @@ -20,6 +21,7 @@ public function fromParquetType(mixed $data) : string return $data; } + #[\Override] public function isFor(FlatColumn $column, Options $options) : bool { if ($column->logicalType()?->name() === LogicalType::UUID) { @@ -29,6 +31,7 @@ public function isFor(FlatColumn $column, Options $options) : bool return false; } + #[\Override] public function toParquetType(mixed $data) : string { if (!\is_string($data)) { diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/FlatColumn.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/FlatColumn.php index 9981468be..76dddac85 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/FlatColumn.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/FlatColumn.php @@ -161,6 +161,7 @@ public function __debugInfo() : array ]; } + #[\Override] public function convertedType() : ?ConvertedType { return $this->convertedType; @@ -169,6 +170,7 @@ public function convertedType() : ?ConvertedType /** * @return array */ + #[\Override] public function ddl() : array { return [ @@ -178,6 +180,7 @@ public function ddl() : array ]; } + #[\Override] public function flatPath() : string { if ($this->flatPath !== null) { @@ -209,21 +212,25 @@ public function flatPath() : string return $this->flatPath; } + #[\Override] public function isList() : bool { return false; } + #[\Override] public function isMap() : bool { return false; } + #[\Override] public function isStruct() : bool { return false; } + #[\Override] public function logicalType() : ?LogicalType { return $this->logicalType; @@ -243,6 +250,7 @@ public function makeRequired() : self return new self($this->name, $this->type, $this->convertedType, $this->logicalType, Repetition::REQUIRED, $this->precision, $this->scale, $this->typeLength); } + #[\Override] public function maxDefinitionsLevel() : int { $level = $this->repetition === Repetition::REQUIRED ? 0 : 1; @@ -251,6 +259,7 @@ public function maxDefinitionsLevel() : int return $this->parent ? $level + $this->parent->maxDefinitionsLevel() : $level; } + #[\Override] public function maxRepetitionsLevel() : int { $level = $this->repetition === Repetition::REPEATED ? 1 : 0; @@ -258,16 +267,19 @@ public function maxRepetitionsLevel() : int return $this->parent ? $level + $this->parent->maxRepetitionsLevel() : $level; } + #[\Override] public function name() : string { return $this->name; } + #[\Override] public function parent() : ?NestedColumn { return $this->parent; } + #[\Override] public function path() : array { return \explode('.', $this->flatPath()); @@ -278,11 +290,13 @@ public function precision() : ?int return $this->precision; } + #[\Override] public function repetition() : ?Repetition { return $this->repetition; } + #[\Override] public function repetitions() : Repetitions { if ($this->repetitions !== null) { @@ -312,12 +326,14 @@ public function scale() : ?int return $this->scale; } + #[\Override] public function setParent(NestedColumn $parent) : void { $this->flatPath = null; $this->parent = $parent; } + #[\Override] public function toThrift() : SchemaElement { return new SchemaElement([ @@ -332,11 +348,13 @@ public function toThrift() : SchemaElement ]); } + #[\Override] public function type() : PhysicalType { return $this->type; } + #[\Override] public function typeLength() : ?int { return $this->typeLength; diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/NestedColumn.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/NestedColumn.php index cd21c6e53..06d7b59c1 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/NestedColumn.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/NestedColumn.php @@ -160,11 +160,13 @@ public function childrenFlat() : array return $flat; } + #[\Override] public function convertedType() : ?ConvertedType { return $this->convertedType; } + #[\Override] public function ddl() : array { $ddlArray = [ @@ -180,6 +182,7 @@ public function ddl() : array return $ddlArray; } + #[\Override] public function flatPath() : string { if ($this->flatPath !== null) { @@ -241,11 +244,13 @@ public function getMapValueColumn() : Column throw new InvalidArgumentException('Column ' . $this->flatPath() . ' is not a map'); } + #[\Override] public function isList() : bool { return $this->logicalType()?->name() === 'LIST' || $this->convertedType() === ConvertedType::LIST; } + #[\Override] public function isMap() : bool { return $this->logicalType()?->name() === 'MAP' || $this->convertedType() === ConvertedType::MAP; @@ -268,6 +273,7 @@ public function isMapElement() : bool return false; } + #[\Override] public function isStruct() : bool { if ($this->isMap()) { @@ -281,6 +287,7 @@ public function isStruct() : bool return true; } + #[\Override] public function logicalType() : ?LogicalType { return $this->logicalType; @@ -293,6 +300,7 @@ public function makeRequired() : self return $this; } + #[\Override] public function maxDefinitionsLevel() : int { if ($this->repetition === null) { @@ -304,6 +312,7 @@ public function maxDefinitionsLevel() : int return $this->parent ? $level + $this->parent->maxDefinitionsLevel() : $level; } + #[\Override] public function maxRepetitionsLevel() : int { if ($this->repetition === null) { @@ -315,26 +324,31 @@ public function maxRepetitionsLevel() : int return $this->parent ? $level + $this->parent->maxRepetitionsLevel() : $level; } + #[\Override] public function name() : string { return $this->name; } + #[\Override] public function parent() : ?self { return $this->parent; } + #[\Override] public function path() : array { return \explode('.', $this->flatPath()); } + #[\Override] public function repetition() : ?Repetition { return $this->repetition; } + #[\Override] public function repetitions() : Repetitions { if ($this->repetitions !== null) { @@ -360,6 +374,7 @@ public function repetitions() : Repetitions return $this->repetitions; } + #[\Override] public function setParent(self $parent) : void { $this->flatPath = null; @@ -373,6 +388,7 @@ public function setParent(self $parent) : void /** * @return array */ + #[\Override] public function toThrift() : array { $elements = [ @@ -398,11 +414,13 @@ public function toThrift() : array return $elements; } + #[\Override] public function type() : ?PhysicalType { return null; } + #[\Override] public function typeLength() : ?int { return null; diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/Repetitions.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/Repetitions.php index ea370de48..47fa64664 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/Repetitions.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/Repetitions.php @@ -47,11 +47,13 @@ public function __construct( $this->repeatedCount = $repeatedCount; } + #[\Override] public function __toString() : string { return $this->id; } + #[\Override] public function count() : int { return \count($this->repetitions); diff --git a/src/lib/parquet/src/Flow/Parquet/Thrift/MemoryBuffer.php b/src/lib/parquet/src/Flow/Parquet/Thrift/MemoryBuffer.php index 2cca025b0..a76d80978 100644 --- a/src/lib/parquet/src/Flow/Parquet/Thrift/MemoryBuffer.php +++ b/src/lib/parquet/src/Flow/Parquet/Thrift/MemoryBuffer.php @@ -27,11 +27,13 @@ public function __construct(protected string $data = '') $this->length = \strlen($this->data); } + #[\Override] public function available() : int { return $this->length - $this->position; } + #[\Override] public function close() : void { } @@ -41,15 +43,18 @@ public function data() : string return $this->data; } + #[\Override] public function isOpen() : bool { return true; } + #[\Override] public function open() : void { } + #[\Override] public function read(int $len) : string { $availableBytes = $this->length - $this->position; @@ -71,6 +76,7 @@ public function read(int $len) : string return $ret; } + #[\Override] public function write(string $buf) : void { $this->data .= $buf; diff --git a/src/lib/parquet/src/Flow/Parquet/Thrift/PhpFileStream.php b/src/lib/parquet/src/Flow/Parquet/Thrift/PhpFileStream.php index fd2cc8dbf..4b5d73f4f 100644 --- a/src/lib/parquet/src/Flow/Parquet/Thrift/PhpFileStream.php +++ b/src/lib/parquet/src/Flow/Parquet/Thrift/PhpFileStream.php @@ -27,11 +27,13 @@ public function __construct($resource) $this->stream = $resource; } + #[\Override] public function available() : int { return 1; } + #[\Override] public function close() : void { @\fclose($this->stream); @@ -43,11 +45,13 @@ public function flush() : void @\fflush($this->stream); } + #[\Override] public function isOpen() : bool { return \is_resource($this->stream); } + #[\Override] public function open() : void { if (!\is_resource($this->stream)) { @@ -55,6 +59,7 @@ public function open() : void } } + #[\Override] public function read(int $len) : string { $data = @\fread($this->stream, $len); @@ -66,6 +71,7 @@ public function read(int $len) : string return $data; } + #[\Override] public function write(string $buf) : void { while ($buf !== '') { diff --git a/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/DeltaBinaryPackedColumnChunkBuilder.php b/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/DeltaBinaryPackedColumnChunkBuilder.php index 0db6c8dfd..7204ce65b 100644 --- a/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/DeltaBinaryPackedColumnChunkBuilder.php +++ b/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/DeltaBinaryPackedColumnChunkBuilder.php @@ -71,6 +71,7 @@ public function __construct( } } + #[\Override] public function addRow(WriteColumnData $columnData) : void { $flatValues = $columnData->values($this->column->flatPath()); @@ -96,6 +97,7 @@ public function addRow(WriteColumnData $columnData) : void $this->rowsCount++; } + #[\Override] public function closePage() : void { if ($this->isEmpty()) { @@ -122,11 +124,13 @@ public function closePage() : void $this->pageStatistics = new StatisticsCounter($this->column); } + #[\Override] public function column() : Column { return $this->column; } + #[\Override] public function flush(int $fileOffset) : array { $this->closePage(); @@ -174,12 +178,14 @@ public function isEmpty() : bool && count($this->repetitionLevels) === 0; } + #[\Override] public function isFull() : bool { // Use the original estimation logic for compatibility with existing tests return $this->valueStorage->size() * ($this->column->type() === PhysicalType::INT32 ? 4 : 8) >= $this->options->get(Option::PAGE_SIZE_BYTES); } + #[\Override] public function uncompressedSize() : int { return $this->pages->uncompressedSize() + $this->currentPageUncompressedSize(); diff --git a/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/NestedColumnChunkBuilder.php b/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/NestedColumnChunkBuilder.php index 23828fac4..7cb9f3314 100644 --- a/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/NestedColumnChunkBuilder.php +++ b/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/NestedColumnChunkBuilder.php @@ -18,6 +18,7 @@ public function __construct(private NestedColumn $column, private array $childre { } + #[\Override] public function addRow(WriteColumnData $columnData) : void { foreach ($columnData->flatValues() as $flatValues) { @@ -33,6 +34,7 @@ public function addRow(WriteColumnData $columnData) : void } } + #[\Override] public function closePage() : void { foreach ($this->childrenColumnChunkBuilders as $childBuilder) { @@ -40,11 +42,13 @@ public function closePage() : void } } + #[\Override] public function column() : Column { return $this->column; } + #[\Override] public function flush(int $fileOffset) : array { $offset = $fileOffset; @@ -60,6 +64,7 @@ public function flush(int $fileOffset) : array return $containers; } + #[\Override] public function isFull() : bool { foreach ($this->childrenColumnChunkBuilders as $childBuilder) { @@ -71,6 +76,7 @@ public function isFull() : bool return false; } + #[\Override] public function uncompressedSize() : int { $size = 0; diff --git a/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/PlainFlatColumnChunkBuilder.php b/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/PlainFlatColumnChunkBuilder.php index aa81f519a..681de86ff 100644 --- a/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/PlainFlatColumnChunkBuilder.php +++ b/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/PlainFlatColumnChunkBuilder.php @@ -69,6 +69,7 @@ public function __construct( : new BufferValueStorage(); } + #[\Override] public function addRow(WriteColumnData $columnData) : void { $flatValues = $columnData->values($this->column->flatPath()); @@ -94,6 +95,7 @@ public function addRow(WriteColumnData $columnData) : void $this->rowsCount++; } + #[\Override] public function closePage() : void { if ($this->isEmpty()) { @@ -120,11 +122,13 @@ public function closePage() : void $this->pageStatistics = new StatisticsCounter($this->column); } + #[\Override] public function column() : Column { return $this->column; } + #[\Override] public function flush(int $fileOffset) : array { $this->closePage(); @@ -172,11 +176,13 @@ public function isEmpty() : bool && count($this->repetitionLevels) === 0; } + #[\Override] public function isFull() : bool { return $this->valueStorage->size() >= $this->options->get(Option::PAGE_SIZE_BYTES); } + #[\Override] public function uncompressedSize() : int { return $this->pages->uncompressedSize() + $this->currentPageUncompressedSize(); diff --git a/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/RLEDictionaryChunkBuilder.php b/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/RLEDictionaryChunkBuilder.php index a14fe8261..752df6721 100644 --- a/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/RLEDictionaryChunkBuilder.php +++ b/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/RLEDictionaryChunkBuilder.php @@ -70,6 +70,7 @@ public function __construct( $this->pageStatistics = new StatisticsCounter($this->column); } + #[\Override] public function addRow(WriteColumnData $columnData) : void { $flatValues = $columnData->values($this->column->flatPath()); @@ -93,6 +94,7 @@ public function addRow(WriteColumnData $columnData) : void $this->rowsCount++; } + #[\Override] public function closePage() : void { if ($this->isEmpty()) { @@ -134,11 +136,13 @@ public function closePage() : void $this->pageStatistics = new StatisticsCounter($this->column); } + #[\Override] public function column() : Column { return $this->column; } + #[\Override] public function flush(int $fileOffset) : array { $this->closePage(); @@ -187,11 +191,13 @@ public function isEmpty() : bool && count($this->repetitionLevels) === 0; } + #[\Override] public function isFull() : bool { return \count($this->pageValues) * 4 >= $this->options->get(Option::PAGE_SIZE_BYTES); } + #[\Override] public function uncompressedSize() : int { return $this->pages->uncompressedSize() + $this->currentPageUncompressedSize(); diff --git a/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/BooleanValueStorage.php b/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/BooleanValueStorage.php index cfdc3d7cf..88aa7e941 100644 --- a/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/BooleanValueStorage.php +++ b/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/BooleanValueStorage.php @@ -17,6 +17,7 @@ final class BooleanValueStorage implements ValueStorage /** * @param array $values */ + #[\Override] public function addValues(FlatColumn $column, array $values) : void { $nonNullValues = \array_filter($values, static fn (?bool $value) => $value !== null); @@ -26,6 +27,7 @@ public function addValues(FlatColumn $column, array $values) : void } } + #[\Override] public function getBuffer() : string { if (empty($this->values)) { @@ -39,16 +41,19 @@ public function getBuffer() : string return $buffer; } + #[\Override] public function isEmpty() : bool { return !\count($this->values); } + #[\Override] public function reset() : void { $this->values = []; } + #[\Override] public function size() : int { return \count($this->values); diff --git a/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/BufferValueStorage.php b/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/BufferValueStorage.php index 03d2c4359..6d846dc10 100644 --- a/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/BufferValueStorage.php +++ b/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/BufferValueStorage.php @@ -14,6 +14,7 @@ final class BufferValueStorage implements ValueStorage private int $size = 0; + #[\Override] public function addValues(FlatColumn $column, array $values) : void { $localBuffer = ''; @@ -22,22 +23,26 @@ public function addValues(FlatColumn $column, array $values) : void $this->size += \strlen($localBuffer); } + #[\Override] public function getBuffer() : string { return $this->buffer; } + #[\Override] public function isEmpty() : bool { return $this->buffer === ''; } + #[\Override] public function reset() : void { $this->buffer = ''; $this->size = 0; } + #[\Override] public function size() : int { return $this->size; diff --git a/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/DeltaBinaryPackedValueStorage.php b/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/DeltaBinaryPackedValueStorage.php index 5039956b3..2694238f9 100644 --- a/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/DeltaBinaryPackedValueStorage.php +++ b/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/DeltaBinaryPackedValueStorage.php @@ -15,6 +15,7 @@ final class DeltaBinaryPackedValueStorage implements ValueStorage */ private array $values = []; + #[\Override] public function addValues(FlatColumn $column, array $values) : void { if (!in_array($column->type(), [PhysicalType::INT32, PhysicalType::INT64], true)) { @@ -32,6 +33,7 @@ public function addValues(FlatColumn $column, array $values) : void } } + #[\Override] public function getBuffer() : string { if (!\count($this->values)) { @@ -41,16 +43,19 @@ public function getBuffer() : string return (new DeltaBinaryPackedEncoder())->encode($this->values); } + #[\Override] public function isEmpty() : bool { return empty($this->values); } + #[\Override] public function reset() : void { $this->values = []; } + #[\Override] public function size() : int { return \count($this->values); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/CompressionTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/CompressionTest.php index f82403f58..ff004e0e9 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/CompressionTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/CompressionTest.php @@ -14,6 +14,7 @@ final class CompressionTest extends TestCase { + #[\Override] protected function setUp() : void { if (!\file_exists(__DIR__ . '/var')) { diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/ListsWritingTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/ListsWritingTest.php index 58a8d5f2e..30642781b 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/ListsWritingTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/ListsWritingTest.php @@ -13,6 +13,7 @@ final class ListsWritingTest extends TestCase { + #[\Override] protected function setUp() : void { if (!\file_exists(__DIR__ . '/var')) { diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/MapsWritingTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/MapsWritingTest.php index d48a235a6..eee65393d 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/MapsWritingTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/MapsWritingTest.php @@ -13,6 +13,7 @@ final class MapsWritingTest extends TestCase { + #[\Override] protected function setUp() : void { if (!\file_exists(__DIR__ . '/var')) { diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SimpleTypesWritingTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SimpleTypesWritingTest.php index 3efcf7bca..43c5572af 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SimpleTypesWritingTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SimpleTypesWritingTest.php @@ -13,6 +13,7 @@ final class SimpleTypesWritingTest extends TestCase { + #[\Override] protected function setUp() : void { if (!\file_exists(__DIR__ . '/var')) { diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/StructsWritingTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/StructsWritingTest.php index f28719c27..f8d691e3c 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/StructsWritingTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/StructsWritingTest.php @@ -13,6 +13,7 @@ final class StructsWritingTest extends TestCase { + #[\Override] protected function setUp() : void { if (!\file_exists(__DIR__ . '/var')) { diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterTest.php index 0f8f99e22..65c6f2071 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterTest.php @@ -16,6 +16,7 @@ final class WriterTest extends TestCase { + #[\Override] protected function setUp() : void { if (!\file_exists(__DIR__ . '/var')) { diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterValidatorTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterValidatorTest.php index 99f9412ba..a0b22136d 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterValidatorTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterValidatorTest.php @@ -12,6 +12,7 @@ final class WriterValidatorTest extends TestCase { + #[\Override] protected function setUp() : void { if (!\file_exists(__DIR__ . '/var')) { diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaCalculatorTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaCalculatorTest.php index 2caa1cfe4..d5bf77d50 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaCalculatorTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaCalculatorTest.php @@ -11,6 +11,7 @@ final class DeltaCalculatorTest extends TestCase { private DeltaCalculator $calculator; + #[\Override] protected function setUp() : void { $this->calculator = new DeltaCalculator(); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/ZigZagTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/ZigZagTest.php index 3a0083c39..d14d3fdc1 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/ZigZagTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/ZigZagTest.php @@ -77,6 +77,7 @@ public static function standardMappingProvider() : array ]; } + #[\Override] protected function setUp() : void { $this->zigzag = new ZigZag(); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/DataConverterTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/DataConverterTest.php index b830fb337..baf56b30b 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/DataConverterTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/DataConverterTest.php @@ -388,6 +388,7 @@ public function __construct( ) { } + #[\Override] public function fromParquetType(mixed $data) : mixed { $this->fromParquetTypeCallCount++; @@ -395,6 +396,7 @@ public function fromParquetType(mixed $data) : mixed return $this->conversionResult; } + #[\Override] public function isFor(FlatColumn $column, Options $options) : bool { $this->isForCallCount++; @@ -402,6 +404,7 @@ public function isFor(FlatColumn $column, Options $options) : bool return $this->isForResult; } + #[\Override] public function toParquetType(mixed $data) : mixed { $this->toParquetTypeCallCount++; @@ -427,6 +430,7 @@ public function __construct( ) { } + #[\Override] public function fromParquetType(mixed $data) : mixed { $this->fromParquetTypeCallCount++; @@ -434,6 +438,7 @@ public function fromParquetType(mixed $data) : mixed return $this->conversionResult; } + #[\Override] public function isFor(FlatColumn $column, Options $options) : bool { $this->isForCallCount++; @@ -441,6 +446,7 @@ public function isFor(FlatColumn $column, Options $options) : bool return $column->name() === $this->matchingColumnName; } + #[\Override] public function toParquetType(mixed $data) : mixed { $this->toParquetTypeCallCount++; @@ -454,16 +460,19 @@ public function toParquetType(mixed $data) : mixed */ final class ComplexDataMockConverter implements Converter { + #[\Override] public function fromParquetType(mixed $data) : mixed { return 'complex_from_parquet'; } + #[\Override] public function isFor(FlatColumn $column, Options $options) : bool { return true; } + #[\Override] public function toParquetType(mixed $data) : mixed { return 'complex_to_parquet'; @@ -475,16 +484,19 @@ public function toParquetType(mixed $data) : mixed */ final class ThrowingMockConverter implements Converter { + #[\Override] public function fromParquetType(mixed $data) : mixed { throw new \RuntimeException('Test exception from converter'); } + #[\Override] public function isFor(FlatColumn $column, Options $options) : bool { return true; } + #[\Override] public function toParquetType(mixed $data) : mixed { throw new \RuntimeException('Test exception from converter'); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilder/FloatDictionaryBuilderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilder/FloatDictionaryBuilderTest.php index 8a8744616..e447ef54b 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilder/FloatDictionaryBuilderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilder/FloatDictionaryBuilderTest.php @@ -41,6 +41,7 @@ public static function float_value_types_provider() : \Generator ]; } + #[\Override] protected function setUp() : void { $this->builder = new FloatDictionaryBuilder(); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilder/ObjectDictionaryBuilderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilder/ObjectDictionaryBuilderTest.php index 08ae6bc15..f68087751 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilder/ObjectDictionaryBuilderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilder/ObjectDictionaryBuilderTest.php @@ -48,6 +48,7 @@ public static function object_value_types_provider() : \Generator ]; } + #[\Override] protected function setUp() : void { $this->builder = new ObjectDictionaryBuilder(); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilder/ScalarDictionaryBuilderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilder/ScalarDictionaryBuilderTest.php index 93f1027cd..98ae766e9 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilder/ScalarDictionaryBuilderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilder/ScalarDictionaryBuilderTest.php @@ -41,6 +41,7 @@ public static function scalar_value_types_provider() : \Generator ]; } + #[\Override] protected function setUp() : void { $this->builder = new ScalarDictionaryBuilder(); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilderTest.php index 0c0cb6dc2..1b635005a 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilderTest.php @@ -56,6 +56,7 @@ public static function int64_int32_physical_types_provider() : \Generator yield 'INT32 with null logical type' => [PhysicalType::INT32, null]; } + #[\Override] protected function setUp() : void { $this->builder = new DictionaryBuilder(); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/RLEBitPackedPackerTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/RLEBitPackedPackerTest.php index ed50dc231..16fabf808 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/RLEBitPackedPackerTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/RLEBitPackedPackerTest.php @@ -59,6 +59,7 @@ public static function pack_with_length_provider() : \Generator yield 'sequential values' => [8, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 'sequential values with length']; } + #[\Override] protected function setUp() : void { $this->hybrid = new RLEBitPackedHybrid(); diff --git a/src/lib/types/src/Flow/Types/DSL/functions.php b/src/lib/types/src/Flow/Types/DSL/functions.php index c15f6a74f..4181a94be 100644 --- a/src/lib/types/src/Flow/Types/DSL/functions.php +++ b/src/lib/types/src/Flow/Types/DSL/functions.php @@ -8,7 +8,8 @@ use Flow\ETL\Attribute\{DocumentationDSL, Module, Type as DSLType}; use Flow\Types\Type; use Flow\Types\Type\{Comparator, TypeDetector, TypeFactory, Types}; -use Flow\Types\Type\Logical\{ClassStringType, +use Flow\Types\Type\Logical\{ + ClassStringType, DateTimeType, DateType, InstanceOfType, @@ -26,9 +27,11 @@ TimeZoneType, UuidType, XMLElementType, - XMLType}; + XMLType +}; use Flow\Types\Type\Logical\{HTMLElementType, HTMLType}; -use Flow\Types\Type\Native\{ArrayType, +use Flow\Types\Type\Native\{ + ArrayType, BooleanType, CallableType, EnumType, @@ -40,7 +43,8 @@ ObjectType, ResourceType, StringType, - UnionType}; + UnionType +}; use Flow\Types\Value\Uuid; use UnitEnum; @@ -53,8 +57,7 @@ * @return Type> */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_structure(array $elements = [], array $optional_elements = [], bool $allow_extra = false) : Type -{ +function type_structure(array $elements = [], array $optional_elements = [], bool $allow_extra = false): Type { return new StructureType($elements, $optional_elements, $allow_extra); } @@ -70,8 +73,7 @@ function type_structure(array $elements = [], array $optional_elements = [], boo * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_union(Type $first, Type $second, Type ...$types) : Type -{ +function type_union(Type $first, Type $second, Type ...$types): Type { $type = new UnionType($first, $second); foreach ($types as $t) { @@ -91,8 +93,7 @@ function type_union(Type $first, Type $second, Type ...$types) : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_intersection(Type $first, Type $second, Type ...$types) : Type -{ +function type_intersection(Type $first, Type $second, Type ...$types): Type { $type = new IntersectionType($first, $second); foreach ($types as $t) { @@ -106,8 +107,7 @@ function type_intersection(Type $first, Type $second, Type ...$types) : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_numeric_string() : Type -{ +function type_numeric_string(): Type { return new NumericStringType(); } @@ -119,8 +119,7 @@ function type_numeric_string() : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_optional(Type $type) : Type -{ +function type_optional(Type $type): Type { return new OptionalType($type); } @@ -130,8 +129,7 @@ function type_optional(Type $type) : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::HELPER)] -function type_from_array(array $data) : Type -{ +function type_from_array(array $data): Type { return TypeFactory::fromArray($data); } @@ -141,8 +139,7 @@ function type_from_array(array $data) : Type * @param Type $type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::HELPER)] -function type_is_nullable(Type $type) : bool -{ +function type_is_nullable(Type $type): bool { if ($type instanceof OptionalType) { return true; } @@ -163,8 +160,7 @@ function type_is_nullable(Type $type) : bool * @param Type $right */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::HELPER)] -function type_equals(Type $left, Type $right) : bool -{ +function type_equals(Type $left, Type $right): bool { return (new Comparator())->equals($left, $right); } @@ -176,8 +172,7 @@ function type_equals(Type $left, Type $right) : bool * @return Types */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::HELPER)] -function types(Type ...$types) : Types -{ +function types(Type ...$types): Types { return new Types(...$types); } @@ -189,8 +184,7 @@ function types(Type ...$types) : Types * @return ListType */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_list(Type $element) : ListType -{ +function type_list(Type $element): ListType { return new ListType($element); } @@ -204,8 +198,7 @@ function type_list(Type $element) : ListType * @return Type> */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_map(Type $key_type, Type $value_type) : Type -{ +function type_map(Type $key_type, Type $value_type): Type { return new MapType($key_type, $value_type); } @@ -213,8 +206,7 @@ function type_map(Type $key_type, Type $value_type) : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_json() : Type -{ +function type_json(): Type { return new JsonType(); } @@ -222,8 +214,7 @@ function type_json() : Type * @return Type<\DateTimeInterface> */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_datetime() : Type -{ +function type_datetime(): Type { return new DateTimeType(); } @@ -231,8 +222,7 @@ function type_datetime() : Type * @return Type<\DateTimeInterface> */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_date() : Type -{ +function type_date(): Type { return new DateType(); } @@ -240,8 +230,7 @@ function type_date() : Type * @return Type<\DateInterval> */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_time() : Type -{ +function type_time(): Type { return new TimeType(); } @@ -249,8 +238,7 @@ function type_time() : Type * @return Type<\DateTimeZone> */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_time_zone() : Type -{ +function type_time_zone(): Type { return new TimeZoneType(); } @@ -258,8 +246,7 @@ function type_time_zone() : Type * @return Type<\DOMDocument> */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_xml() : Type -{ +function type_xml(): Type { return new XMLType(); } @@ -267,8 +254,7 @@ function type_xml() : Type * @return Type<\DOMElement> */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_xml_element() : Type -{ +function type_xml_element(): Type { return new XMLElementType(); } @@ -276,8 +262,7 @@ function type_xml_element() : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_uuid() : Type -{ +function type_uuid(): Type { return new UuidType(); } @@ -285,8 +270,7 @@ function type_uuid() : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_integer() : Type -{ +function type_integer(): Type { return new IntegerType(); } @@ -294,8 +278,7 @@ function type_integer() : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_string() : Type -{ +function type_string(): Type { return new StringType(); } @@ -303,8 +286,7 @@ function type_string() : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_float() : Type -{ +function type_float(): Type { return new FloatType(); } @@ -312,8 +294,7 @@ function type_float() : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_boolean() : Type -{ +function type_boolean(): Type { return new BooleanType(); } @@ -325,8 +306,7 @@ function type_boolean() : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_instance_of(string $class) : Type -{ +function type_instance_of(string $class): Type { return new InstanceOfType($class); } @@ -334,8 +314,7 @@ function type_instance_of(string $class) : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_object() : Type -{ +function type_object(): Type { return new ObjectType(); } @@ -343,8 +322,7 @@ function type_object() : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_scalar() : Type -{ +function type_scalar(): Type { return new ScalarType(); } @@ -352,8 +330,7 @@ function type_scalar() : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_resource() : Type -{ +function type_resource(): Type { return new ResourceType(); } @@ -361,8 +338,7 @@ function type_resource() : Type * @return Type> */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_array() : Type -{ +function type_array(): Type { return new ArrayType(); } @@ -370,8 +346,7 @@ function type_array() : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_callable() : Type -{ +function type_callable(): Type { return new CallableType(); } @@ -379,8 +354,7 @@ function type_callable() : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_null() : Type -{ +function type_null(): Type { return new NullType(); } @@ -388,8 +362,7 @@ function type_null() : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_mixed() : Type -{ +function type_mixed(): Type { return new MixedType(); } @@ -397,8 +370,7 @@ function type_mixed() : Type * @return Type> */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_positive_integer() : Type -{ +function type_positive_integer(): Type { return new PositiveIntegerType(); } @@ -406,8 +378,7 @@ function type_positive_integer() : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_non_empty_string() : Type -{ +function type_non_empty_string(): Type { return new NonEmptyStringType(); } @@ -419,8 +390,7 @@ function type_non_empty_string() : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_enum(string $class) : Type -{ +function type_enum(string $class): Type { return new EnumType($class); } @@ -432,8 +402,7 @@ function type_enum(string $class) : Type * @return LiteralType */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_literal(bool|float|int|string $value) : LiteralType -{ +function type_literal(bool|float|int|string $value): LiteralType { return new LiteralType($value); } @@ -441,8 +410,7 @@ function type_literal(bool|float|int|string $value) : LiteralType * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_html() : Type -{ +function type_html(): Type { return new HTMLType(); } @@ -450,8 +418,7 @@ function type_html() : Type * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_html_element() : Type -{ +function type_html_element(): Type { return new HTMLElementType(); } @@ -462,8 +429,7 @@ function type_html_element() : Type * @param class-string> $typeClass */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::HELPER)] -function type_is(Type $type, string $typeClass) : bool -{ +function type_is(Type $type, string $typeClass): bool { return (new Comparator())->is($type, $typeClass); } @@ -475,8 +441,7 @@ function type_is(Type $type, string $typeClass) : bool * @param class-string> ...$typeClasses */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::HELPER)] -function type_is_any(Type $type, string $typeClass, string ...$typeClasses) : bool -{ +function type_is_any(Type $type, string $typeClass, string ...$typeClasses): bool { return (new Comparator())->isAny($type, $typeClass, ...$typeClasses); } @@ -484,8 +449,7 @@ function type_is_any(Type $type, string $typeClass, string ...$typeClasses) : bo * @return Type */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::HELPER)] -function get_type(mixed $value) : Type -{ +function get_type(mixed $value): Type { return (new TypeDetector())->detectType($value); } @@ -497,20 +461,18 @@ function get_type(mixed $value) : Type * @return ($class is null ? Type : Type>) */ #[DocumentationDSL(module: Module::TYPES, type: DSLType::TYPE)] -function type_class_string(?string $class = null) : Type -{ +function type_class_string(null|string $class = null): Type { return new ClassStringType($class); } #[DocumentationDSL(module: Module::TYPES, type: DSLType::HELPER)] -function dom_element_to_string(\DOMElement $element, bool $format_output = false, bool $preserver_white_space = false) : string|false -{ +function dom_element_to_string(\DOMElement $element, bool $format_output = false, bool $preserver_white_space = false): string|false { $doc = new \DOMDocument('1.0', 'UTF-8'); $doc->formatOutput = $format_output; $doc->preserveWhiteSpace = $preserver_white_space; $importedNode = $doc->importNode($element, true); - $doc->appendChild($importedNode); + $doc->appendChild(type_instance_of(\DOMNode::class)->assert($importedNode)); return $doc->saveXML($doc->documentElement); } diff --git a/src/lib/types/src/Flow/Types/Exception/CastingException.php b/src/lib/types/src/Flow/Types/Exception/CastingException.php index a0a01de6e..103855001 100644 --- a/src/lib/types/src/Flow/Types/Exception/CastingException.php +++ b/src/lib/types/src/Flow/Types/Exception/CastingException.php @@ -13,12 +13,11 @@ final class CastingException extends RuntimeException * @param Type $type * @param null|\Throwable $previous */ - public function __construct(public readonly mixed $value, public readonly Type $type, ?\Throwable $previous = null) - { - parent::__construct( - \sprintf("Can't cast \"%s\" into \"%s\" type", \get_debug_type($value), $type->toString()), - 0, - $previous - ); + public function __construct( + public readonly mixed $value, + public readonly Type $type, + null|\Throwable $previous = null, + ) { + parent::__construct(\sprintf("Can't cast \"%s\" into \"%s\" type", \get_debug_type($value), $type->toString()), 0, $previous); } } diff --git a/src/lib/types/src/Flow/Types/Exception/Exception.php b/src/lib/types/src/Flow/Types/Exception/Exception.php index ac362f87a..0e75d32e9 100644 --- a/src/lib/types/src/Flow/Types/Exception/Exception.php +++ b/src/lib/types/src/Flow/Types/Exception/Exception.php @@ -4,6 +4,4 @@ namespace Flow\Types\Exception; -class Exception extends \Exception -{ -} +class Exception extends \Exception {} diff --git a/src/lib/types/src/Flow/Types/Exception/InvalidArgumentException.php b/src/lib/types/src/Flow/Types/Exception/InvalidArgumentException.php index 50f8e830b..6da6c6b28 100644 --- a/src/lib/types/src/Flow/Types/Exception/InvalidArgumentException.php +++ b/src/lib/types/src/Flow/Types/Exception/InvalidArgumentException.php @@ -4,6 +4,4 @@ namespace Flow\Types\Exception; -class InvalidArgumentException extends Exception -{ -} +class InvalidArgumentException extends Exception {} diff --git a/src/lib/types/src/Flow/Types/Exception/InvalidTypeException.php b/src/lib/types/src/Flow/Types/Exception/InvalidTypeException.php index ff05e25cc..528ab4e7f 100644 --- a/src/lib/types/src/Flow/Types/Exception/InvalidTypeException.php +++ b/src/lib/types/src/Flow/Types/Exception/InvalidTypeException.php @@ -9,7 +9,7 @@ final class InvalidTypeException extends InvalidArgumentException { - public function __construct(string $message, ?\Throwable $previous = null) + public function __construct(string $message, null|\Throwable $previous = null) { parent::__construct($message, 0, $previous); } @@ -18,28 +18,22 @@ public function __construct(string $message, ?\Throwable $previous = null) * @param Type $givenType * @param Type $expectedType */ - public static function type(Type $givenType, Type $expectedType) : self + public static function type(Type $givenType, Type $expectedType): self { - return new self( - sprintf( - 'Expected type "%s", got "%s".', - $expectedType->toString(), - $givenType->toString(), - ) - ); + return new self(sprintf('Expected type "%s", got "%s".', $expectedType->toString(), $givenType->toString())); } /** * @param Type $expectedType */ - public static function value(mixed $value, Type $expectedType) : self + public static function value(mixed $value, Type $expectedType): self { - return new self( - sprintf( - 'Expected type "%s", got "%s".', - $expectedType->toString(), - (new TypeDetector())->detectType($value)->toString(), - ) - ); + return new self(sprintf( + 'Expected type "%s", got "%s".', + $expectedType->toString(), + (new TypeDetector()) + ->detectType($value) + ->toString(), + )); } } diff --git a/src/lib/types/src/Flow/Types/Exception/RuntimeException.php b/src/lib/types/src/Flow/Types/Exception/RuntimeException.php index 9cffb567c..78cb2a925 100644 --- a/src/lib/types/src/Flow/Types/Exception/RuntimeException.php +++ b/src/lib/types/src/Flow/Types/Exception/RuntimeException.php @@ -4,6 +4,4 @@ namespace Flow\Types\Exception; -class RuntimeException extends Exception -{ -} +class RuntimeException extends Exception {} diff --git a/src/lib/types/src/Flow/Types/PHPStan/StructureTypeReturnTypeExtension.php b/src/lib/types/src/Flow/Types/PHPStan/StructureTypeReturnTypeExtension.php index 1c946a38b..9e3970dd7 100644 --- a/src/lib/types/src/Flow/Types/PHPStan/StructureTypeReturnTypeExtension.php +++ b/src/lib/types/src/Flow/Types/PHPStan/StructureTypeReturnTypeExtension.php @@ -15,7 +15,7 @@ final class StructureTypeReturnTypeExtension implements DynamicFunctionReturnTypeExtension { - public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope) : ?Type + public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): null|Type { $args = $functionCall->getArgs(); @@ -50,20 +50,17 @@ public function getTypeFromFunctionCall(FunctionReflection $functionReflection, } } - return new GenericObjectType( - FlowType::class, - [ - TypeCombinator::union(...$results), - ] - ); + return new GenericObjectType(FlowType::class, [ + TypeCombinator::union(...$results), + ]); } - public function isFunctionSupported(FunctionReflection $functionReflection) : bool + public function isFunctionSupported(FunctionReflection $functionReflection): bool { return $functionReflection->getName() === 'Flow\Types\DSL\type_structure'; } - private function createResult(ConstantArrayType $requiredArrayType, ?ConstantArrayType $optionalArrayType = null) : Type + private function createResult(ConstantArrayType $requiredArrayType, null|ConstantArrayType $optionalArrayType = null): Type { $builder = ConstantArrayTypeBuilder::createEmpty(); @@ -92,7 +89,7 @@ private function createResult(ConstantArrayType $requiredArrayType, ?ConstantArr /** * @return array{Type, bool} */ - private function extractOptional(Type $type) : array + private function extractOptional(Type $type): array { $optionalType = $type->getTemplateType(OptionalType::class, 'T'); diff --git a/src/lib/types/src/Flow/Types/Type.php b/src/lib/types/src/Flow/Types/Type.php index 59e0ff621..4567c65b4 100644 --- a/src/lib/types/src/Flow/Types/Type.php +++ b/src/lib/types/src/Flow/Types/Type.php @@ -23,7 +23,7 @@ interface Type * * @phpstan-assert T $value */ - public function assert(mixed $value) : mixed; + public function assert(mixed $value): mixed; /** * Takes a value and when necessary casts it to the type of this object. @@ -34,7 +34,7 @@ public function assert(mixed $value) : mixed; * * @return T */ - public function cast(mixed $value) : mixed; + public function cast(mixed $value): mixed; /** * Checks if the value is of the type of this object. @@ -42,12 +42,12 @@ public function cast(mixed $value) : mixed; * * @phpstan-assert-if-true T $value */ - public function isValid(mixed $value) : bool; + public function isValid(mixed $value): bool; /** - * @return array + * @return array */ - public function normalize() : array; + public function normalize(): array; /** * Returns a string representation of the type. @@ -56,5 +56,5 @@ public function normalize() : array; * - int - for type_int() * - ?float - for type_optional(type_float()) */ - public function toString() : string; + public function toString(): string; } diff --git a/src/lib/types/src/Flow/Types/Type/ArrayContentDetector.php b/src/lib/types/src/Flow/Types/Type/ArrayContentDetector.php index 3e2057771..da9d6fa05 100644 --- a/src/lib/types/src/Flow/Types/Type/ArrayContentDetector.php +++ b/src/lib/types/src/Flow/Types/Type/ArrayContentDetector.php @@ -14,12 +14,12 @@ /** * @var null|Type */ - private ?Type $firstKeyType; + private null|Type $firstKeyType; /** * @var null|Type */ - private ?Type $firstValueType; + private null|Type $firstValueType; private int $uniqueKeysTypeCount; @@ -30,21 +30,28 @@ * @param Types $uniqueValuesType * @param bool $isList */ - public function __construct(Types $uniqueKeysType, private Types $uniqueValuesType, private bool $isList = false) - { + public function __construct( + Types $uniqueKeysType, + private Types $uniqueValuesType, + private bool $isList = false, + ) { $this->firstKeyType = $uniqueKeysType->first(); $this->firstValueType = $uniqueValuesType->first(); $this->uniqueKeysTypeCount = $uniqueKeysType->reduceOptionals()->without(type_array(), type_null())->count(); - $this->uniqueValuesTypeCount = $this->uniqueValuesType->reduceOptionals()->without(type_array(), type_null())->count(); + $this->uniqueValuesTypeCount = $this->uniqueValuesType + ->reduceOptionals() + ->without(type_array(), type_null()) + ->count(); } /** * @return null|Type */ - public function firstKeyType() : ?Type + public function firstKeyType(): null|Type { if (null !== $this->firstKeyType && (!$this->firstKeyType instanceof IntegerType && !$this->firstKeyType instanceof StringType)) { - throw new InvalidArgumentException('First unique key type must be of IntegerType or StringType, given: ' . $this->firstKeyType::class); + throw new InvalidArgumentException('First unique key type must be of IntegerType or StringType, given: ' + . $this->firstKeyType::class); } return $this->firstKeyType; @@ -53,7 +60,7 @@ public function firstKeyType() : ?Type /** * @return null|Type */ - public function firstValueType() : ?Type + public function firstValueType(): null|Type { return $this->firstValueType; } @@ -61,7 +68,7 @@ public function firstValueType() : ?Type /** * @phpstan-assert-if-true Type $this->firstKeyType() */ - public function isList() : bool + public function isList(): bool { return 1 === $this->uniqueValuesTypeCount && $this->firstKeyType() instanceof IntegerType && $this->isList; } @@ -69,26 +76,24 @@ public function isList() : bool /** * @phpstan-assert-if-true Type $this->firstKeyType() */ - public function isMap() : bool + public function isMap(): bool { return 1 === $this->uniqueValuesTypeCount && 1 === $this->uniqueKeysTypeCount && !$this->isList; } - public function isStructure() : bool + public function isStructure(): bool { if ($this->isList() || $this->isMap()) { return false; } - return 0 !== $this->uniqueValuesTypeCount - && 1 === $this->uniqueKeysTypeCount - && $this->firstKeyType() instanceof StringType; + return 0 !== $this->uniqueValuesTypeCount && 1 === $this->uniqueKeysTypeCount && $this->firstKeyType() instanceof StringType; } /** * @return Type */ - public function valueType() : Type + public function valueType(): Type { $type = null; diff --git a/src/lib/types/src/Flow/Types/Type/AutoCaster.php b/src/lib/types/src/Flow/Types/Type/AutoCaster.php index 647b3bc5d..587138c77 100644 --- a/src/lib/types/src/Flow/Types/Type/AutoCaster.php +++ b/src/lib/types/src/Flow/Types/Type/AutoCaster.php @@ -10,7 +10,7 @@ final readonly class AutoCaster { - public function cast(mixed $value) : mixed + public function cast(mixed $value): mixed { if (\is_string($value)) { return $this->castToString($value); @@ -28,7 +28,7 @@ public function cast(mixed $value) : mixed * * @return array */ - private function castArray(array $value) : array + private function castArray(array $value): array { $keyTypes = []; $valueTypes = []; @@ -53,7 +53,7 @@ private function castArray(array $value) : array return $value; } - private function castToString(string $value) : mixed + private function castToString(string $value): mixed { $narrowedType = (new StringTypeNarrower())->narrow($value); diff --git a/src/lib/types/src/Flow/Types/Type/Comparator.php b/src/lib/types/src/Flow/Types/Type/Comparator.php index d50ff4bcf..72c30ddba 100644 --- a/src/lib/types/src/Flow/Types/Type/Comparator.php +++ b/src/lib/types/src/Flow/Types/Type/Comparator.php @@ -6,14 +6,7 @@ use function Flow\Types\DSL\{type_equals, type_instance_of}; use Flow\Types\Type; -use Flow\Types\Type\Logical\{DateTimeType, - DateType, - JsonType, - ListType, - MapType, - OptionalType, - StructureType, - TimeType}; +use Flow\Types\Type\Logical\{DateTimeType, DateType, JsonType, ListType, MapType, OptionalType, StructureType, TimeType}; use Flow\Types\Type\Native\{FloatType, IntegerType, NullType, StringType, UnionType}; final class Comparator @@ -22,7 +15,7 @@ final class Comparator * @param Type $left * @param Type $right */ - public function comparable(Type $left, Type $right) : bool + public function comparable(Type $left, Type $right): bool { if ($left instanceof UnionType && $left->isOptionalType()) { return $this->comparable(type_instance_of(Type::class)->assert($left->types()->reduceOptionals()->first()), $right); @@ -64,7 +57,10 @@ public function comparable(Type $left, Type $right) : bool return true; } - if (\in_array($left::class, [StringType::class, JsonType::class], true) && \in_array($right::class, [StringType::class, JsonType::class], true)) { + if ( + \in_array($left::class, [StringType::class, JsonType::class], true) + && \in_array($right::class, [StringType::class, JsonType::class], true) + ) { return true; } @@ -75,7 +71,7 @@ public function comparable(Type $left, Type $right) : bool * @param Type $left * @param Type $right */ - public function equals(Type $left, Type $right) : bool + public function equals(Type $left, Type $right): bool { if ($left::class !== $right::class) { return false; @@ -118,18 +114,24 @@ public function equals(Type $left, Type $right) : bool * @param Type $type * @param class-string> $typeClass */ - public function is(Type $type, string $typeClass) : bool + public function is(Type $type, string $typeClass): bool { if ($type instanceof $typeClass) { return true; } if ($type instanceof OptionalType) { - return $this->is($type->base(), $typeClass); + /** @var Type $base */ + $base = $type->base(); + + return $this->is($base, $typeClass); } if ($type instanceof UnionType) { - foreach ($type->types()->all() as $nextType) { + /** @var Types $unionTypes */ + $unionTypes = $type->types(); + + foreach ($unionTypes->all() as $nextType) { if ($nextType instanceof $typeClass) { return true; } @@ -148,7 +150,7 @@ public function is(Type $type, string $typeClass) : bool * @param class-string> $typeClass * @param class-string> ...$typeClasses */ - public function isAny(Type $type, string $typeClass, string ...$typeClasses) : bool + public function isAny(Type $type, string $typeClass, string ...$typeClasses): bool { $classes = [$typeClass, ...$typeClasses]; diff --git a/src/lib/types/src/Flow/Types/Type/Comparison/Operator.php b/src/lib/types/src/Flow/Types/Type/Comparison/Operator.php index cde58a28b..de0d0d3cb 100644 --- a/src/lib/types/src/Flow/Types/Type/Comparison/Operator.php +++ b/src/lib/types/src/Flow/Types/Type/Comparison/Operator.php @@ -4,7 +4,7 @@ namespace Flow\Types\Type\Comparison; -enum Operator : string +enum Operator: string { case DIFFERENT = '<>'; case EQUAL = '=='; diff --git a/src/lib/types/src/Flow/Types/Type/Logical/ClassStringType.php b/src/lib/types/src/Flow/Types/Type/Logical/ClassStringType.php index 3631d444a..24754317c 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/ClassStringType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/ClassStringType.php @@ -18,8 +18,9 @@ /** * @param null|class-string $class */ - public function __construct(public ?string $class = null) - { + public function __construct( + public null|string $class = null, + ) { if ($class !== null && (!\class_exists($class) && !\interface_exists($class))) { throw new InvalidArgumentException("Class {$class} not found"); } @@ -30,17 +31,15 @@ public function __construct(public ?string $class = null) * * @return Type */ - public static function fromArray(array $data) : Type + public static function fromArray(array $data): Type { - $data = type_structure( - ['type' => type_literal('class_string')], - ['class' => type_class_string()], - )->assert($data); + $data = type_structure(['type' => type_literal('class_string')], ['class' => type_class_string()])->assert($data); return new self($data['class'] ?? null); } - public function assert(mixed $value) : string + #[\Override] + public function assert(mixed $value): string { if ($this->isValid($value)) { return $value; @@ -49,7 +48,8 @@ public function assert(mixed $value) : string throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : string + #[\Override] + public function cast(mixed $value): string { if ($this->isValid($value)) { return $value; @@ -76,7 +76,8 @@ public function cast(mixed $value) : string throw new CastingException($value, $this); } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { if (!\is_string($value)) { return false; @@ -93,7 +94,11 @@ public function isValid(mixed $value) : bool return \is_a($value, $this->class, true); } - public function normalize() : array + /** + * @return array{type: 'class_string', class?: class-string} + */ + #[\Override] + public function normalize(): array { $result = ['type' => 'class_string']; @@ -104,7 +109,8 @@ public function normalize() : array return $result; } - public function toString() : string + #[\Override] + public function toString(): string { return $this->class === null ? 'class-string' : 'class-string<' . $this->class . '>'; } diff --git a/src/lib/types/src/Flow/Types/Type/Logical/DateTimeType.php b/src/lib/types/src/Flow/Types/Type/Logical/DateTimeType.php index 9af907d4f..57d0dc0a4 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/DateTimeType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/DateTimeType.php @@ -12,7 +12,8 @@ */ final readonly class DateTimeType implements Type { - public function assert(mixed $value) : \DateTimeInterface + #[\Override] + public function assert(mixed $value): \DateTimeInterface { if ($this->isValid($value)) { return $value; @@ -21,7 +22,8 @@ public function assert(mixed $value) : \DateTimeInterface throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : \DateTimeInterface + #[\Override] + public function cast(mixed $value): \DateTimeInterface { if ($value instanceof \DateTimeImmutable) { return $value; @@ -45,13 +47,11 @@ public function cast(mixed $value) : \DateTimeInterface } if (\is_bool($value)) { - /* @phpstan-ignore-next-line */ - return new \DateTimeImmutable('@' . $value); + return new \DateTimeImmutable('@' . (int) $value); } if ($value instanceof \DateInterval) { return (new \DateTimeImmutable('@0'))->add($value); - } } catch (\Throwable) { throw new CastingException($value, $this); @@ -60,19 +60,22 @@ public function cast(mixed $value) : \DateTimeInterface throw new CastingException($value, $this); } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return $value instanceof \DateTimeInterface; } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'datetime', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'datetime'; } diff --git a/src/lib/types/src/Flow/Types/Type/Logical/DateType.php b/src/lib/types/src/Flow/Types/Type/Logical/DateType.php index bac85be41..d0aa0c507 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/DateType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/DateType.php @@ -12,7 +12,8 @@ */ final readonly class DateType implements Type { - public function assert(mixed $value) : \DateTimeInterface + #[\Override] + public function assert(mixed $value): \DateTimeInterface { if ($this->isValid($value)) { return $value; @@ -21,7 +22,8 @@ public function assert(mixed $value) : \DateTimeInterface throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : \DateTimeInterface + #[\Override] + public function cast(mixed $value): \DateTimeInterface { if ($this->isValid($value)) { return $value; @@ -46,8 +48,7 @@ public function cast(mixed $value) : \DateTimeInterface } if (\is_bool($value)) { - /* @phpstan-ignore-next-line */ - return (new \DateTimeImmutable('@' . $value))->setTime(0, 0, 0, 0); + return (new \DateTimeImmutable('@' . (int) $value))->setTime(0, 0, 0, 0); } if ($value instanceof \DateInterval) { @@ -60,19 +61,22 @@ public function cast(mixed $value) : \DateTimeInterface throw new CastingException($value, $this); } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return $value instanceof \DateTimeInterface && $value->format('H:i:s') === '00:00:00'; } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'date', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'date'; } diff --git a/src/lib/types/src/Flow/Types/Type/Logical/HTMLElementType.php b/src/lib/types/src/Flow/Types/Type/Logical/HTMLElementType.php index 8ed1e065a..e85f2e855 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/HTMLElementType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/HTMLElementType.php @@ -14,7 +14,8 @@ */ final readonly class HTMLElementType implements Type { - public function assert(mixed $value) : HTMLElement + #[\Override] + public function assert(mixed $value): HTMLElement { if ($this->isValid($value)) { return $value; @@ -23,7 +24,8 @@ public function assert(mixed $value) : HTMLElement throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : HTMLElement + #[\Override] + public function cast(mixed $value): HTMLElement { if ($this->isValid($value)) { return $value; @@ -38,19 +40,22 @@ public function cast(mixed $value) : HTMLElement throw new CastingException($value, $this); } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return $value instanceof HTMLElement; } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'html_element', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'html_element'; } diff --git a/src/lib/types/src/Flow/Types/Type/Logical/HTMLType.php b/src/lib/types/src/Flow/Types/Type/Logical/HTMLType.php index 6687d34e2..774dd8582 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/HTMLType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/HTMLType.php @@ -14,16 +14,17 @@ final readonly class HTMLType implements Type { public const string HTML_ALIKE_REGEX = <<<'REGXP' -@^ - ]*>\s* # must start with - ]*>\s* # opening - ]*>.*?<\/head>\s* # exactly one ... - ]*>.*?<\/body>\s* # exactly one ... - <\/html>\s* # closing -$@isx -REGXP; + @^ + ]*>\s* # must start with + ]*>\s* # opening + ]*>.*?<\/head>\s* # exactly one ... + ]*>.*?<\/body>\s* # exactly one ... + <\/html>\s* # closing + $@isx + REGXP; - public function assert(mixed $value) : HTMLDocument + #[\Override] + public function assert(mixed $value): HTMLDocument { if ($this->isValid($value)) { return $value; @@ -32,21 +33,22 @@ public function assert(mixed $value) : HTMLDocument throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : HTMLDocument + #[\Override] + public function cast(mixed $value): HTMLDocument { - if (!$this->isValid($value)) { - throw new CastingException($value, $this); + if ($this->isValid($value)) { + return $value; } - /* @phpstan-ignore-next-line */ if (\is_string($value)) { return HTMLDocument::createFromString($value, \LIBXML_NOERROR); } - return $value; + throw new CastingException($value, $this); } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { // \Dom\HTMLDocument exist in PHP 8.4+ if (!\class_exists('\Dom\HTMLDocument')) { @@ -56,14 +58,16 @@ public function isValid(mixed $value) : bool return $value instanceof HTMLDocument; } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'html', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'html'; } diff --git a/src/lib/types/src/Flow/Types/Type/Logical/InstanceOfType.php b/src/lib/types/src/Flow/Types/Type/Logical/InstanceOfType.php index 4912f430b..1ce88b5c5 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/InstanceOfType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/InstanceOfType.php @@ -18,8 +18,9 @@ /** * @param class-string $class */ - public function __construct(public string $class) - { + public function __construct( + public string $class, + ) { if (!\class_exists($class) && !\interface_exists($class)) { throw new InvalidArgumentException("Class {$class} not found"); } @@ -30,7 +31,7 @@ public function __construct(public string $class) * * @return InstanceOfType */ - public static function fromArray(array $data) : self + public static function fromArray(array $data): self { $data = type_structure([ 'type' => type_literal('instance_of'), @@ -40,7 +41,8 @@ public static function fromArray(array $data) : self return new self($data['class']); } - public function assert(mixed $value) : object + #[\Override] + public function assert(mixed $value): object { if ($this->isValid($value)) { return $value; @@ -49,7 +51,8 @@ public function assert(mixed $value) : object throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : object + #[\Override] + public function cast(mixed $value): object { if (\is_object($value) && \is_a($value, $this->class, true)) { return $value; @@ -68,12 +71,17 @@ public function cast(mixed $value) : object } } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return (\is_object($value) || \is_string($value)) && \is_a($value, $this->class, true); } - public function normalize() : array + /** + * @return array{type: 'instance_of', class: class-string} + */ + #[\Override] + public function normalize(): array { return [ 'type' => 'instance_of', @@ -81,7 +89,8 @@ public function normalize() : array ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'object<' . $this->class . '>'; } diff --git a/src/lib/types/src/Flow/Types/Type/Logical/InstanceOfTypeNarrower.php b/src/lib/types/src/Flow/Types/Type/Logical/InstanceOfTypeNarrower.php index d68e26789..46fe8381a 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/InstanceOfTypeNarrower.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/InstanceOfTypeNarrower.php @@ -13,7 +13,8 @@ /** * @return Type */ - public function narrow(mixed $value) : Type + #[\Override] + public function narrow(mixed $value): Type { if (!\is_object($value)) { return get_type($value); diff --git a/src/lib/types/src/Flow/Types/Type/Logical/JsonType.php b/src/lib/types/src/Flow/Types/Type/Logical/JsonType.php index cfbfaf14b..c536c8255 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/JsonType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/JsonType.php @@ -13,7 +13,8 @@ */ final readonly class JsonType implements Type { - public function assert(mixed $value) : string + #[\Override] + public function assert(mixed $value): string { if ($this->isValid($value)) { return $value; @@ -22,7 +23,8 @@ public function assert(mixed $value) : string throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : string + #[\Override] + public function cast(mixed $value): string { if ($this->isValid($value)) { return $value; @@ -39,7 +41,8 @@ public function cast(mixed $value) : string } } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { if (!\is_string($value)) { return false; @@ -63,14 +66,16 @@ public function isValid(mixed $value) : bool return \json_validate($value); } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'json', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'json'; } diff --git a/src/lib/types/src/Flow/Types/Type/Logical/ListType.php b/src/lib/types/src/Flow/Types/Type/Logical/ListType.php index a6c5a103d..60688d817 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/ListType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/ListType.php @@ -4,13 +4,7 @@ namespace Flow\Types\Type\Logical; -use function Flow\Types\DSL\{ - type_from_array, - type_literal, - type_map, - type_mixed, - type_string, - type_structure}; +use function Flow\Types\DSL\{type_from_array, type_literal, type_map, type_mixed, type_string, type_structure}; use Flow\Types\Exception\{CastingException, InvalidTypeException}; use Flow\Types\Type; @@ -24,16 +18,16 @@ /** * @param Type $element */ - public function __construct(private Type $element) - { - } + public function __construct( + private Type $element, + ) {} /** * @param array $data * * @return ListType */ - public static function fromArray(array $data) : self + public static function fromArray(array $data): self { $data = type_structure([ 'type' => type_literal('list'), @@ -43,7 +37,8 @@ public static function fromArray(array $data) : self return new self(type_from_array($data['element'])); } - public function assert(mixed $value) : array + #[\Override] + public function assert(mixed $value): array { if ($this->isValid($value)) { return $value; @@ -52,7 +47,8 @@ public function assert(mixed $value) : array throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : array + #[\Override] + public function cast(mixed $value): array { if ($this->isValid($value)) { return $value; @@ -82,19 +78,19 @@ public function cast(mixed $value) : array /** * @return Type */ - public function element() : Type + public function element(): Type { return $this->element; } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { if (!\is_array($value)) { - return false; } - if ([] !== $value && !\array_is_list($value)) { + if (!\array_is_list($value)) { return false; } @@ -110,7 +106,8 @@ public function isValid(mixed $value) : bool /** * @return array{type: 'list', element: array} */ - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'list', @@ -118,7 +115,8 @@ public function normalize() : array ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'list<' . $this->element->toString() . '>'; } diff --git a/src/lib/types/src/Flow/Types/Type/Logical/LiteralType.php b/src/lib/types/src/Flow/Types/Type/Logical/LiteralType.php index dd9d1536f..fa1967579 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/LiteralType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/LiteralType.php @@ -20,15 +20,14 @@ */ public function __construct( private bool|float|int|string $value, - ) { - } + ) {} /** * @param array $data * * @return LiteralType */ - public static function fromArray(array $data) : self + public static function fromArray(array $data): self { $data = type_structure([ 'type' => type_literal('literal'), @@ -38,7 +37,8 @@ public static function fromArray(array $data) : self return self::createFromString($data['value']); } - public function assert(mixed $value) : bool|float|int|string + #[\Override] + public function assert(mixed $value): bool|float|int|string { if ($this->isValid($value)) { return $value; @@ -47,7 +47,8 @@ public function assert(mixed $value) : bool|float|int|string throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : bool|float|int|string + #[\Override] + public function cast(mixed $value): bool|float|int|string { if ($this->isValid($value)) { return $value; @@ -56,12 +57,17 @@ public function cast(mixed $value) : bool|float|int|string throw new CastingException($value, $this); } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return $value === $this->value; } - public function normalize() : array + /** + * @return array{type: 'literal', value: string} + */ + #[\Override] + public function normalize(): array { return [ 'type' => 'literal', @@ -69,7 +75,8 @@ public function normalize() : array ]; } - public function toString() : string + #[\Override] + public function toString(): string { if (\is_string($this->value)) { return "'{$this->value}'"; @@ -85,7 +92,7 @@ public function toString() : string /** * @return LiteralType */ - private static function createFromString(string $value) : self + private static function createFromString(string $value): self { if ($value === 'true') { // @phpstan-ignore return.type diff --git a/src/lib/types/src/Flow/Types/Type/Logical/MapType.php b/src/lib/types/src/Flow/Types/Type/Logical/MapType.php index d9d375060..376854be1 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/MapType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/MapType.php @@ -4,13 +4,16 @@ namespace Flow\Types\Type\Logical; -use function Flow\Types\DSL\{ +use function Flow\Types\DSL\{type_equals, type_from_array, + type_integer, + type_is, type_literal, type_map, type_mixed, type_string, - type_structure}; + type_structure, + type_union}; use Flow\Types\Exception\{CastingException, InvalidTypeException}; use Flow\Types\Type; @@ -26,27 +29,37 @@ * @param Type $key * @param Type $value */ - public function __construct(private Type $key, private Type $value) - { - } + public function __construct( + private Type $key, + private Type $value, + ) {} /** * @param array $data * * @return MapType */ - public static function fromArray(array $data) : self + public static function fromArray(array $data): self { $data = type_structure([ 'type' => type_literal('map'), - 'key' => type_map(type_string(), type_mixed()), + 'key' => type_structure([ + 'type' => type_union(type_literal('string'), type_literal('integer')) + ]), 'value' => type_map(type_string(), type_mixed()), ])->assert($data); - return new self(type_from_array($data['key']), type_from_array($data['value'])); + /** @var Type $keyType */ + $keyType = type_from_array($data['key']); + $valueType = type_from_array($data['value']); + + type_equals(type_union(type_integer(), type_string()), $keyType); + + return new self($keyType, $valueType); } - public function assert(mixed $value) : array + #[\Override] + public function assert(mixed $value): array { if ($this->isValid($value)) { return $value; @@ -55,10 +68,12 @@ public function assert(mixed $value) : array throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : array + #[\Override] + public function cast(mixed $value): array { try { if (\is_string($value) && (\str_starts_with($value, '{') || \str_starts_with($value, '['))) { + /** @var array|scalar|null $decoded */ $decoded = \json_decode($value, true, 512, \JSON_THROW_ON_ERROR); return $this->assert($decoded); @@ -86,7 +101,8 @@ public function cast(mixed $value) : array } } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { if (!\is_array($value)) { return false; @@ -108,7 +124,7 @@ public function isValid(mixed $value) : bool /** * @return Type */ - public function key() : Type + public function key(): Type { return $this->key; } @@ -116,7 +132,8 @@ public function key() : Type /** * @return array{type: 'map', key: array, value: array} */ - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'map', @@ -125,7 +142,8 @@ public function normalize() : array ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'map<' . $this->key->toString() . ', ' . $this->value->toString() . '>'; } @@ -133,7 +151,7 @@ public function toString() : string /** * @return Type */ - public function value() : Type + public function value(): Type { return $this->value; } diff --git a/src/lib/types/src/Flow/Types/Type/Logical/NonEmptyStringType.php b/src/lib/types/src/Flow/Types/Type/Logical/NonEmptyStringType.php index ac629fc39..9e08c71fe 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/NonEmptyStringType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/NonEmptyStringType.php @@ -13,7 +13,8 @@ */ final class NonEmptyStringType implements Type { - public function assert(mixed $value) : string + #[\Override] + public function assert(mixed $value): string { if ($this->isValid($value)) { return $value; @@ -22,7 +23,8 @@ public function assert(mixed $value) : string throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : string + #[\Override] + public function cast(mixed $value): string { if ($this->isValid($value)) { return $value; @@ -61,7 +63,11 @@ public function cast(mixed $value) : string throw new CastingException($value, $this); } - if (\is_scalar($value) || (\is_object($value) && method_exists($value, '__toString'))) { + if (\is_scalar($value)) { + return $this->assert((string) $value); + } + + if ((\is_object($value) && method_exists($value, '__toString')) || $value instanceof \Stringable) { return $this->assert((string) $value); } @@ -71,24 +77,27 @@ public function cast(mixed $value) : string } } - public function isStringable(mixed $value) : bool + public function isStringable(mixed $value): bool { - return \is_string($value) || (\is_object($value) && method_exists($value, '__toString')) || $value instanceof \Stringable; + return \is_string($value) || \is_object($value) && method_exists($value, '__toString') || $value instanceof \Stringable; } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return \is_string($value) && $value !== ''; } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'non_empty_string', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'non_empty_string'; } diff --git a/src/lib/types/src/Flow/Types/Type/Logical/NumericStringType.php b/src/lib/types/src/Flow/Types/Type/Logical/NumericStringType.php index 6dcfb4deb..3d5089577 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/NumericStringType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/NumericStringType.php @@ -12,7 +12,8 @@ */ final class NumericStringType implements Type { - public function assert(mixed $value) : mixed + #[\Override] + public function assert(mixed $value): mixed { if ($this->isValid($value)) { return $value; @@ -21,7 +22,8 @@ public function assert(mixed $value) : mixed throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : string + #[\Override] + public function cast(mixed $value): string { if ($this->isValid($value)) { return $value; @@ -40,19 +42,22 @@ public function cast(mixed $value) : string throw new CastingException($value, $this); } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return \is_string($value) && \is_numeric($value); } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'numeric-string', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'numeric-string'; } diff --git a/src/lib/types/src/Flow/Types/Type/Logical/OptionalType.php b/src/lib/types/src/Flow/Types/Type/Logical/OptionalType.php index fa17f66a4..a72a186bf 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/OptionalType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/OptionalType.php @@ -22,8 +22,9 @@ * * @throws InvalidTypeException */ - public function __construct(private Type $base) - { + public function __construct( + private Type $base, + ) { if ($base instanceof MixedType) { throw new InvalidTypeException('Optional type cannot be created from MixedType, mixed is a standalone type'); } @@ -42,7 +43,7 @@ public function __construct(private Type $base) * * @return OptionalType */ - public static function fromArray(array $data) : self + public static function fromArray(array $data): self { type_structure([ 'type' => type_literal('optional'), @@ -52,7 +53,8 @@ public static function fromArray(array $data) : self return new self(TypeFactory::fromArray($data['base'])); } - public function assert(mixed $value) : mixed + #[\Override] + public function assert(mixed $value): mixed { if ($this->isValid($value)) { return $value; @@ -64,12 +66,13 @@ public function assert(mixed $value) : mixed /** * @return Type */ - public function base() : Type + public function base(): Type { return $this->base; } - public function cast(mixed $value) : mixed + #[\Override] + public function cast(mixed $value): mixed { if ($this->isValid($value)) { return $value; @@ -78,7 +81,8 @@ public function cast(mixed $value) : mixed return $this->base->cast($value); } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { if ($value === null) { return true; @@ -90,7 +94,8 @@ public function isValid(mixed $value) : bool /** * @return array{type: 'optional', base: array} */ - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'optional', @@ -98,7 +103,8 @@ public function normalize() : array ]; } - public function toString() : string + #[\Override] + public function toString(): string { return '?' . $this->base->toString(); } diff --git a/src/lib/types/src/Flow/Types/Type/Logical/PositiveIntegerType.php b/src/lib/types/src/Flow/Types/Type/Logical/PositiveIntegerType.php index e56b7ac0b..14d5ab0e0 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/PositiveIntegerType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/PositiveIntegerType.php @@ -12,7 +12,8 @@ */ final readonly class PositiveIntegerType implements Type { - public function assert(mixed $value) : int + #[\Override] + public function assert(mixed $value): int { if ($this->isValid($value)) { return $value; @@ -21,14 +22,14 @@ public function assert(mixed $value) : int throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : int + #[\Override] + public function cast(mixed $value): int { if ($this->isValid($value)) { return $value; } try { - if ($value instanceof \DOMElement) { return $this->assert((int) $value->nodeValue); } @@ -41,7 +42,7 @@ public function cast(mixed $value) : int $reference = new \DateTimeImmutable(); $endTime = $reference->add($value); - return $this->assert(((int) $endTime->format('Uu')) - (int) ($reference->format('Uu'))); + return $this->assert((int) $endTime->format('Uu') - (int) $reference->format('Uu')); } if (\is_numeric($value)) { @@ -58,19 +59,22 @@ public function cast(mixed $value) : int } } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return \is_int($value) && $value > 0; } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'positive_integer', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'positive_integer'; } diff --git a/src/lib/types/src/Flow/Types/Type/Logical/ScalarType.php b/src/lib/types/src/Flow/Types/Type/Logical/ScalarType.php index 8955de30c..7d61a445a 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/ScalarType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/ScalarType.php @@ -19,20 +19,17 @@ public function __construct() { - $this->innerType = type_union( - type_string(), - type_integer(), - type_boolean(), - type_float() - ); + $this->innerType = type_union(type_string(), type_integer(), type_boolean(), type_float()); } - public function assert(mixed $value) : string|int|bool|float + #[\Override] + public function assert(mixed $value): string|int|bool|float { return $this->innerType->assert($value); } - public function cast(mixed $value) : int|float|string|bool + #[\Override] + public function cast(mixed $value): int|float|string|bool { if ($this->isValid($value)) { return $value; @@ -41,19 +38,22 @@ public function cast(mixed $value) : int|float|string|bool return $this->innerType->cast($value); } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return $this->innerType->isValid($value); } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'scalar', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'scalar'; } diff --git a/src/lib/types/src/Flow/Types/Type/Logical/StructureType.php b/src/lib/types/src/Flow/Types/Type/Logical/StructureType.php index 0fa211842..73cee29f0 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/StructureType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/StructureType.php @@ -4,11 +4,12 @@ namespace Flow\Types\Type\Logical; -use function Flow\Types\DSL\{type_array, +use function Flow\Types\DSL\{ type_boolean, type_from_array, type_literal, type_map, + type_mixed, type_string, type_structure}; use Flow\Types\Exception\{CastingException, InvalidArgumentException, InvalidTypeException}; @@ -37,8 +38,11 @@ * * @throws InvalidArgumentException */ - public function __construct(array $elements, array $optionalElements = [], private bool $allowExtra = false) - { + public function __construct( + array $elements, + array $optionalElements = [], + private bool $allowExtra = false, + ) { if (0 === \count($elements) && 0 === \count($optionalElements)) { throw new InvalidArgumentException('Structure must receive at least one element (required or optional).'); } @@ -59,7 +63,8 @@ public function __construct(array $elements, array $optionalElements = [], priva $duplicateKeys = \array_intersect_key($elements, $optionalElements); if (!empty($duplicateKeys)) { - throw new InvalidArgumentException('Element keys cannot be both required and optional: ' . \implode(', ', \array_keys($duplicateKeys))); + throw new InvalidArgumentException('Element keys cannot be both required and optional: ' + . \implode(', ', \array_keys($duplicateKeys))); } $this->elements = $elements; @@ -71,16 +76,14 @@ public function __construct(array $elements, array $optionalElements = [], priva * * @return StructureType */ - public static function fromArray(array $data) : self + public static function fromArray(array $data): self { - $data = type_structure( - [ - 'type' => type_literal('structure'), - 'elements' => type_map(type_string(), type_array()), - 'optional_elements' => type_map(type_string(), type_array()), - 'allow_extra' => type_boolean(), - ] - )->assert($data); + $data = type_structure([ + 'type' => type_literal('structure'), + 'elements' => type_map(type_string(), type_map(type_string(), type_mixed())), + 'optional_elements' => type_map(type_string(), type_map(type_string(), type_mixed())), + 'allow_extra' => type_boolean(), + ])->assert($data); $elements = []; @@ -97,12 +100,13 @@ public static function fromArray(array $data) : self return new self($elements, $optionalElements, $data['allow_extra']); } - public function allowsExtra() : bool + public function allowsExtra(): bool { return $this->allowExtra; } - public function assert(mixed $value) : array + #[\Override] + public function assert(mixed $value): array { if ($this->isValid($value)) { return $value; @@ -111,7 +115,8 @@ public function assert(mixed $value) : array throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : array + #[\Override] + public function cast(mixed $value): array { if ($this->isValid($value)) { return $value; @@ -126,7 +131,7 @@ public function cast(mixed $value) : array // Cast required elements foreach ($this->elements as $elementName => $elementType) { - $castedStructure[$elementName] = (\is_array($value) && \array_key_exists($elementName, $value)) + $castedStructure[$elementName] = \is_array($value) && \array_key_exists($elementName, $value) ? $elementType->cast($value[$elementName]) : $elementType->cast(null); } @@ -147,12 +152,13 @@ public function cast(mixed $value) : array /** * @return array> */ - public function elements() : array + public function elements(): array { return $this->elements; } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { if (!\is_array($value)) { return false; @@ -192,7 +198,8 @@ public function isValid(mixed $value) : bool /** * @return array{type: 'structure', elements: array>, optional_elements: array>, allow_extra: bool} */ - public function normalize() : array + #[\Override] + public function normalize(): array { $elements = []; @@ -226,12 +233,13 @@ public function normalize() : array /** * @return array> */ - public function optionalElements() : array + public function optionalElements(): array { return $this->optionalElements; } - public function toString() : string + #[\Override] + public function toString(): string { $content = []; diff --git a/src/lib/types/src/Flow/Types/Type/Logical/TimeType.php b/src/lib/types/src/Flow/Types/Type/Logical/TimeType.php index 0bb8a9fc4..9f2df0560 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/TimeType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/TimeType.php @@ -13,7 +13,8 @@ */ final readonly class TimeType implements Type { - public function assert(mixed $value) : \DateInterval + #[\Override] + public function assert(mixed $value): \DateInterval { if ($this->isValid($value)) { return $value; @@ -22,7 +23,8 @@ public function assert(mixed $value) : \DateInterval throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : \DateInterval + #[\Override] + public function cast(mixed $value): \DateInterval { if ($this->isValid($value)) { return $value; @@ -47,19 +49,22 @@ public function cast(mixed $value) : \DateInterval throw new CastingException($value, $this); } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return $value instanceof \DateInterval; } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'time', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'time'; } diff --git a/src/lib/types/src/Flow/Types/Type/Logical/TimeZoneType.php b/src/lib/types/src/Flow/Types/Type/Logical/TimeZoneType.php index f8d3af64c..4048d29f9 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/TimeZoneType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/TimeZoneType.php @@ -6,13 +6,15 @@ use Flow\Types\Exception\{CastingException, InvalidTypeException}; use Flow\Types\Type; +use function Flow\Types\DSL\type_instance_of; /** * @implements Type<\DateTimeZone> */ final readonly class TimeZoneType implements Type { - public function assert(mixed $value) : \DateTimeZone + #[\Override] + public function assert(mixed $value): \DateTimeZone { if ($this->isValid($value)) { return $value; @@ -21,7 +23,8 @@ public function assert(mixed $value) : \DateTimeZone throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : \DateTimeZone + #[\Override] + public function cast(mixed $value): \DateTimeZone { if ($this->isValid($value)) { return $value; @@ -37,7 +40,7 @@ public function cast(mixed $value) : \DateTimeZone } if ($value instanceof \DateTimeInterface) { - return $value->getTimezone(); + return type_instance_of(\DateTimeZone::class)->assert($value->getTimezone()); } } catch (\Throwable) { throw new CastingException($value, $this); @@ -46,19 +49,22 @@ public function cast(mixed $value) : \DateTimeZone throw new CastingException($value, $this); } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return $value instanceof \DateTimeZone; } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'timezone', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'timezone'; } diff --git a/src/lib/types/src/Flow/Types/Type/Logical/UuidType.php b/src/lib/types/src/Flow/Types/Type/Logical/UuidType.php index b1183e5ef..ac5acca66 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/UuidType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/UuidType.php @@ -13,7 +13,8 @@ */ final readonly class UuidType implements Type { - public function assert(mixed $value) : Uuid + #[\Override] + public function assert(mixed $value): Uuid { if ($this->isValid($value)) { return $value; @@ -22,7 +23,8 @@ public function assert(mixed $value) : Uuid throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : mixed + #[\Override] + public function cast(mixed $value): mixed { if ($this->isValid($value)) { return $value; @@ -37,17 +39,20 @@ public function cast(mixed $value) : mixed } if (\is_object($value) && \is_a($value, 'Ramsey\Uuid\UuidInterface')) { + /** @var \Ramsey\Uuid\UuidInterface $value */ return new Uuid($value); } if (\is_object($value) && \is_a($value, 'Symfony\Component\Uid\Uuid')) { + /** @var \Symfony\Component\Uid\Uuid $value */ return new Uuid($value->toRfc4122()); } throw new CastingException($value, $this); } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { if ($value instanceof Uuid) { return true; @@ -56,14 +61,16 @@ public function isValid(mixed $value) : bool return false; } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'uuid', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'uuid'; } diff --git a/src/lib/types/src/Flow/Types/Type/Logical/XML/XMLConverter.php b/src/lib/types/src/Flow/Types/Type/Logical/XML/XMLConverter.php index cb733f1c1..84459e569 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/XML/XMLConverter.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/XML/XMLConverter.php @@ -11,12 +11,16 @@ final class XMLConverter * * @return array */ - public function toArray(\DOMDocument $document) : array + public function toArray(\DOMDocument $document): array { $xmlArray = []; if ($document->hasChildNodes()) { foreach ($document->childNodes as $child) { + if ($child instanceof \DOMNameSpaceNode) { + continue; + } + $xmlArray[$child->nodeName] = $this->convertDOMElement($child); } } @@ -27,20 +31,21 @@ public function toArray(\DOMDocument $document) : array /** * @return array */ - private function convertDOMElement(\DOMElement|\DOMNode $element) : array + private function convertDOMElement(\DOMElement|\DOMNode $element): array { $xmlArray = []; if ($element->hasAttributes()) { - /** - * @var \DOMAttr $attribute - */ foreach ($element->attributes as $attribute) { $xmlArray['@attributes'][$attribute->name] = $attribute->value; } } foreach ($element->childNodes as $childNode) { + if ($childNode instanceof \DOMNameSpaceNode) { + continue; + } + if ($childNode->nodeType === XML_TEXT_NODE) { if (\trim((string) $childNode->nodeValue)) { $xmlArray['@value'] = $childNode->nodeValue; @@ -60,7 +65,7 @@ private function convertDOMElement(\DOMElement|\DOMNode $element) : array return $xmlArray; } - private function isElementCollection(\DOMElement|\DOMNode $element) : bool + private function isElementCollection(\DOMElement|\DOMNode $element): bool { if ($element->childNodes->count() <= 1) { return false; diff --git a/src/lib/types/src/Flow/Types/Type/Logical/XMLElementType.php b/src/lib/types/src/Flow/Types/Type/Logical/XMLElementType.php index 5706c1e3a..fdd1ee3b8 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/XMLElementType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/XMLElementType.php @@ -13,7 +13,8 @@ */ final readonly class XMLElementType implements Type { - public function assert(mixed $value) : \DOMElement + #[\Override] + public function assert(mixed $value): \DOMElement { if ($this->isValid($value)) { return $value; @@ -22,7 +23,8 @@ public function assert(mixed $value) : \DOMElement throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : \DOMElement + #[\Override] + public function cast(mixed $value): \DOMElement { if ($this->isValid($value)) { return $value; @@ -38,19 +40,22 @@ public function cast(mixed $value) : \DOMElement throw new CastingException($value, $this); } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return $value instanceof \DOMElement; } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'xml_element', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'xml_element'; } diff --git a/src/lib/types/src/Flow/Types/Type/Logical/XMLType.php b/src/lib/types/src/Flow/Types/Type/Logical/XMLType.php index d75719648..6d3cd2c98 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/XMLType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/XMLType.php @@ -13,7 +13,8 @@ */ final readonly class XMLType implements Type { - public function assert(mixed $value) : \DOMDocument + #[\Override] + public function assert(mixed $value): \DOMDocument { if ($this->isValid($value)) { return $value; @@ -22,7 +23,8 @@ public function assert(mixed $value) : \DOMDocument throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : \DOMDocument + #[\Override] + public function cast(mixed $value): \DOMDocument { if ($this->isValid($value)) { return $value; @@ -43,7 +45,7 @@ public function cast(mixed $value) : \DOMDocument $doc = new \DOMDocument(); - if (!@$doc->loadXML((string) $stringValue)) { + if (!@$doc->loadXML($stringValue)) { throw new CastingException($stringValue, $this); } @@ -53,7 +55,8 @@ public function cast(mixed $value) : \DOMDocument } } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { if ($value instanceof \DOMDocument) { return true; @@ -62,14 +65,16 @@ public function isValid(mixed $value) : bool return false; } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'xml', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'xml'; } diff --git a/src/lib/types/src/Flow/Types/Type/Native/ArrayType.php b/src/lib/types/src/Flow/Types/Type/Native/ArrayType.php index 2c22e6073..8921b73db 100644 --- a/src/lib/types/src/Flow/Types/Type/Native/ArrayType.php +++ b/src/lib/types/src/Flow/Types/Type/Native/ArrayType.php @@ -9,14 +9,15 @@ use Flow\Types\Type\Logical\XML\XMLConverter; /** - * @implements Type + * @implements Type> */ final readonly class ArrayType implements Type { /** * @return array */ - public function assert(mixed $value) : array + #[\Override] + public function assert(mixed $value): array { if ($this->isValid($value)) { return $value; @@ -28,7 +29,8 @@ public function assert(mixed $value) : array /** * @return array */ - public function cast(mixed $value) : array + #[\Override] + public function cast(mixed $value): array { if ($this->isValid($value)) { return $value; @@ -36,6 +38,7 @@ public function cast(mixed $value) : array try { if (\is_string($value) && (\str_starts_with($value, '{') || \str_starts_with($value, '['))) { + /** @var array|scalar|null $decoded */ $decoded = \json_decode($value, true, 512, \JSON_THROW_ON_ERROR); return \is_array($decoded) ? $decoded : throw new CastingException($value, $this); @@ -46,18 +49,25 @@ public function cast(mixed $value) : array } if (\is_object($value)) { + /** @var array|scalar|null $encoded */ $encoded = \json_decode(\json_encode($value, \JSON_THROW_ON_ERROR), true, 512, \JSON_THROW_ON_ERROR); return \is_array($encoded) ? $encoded : throw new CastingException($value, $this); } + if ($value === null) { + return []; + } + + /** @var scalar $value At this point, non-array/object/JSON-string values */ return (array) $value; } catch (\Throwable) { throw new CastingException($value, $this); } } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { if (!\is_array($value)) { return false; @@ -66,14 +76,16 @@ public function isValid(mixed $value) : bool return true; } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'array', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'array'; } diff --git a/src/lib/types/src/Flow/Types/Type/Native/BooleanType.php b/src/lib/types/src/Flow/Types/Type/Native/BooleanType.php index ce125ccd7..5d4602459 100644 --- a/src/lib/types/src/Flow/Types/Type/Native/BooleanType.php +++ b/src/lib/types/src/Flow/Types/Type/Native/BooleanType.php @@ -12,7 +12,8 @@ */ final readonly class BooleanType implements Type { - public function assert(mixed $value) : bool + #[\Override] + public function assert(mixed $value): bool { if ($this->isValid($value)) { return $value; @@ -21,7 +22,8 @@ public function assert(mixed $value) : bool throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : bool + #[\Override] + public function cast(mixed $value): bool { if ($this->isValid($value)) { return $value; @@ -48,19 +50,22 @@ public function cast(mixed $value) : bool } } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return \is_bool($value); } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'boolean', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'boolean'; } diff --git a/src/lib/types/src/Flow/Types/Type/Native/CallableType.php b/src/lib/types/src/Flow/Types/Type/Native/CallableType.php index 068e9b0d6..590b7b0d0 100644 --- a/src/lib/types/src/Flow/Types/Type/Native/CallableType.php +++ b/src/lib/types/src/Flow/Types/Type/Native/CallableType.php @@ -12,7 +12,8 @@ */ final readonly class CallableType implements Type { - public function assert(mixed $value) : callable + #[\Override] + public function assert(mixed $value): callable { if ($this->isValid($value)) { return $value; @@ -21,7 +22,8 @@ public function assert(mixed $value) : callable throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : callable + #[\Override] + public function cast(mixed $value): callable { if ($this->isValid($value)) { return $value; @@ -30,19 +32,22 @@ public function cast(mixed $value) : callable throw new CastingException($value, $this); } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return \is_callable($value); } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'callable', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'callable'; } diff --git a/src/lib/types/src/Flow/Types/Type/Native/EnumType.php b/src/lib/types/src/Flow/Types/Type/Native/EnumType.php index 3284c72fa..f5c9de833 100644 --- a/src/lib/types/src/Flow/Types/Type/Native/EnumType.php +++ b/src/lib/types/src/Flow/Types/Type/Native/EnumType.php @@ -7,10 +7,9 @@ use function Flow\Types\DSL\{type_class_string, type_literal, type_structure}; use Flow\Types\Exception\{CastingException, InvalidArgumentException, InvalidTypeException}; use Flow\Types\Type; -use UnitEnum; /** - * @template T of UnitEnum + * @template T of \UnitEnum * * @implements Type */ @@ -19,8 +18,9 @@ /** * @param class-string $class */ - public function __construct(public string $class) - { + public function __construct( + public string $class, + ) { if ($class !== \UnitEnum::class && $this->class !== \BackedEnum::class && !\enum_exists($class)) { throw new InvalidArgumentException("Enum {$class} not found"); } @@ -31,18 +31,21 @@ public function __construct(public string $class) * * @return EnumType<\UnitEnum> */ - public static function fromArray(array $data) : self + public static function fromArray(array $data): self { $data = type_structure([ 'type' => type_literal('enum'), 'class' => type_class_string(), ])->assert($data); - /** @phpstan-ignore-next-line */ - return new self($data['class']); + /** @var class-string<\UnitEnum> $class class-string validated at runtime by constructor */ + $class = $data['class']; + + return new self($class); } - public function assert(mixed $value) : \UnitEnum + #[\Override] + public function assert(mixed $value): \UnitEnum { if ($this->isValid($value)) { return $value; @@ -51,7 +54,8 @@ public function assert(mixed $value) : \UnitEnum throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : \UnitEnum + #[\Override] + public function cast(mixed $value): \UnitEnum { if ($this->isValid($value)) { return $value; @@ -65,6 +69,7 @@ public function cast(mixed $value) : \UnitEnum throw new CastingException($value, $this); } + /** @var class-string<\BackedEnum> $enumClass */ return $enumClass::from($value); } @@ -74,12 +79,14 @@ public function cast(mixed $value) : \UnitEnum } } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return (\is_object($value) || \is_string($value)) && \is_a($value, $this->class, true); } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'enum', @@ -87,7 +94,8 @@ public function normalize() : array ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'enum<' . $this->class . '>'; } diff --git a/src/lib/types/src/Flow/Types/Type/Native/FloatType.php b/src/lib/types/src/Flow/Types/Type/Native/FloatType.php index 9f2ceb7ae..415ec7088 100644 --- a/src/lib/types/src/Flow/Types/Type/Native/FloatType.php +++ b/src/lib/types/src/Flow/Types/Type/Native/FloatType.php @@ -12,7 +12,8 @@ */ final readonly class FloatType implements Type { - public function assert(mixed $value) : float + #[\Override] + public function assert(mixed $value): float { if ($this->isValid($value)) { return $value; @@ -21,25 +22,37 @@ public function assert(mixed $value) : float throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : float + #[\Override] + public function cast(mixed $value): float { if ($this->isValid($value)) { return $value; } if ($value instanceof \DOMElement) { - return (float) $value->nodeValue; + /** @var numeric-string $nodeValue */ + $nodeValue = $value->nodeValue ?? '0'; + + return (float) $nodeValue; } if ($value instanceof \DateTimeImmutable) { - return (float) $value->format('Uu'); + /** @var numeric-string $timestamp */ + $timestamp = $value->format('Uu'); + + return (float) $timestamp; } if ($value instanceof \DateInterval) { $reference = new \DateTimeImmutable(); $endTime = $reference->add($value); - return (float) $endTime->format('Uu') - (float) $reference->format('Uu'); + /** @var numeric-string $endTimestamp */ + $endTimestamp = $endTime->format('Uu'); + /** @var numeric-string $refTimestamp */ + $refTimestamp = $reference->format('Uu'); + + return (float) $endTimestamp - (float) $refTimestamp; } if (\is_scalar($value) || null === $value || \is_array($value)) { @@ -49,19 +62,22 @@ public function cast(mixed $value) : float throw new CastingException($value, $this); } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return \is_float($value); } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'float', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'float'; } diff --git a/src/lib/types/src/Flow/Types/Type/Native/IntegerType.php b/src/lib/types/src/Flow/Types/Type/Native/IntegerType.php index cda3a2ad9..6208908d9 100644 --- a/src/lib/types/src/Flow/Types/Type/Native/IntegerType.php +++ b/src/lib/types/src/Flow/Types/Type/Native/IntegerType.php @@ -12,7 +12,8 @@ */ final readonly class IntegerType implements Type { - public function assert(mixed $value) : int + #[\Override] + public function assert(mixed $value): int { if ($this->isValid($value)) { return $value; @@ -21,14 +22,14 @@ public function assert(mixed $value) : int throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : int + #[\Override] + public function cast(mixed $value): int { if ($this->isValid($value)) { return $value; } try { - if ($value instanceof \DOMElement) { return (int) $value->nodeValue; } @@ -41,7 +42,7 @@ public function cast(mixed $value) : int $reference = new \DateTimeImmutable(); $endTime = $reference->add($value); - return (int) ($endTime->format('Uu')) - (int) ($reference->format('Uu')); + return (int) $endTime->format('Uu') - (int) $reference->format('Uu'); } if (\is_object($value)) { @@ -58,19 +59,22 @@ public function cast(mixed $value) : int } } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return \is_int($value); } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'integer', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'integer'; } diff --git a/src/lib/types/src/Flow/Types/Type/Native/IntersectionType.php b/src/lib/types/src/Flow/Types/Type/Native/IntersectionType.php index 8d0715c84..9473e7a53 100644 --- a/src/lib/types/src/Flow/Types/Type/Native/IntersectionType.php +++ b/src/lib/types/src/Flow/Types/Type/Native/IntersectionType.php @@ -26,8 +26,10 @@ * @param Type $left * @param Type $right */ - public function __construct(private Type $left, private Type $right) - { + public function __construct( + private Type $left, + private Type $right, + ) { if ($left instanceof MixedType || $right instanceof MixedType) { throw new InvalidTypeException('IntersectionType cannot be mixed with MixedType, mixed is a standalone type'); } @@ -54,7 +56,7 @@ public function __construct(private Type $left, private Type $right) * * @return IntersectionType */ - public static function fromArray(array $data) : self + public static function fromArray(array $data): self { $data = type_structure([ 'type' => type_literal('intersection'), @@ -62,16 +64,14 @@ public static function fromArray(array $data) : self 'right' => type_map(type_string(), type_mixed()), ])->assert($data); - return new self( - TypeFactory::fromArray($data['left']), - TypeFactory::fromArray($data['right']), - ); + return new self(TypeFactory::fromArray($data['left']), TypeFactory::fromArray($data['right'])); } /** * @return TLeft&TRight */ - public function assert(mixed $value) : mixed + #[\Override] + public function assert(mixed $value): mixed { if (!$this->isValid($value)) { throw InvalidTypeException::value($value, $this); @@ -80,7 +80,8 @@ public function assert(mixed $value) : mixed return $value; } - public function cast(mixed $value) : mixed + #[\Override] + public function cast(mixed $value): mixed { if ($this->isValid($value)) { return $value; @@ -107,7 +108,8 @@ public function cast(mixed $value) : mixed throw new CastingException($value, $this); } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return $this->left->isValid($value) && $this->right->isValid($value); } @@ -115,7 +117,8 @@ public function isValid(mixed $value) : bool /** * @return array{type: 'intersection', left: array, right: array} */ - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'intersection', @@ -124,7 +127,8 @@ public function normalize() : array ]; } - public function toString() : string + #[\Override] + public function toString(): string { $stringTypes = []; @@ -152,7 +156,7 @@ public function toString() : string /** * @return Types */ - public function types() : Types + public function types(): Types { return $this->flatTypes; } diff --git a/src/lib/types/src/Flow/Types/Type/Native/MixedType.php b/src/lib/types/src/Flow/Types/Type/Native/MixedType.php index 79039f6a9..c4a9584e3 100644 --- a/src/lib/types/src/Flow/Types/Type/Native/MixedType.php +++ b/src/lib/types/src/Flow/Types/Type/Native/MixedType.php @@ -11,29 +11,34 @@ */ final class MixedType implements Type { - public function assert(mixed $value) : mixed + #[\Override] + public function assert(mixed $value): mixed { return $value; } - public function cast(mixed $value) : mixed + #[\Override] + public function cast(mixed $value): mixed { return $value; } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return true; } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'mixed', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'mixed'; } diff --git a/src/lib/types/src/Flow/Types/Type/Native/NullType.php b/src/lib/types/src/Flow/Types/Type/Native/NullType.php index fcc6d6382..cfaf72b46 100644 --- a/src/lib/types/src/Flow/Types/Type/Native/NullType.php +++ b/src/lib/types/src/Flow/Types/Type/Native/NullType.php @@ -12,7 +12,8 @@ */ final class NullType implements Type { - public function assert(mixed $value) : null + #[\Override] + public function assert(mixed $value): null { if ($this->isValid($value)) { return $value; @@ -21,24 +22,28 @@ public function assert(mixed $value) : null throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : null + #[\Override] + public function cast(mixed $value): null { return null; } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return null === $value; } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'null', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'null'; } diff --git a/src/lib/types/src/Flow/Types/Type/Native/ObjectType.php b/src/lib/types/src/Flow/Types/Type/Native/ObjectType.php index 4d89b5afb..d1cb9b9c9 100644 --- a/src/lib/types/src/Flow/Types/Type/Native/ObjectType.php +++ b/src/lib/types/src/Flow/Types/Type/Native/ObjectType.php @@ -12,11 +12,10 @@ */ final class ObjectType implements Type { - public function __construct() - { - } + public function __construct() {} - public function assert(mixed $value) : mixed + #[\Override] + public function assert(mixed $value): mixed { if ($this->isValid($value)) { return $value; @@ -25,7 +24,8 @@ public function assert(mixed $value) : mixed throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : object + #[\Override] + public function cast(mixed $value): object { if ($this->isValid($value)) { return $value; @@ -34,19 +34,22 @@ public function cast(mixed $value) : object return (object) $value; } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return \is_object($value); } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'object', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'object'; } diff --git a/src/lib/types/src/Flow/Types/Type/Native/ResourceType.php b/src/lib/types/src/Flow/Types/Type/Native/ResourceType.php index abdb98659..ff7955221 100644 --- a/src/lib/types/src/Flow/Types/Type/Native/ResourceType.php +++ b/src/lib/types/src/Flow/Types/Type/Native/ResourceType.php @@ -12,7 +12,8 @@ */ final readonly class ResourceType implements Type { - public function assert(mixed $value) : mixed + #[\Override] + public function assert(mixed $value): mixed { if ($this->isValid($value)) { return $value; @@ -21,7 +22,8 @@ public function assert(mixed $value) : mixed throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : mixed + #[\Override] + public function cast(mixed $value): mixed { if ($this->isValid($value)) { return $value; @@ -30,19 +32,22 @@ public function cast(mixed $value) : mixed throw new CastingException($value, $this); } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return \is_resource($value); } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'resource', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'resource'; } diff --git a/src/lib/types/src/Flow/Types/Type/Native/String/StringTypeNarrower.php b/src/lib/types/src/Flow/Types/Type/Native/String/StringTypeNarrower.php index 7fa9081d7..3c5018a28 100644 --- a/src/lib/types/src/Flow/Types/Type/Native/String/StringTypeNarrower.php +++ b/src/lib/types/src/Flow/Types/Type/Native/String/StringTypeNarrower.php @@ -4,7 +4,8 @@ namespace Flow\Types\Type\Native\String; -use function Flow\Types\DSL\{type_boolean, +use function Flow\Types\DSL\{ + type_boolean, type_date, type_datetime, type_float, @@ -15,7 +16,8 @@ type_string, type_time_zone, type_uuid, - type_xml}; + type_xml +}; use Flow\Types\Type; use Flow\Types\Type\Logical\HTMLType; use Flow\Types\Type\TypeNarrower; @@ -26,7 +28,8 @@ final class StringTypeNarrower implements TypeNarrower /** * @return Type */ - public function narrow(mixed $value) : Type + #[\Override] + public function narrow(mixed $value): Type { if (!\is_string($value)) { return type_string(); @@ -57,7 +60,7 @@ public function narrow(mixed $value) : Type /** * @param non-empty-string $value */ - private function isBoolean(string $value) : bool + private function isBoolean(string $value): bool { return \in_array(\strtolower($value), ['true', 'false'], true); } @@ -65,11 +68,11 @@ private function isBoolean(string $value) : bool /** * @param non-empty-string $value */ - private function isDate(string $value) : bool + private function isDate(string $value): bool { $dateParts = \date_parse($value); - if ($dateParts['error_count'] > 0) { + if ((int) $dateParts['error_count'] > 0) { return false; } @@ -107,11 +110,11 @@ private function isDate(string $value) : bool /** * @param non-empty-string $value */ - private function isDateTime(string $value) : bool + private function isDateTime(string $value): bool { $dateParts = \date_parse($value); - if ($dateParts['error_count'] > 0) { + if ((int) $dateParts['error_count'] > 0) { return false; } @@ -127,7 +130,8 @@ private function isDateTime(string $value) : bool return false; } - $hasDirectTime = ($dateParts['hour'] ?? false) !== false + $hasDirectTime = + ($dateParts['hour'] ?? false) !== false || ($dateParts['minute'] ?? false) !== false || ($dateParts['second'] ?? false) !== false || ($dateParts['fraction'] ?? false) !== false; @@ -137,6 +141,7 @@ private function isDateTime(string $value) : bool } if (\is_array($dateParts['relative'] ?? false)) { + /** @var array{hour?: int, minute?: int, second?: int} $relative */ $relative = $dateParts['relative']; return ($relative['hour'] ?? 0) !== 0 || ($relative['minute'] ?? 0) !== 0 || ($relative['second'] ?? 0) !== 0; @@ -148,7 +153,7 @@ private function isDateTime(string $value) : bool /** * @param non-empty-string $value */ - private function isFloat(string $value) : bool + private function isFloat(string $value): bool { if (!\is_numeric($value)) { return false; @@ -165,7 +170,7 @@ private function isFloat(string $value) : bool /** * @param non-empty-string $value */ - private function isHTML(string $value) : bool + private function isHTML(string $value): bool { if ('<' !== $value[0]) { return false; @@ -177,10 +182,10 @@ private function isHTML(string $value) : bool /** * @param non-empty-string $value */ - private function isInteger(string $value) : bool + private function isInteger(string $value): bool { if (\is_numeric($value)) { - return (string) ((int) $value) === $value; + return (string) (int) $value === $value; } return false; @@ -189,7 +194,7 @@ private function isInteger(string $value) : bool /** * @param non-empty-string $value */ - private function isJson(string $value) : bool + private function isJson(string $value): bool { return type_json()->isValid($value); } @@ -197,7 +202,7 @@ private function isJson(string $value) : bool /** * @param non-empty-string $value */ - private function isNull(string $value) : bool + private function isNull(string $value): bool { return \in_array(\mb_strtolower($value), ['null', 'nil'], true); } @@ -205,7 +210,7 @@ private function isNull(string $value) : bool /** * @param non-empty-string $value */ - private function isTimeZone(string $value) : bool + private function isTimeZone(string $value): bool { if (\in_array($value, \DateTimeZone::listIdentifiers(), true)) { return true; @@ -227,7 +232,7 @@ private function isTimeZone(string $value) : bool /** * @param non-empty-string $value */ - private function isUuid(string $value) : bool + private function isUuid(string $value): bool { return Uuid::isValid($value); } @@ -235,7 +240,7 @@ private function isUuid(string $value) : bool /** * @param non-empty-string $value */ - private function isXML(string $value) : bool + private function isXML(string $value): bool { if ('<' !== $value[0]) { return false; @@ -248,7 +253,7 @@ private function isXML(string $value) : bool $doc = new \DOMDocument(); $result = @$doc->loadXML($value); - return (bool) $result; + return $result; } catch (\Exception) { return false; } finally { diff --git a/src/lib/types/src/Flow/Types/Type/Native/StringType.php b/src/lib/types/src/Flow/Types/Type/Native/StringType.php index 55b8f55a1..62d6d4806 100644 --- a/src/lib/types/src/Flow/Types/Type/Native/StringType.php +++ b/src/lib/types/src/Flow/Types/Type/Native/StringType.php @@ -14,7 +14,8 @@ */ final readonly class StringType implements Type { - public function assert(mixed $value) : string + #[\Override] + public function assert(mixed $value): string { if ($this->isValid($value)) { return $value; @@ -23,7 +24,8 @@ public function assert(mixed $value) : string throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : string + #[\Override] + public function cast(mixed $value): string { if ($this->isValid($value)) { return $value; @@ -70,7 +72,11 @@ public function cast(mixed $value) : string return ''; } - if (\is_scalar($value) || (\is_object($value) && method_exists($value, '__toString'))) { + if (\is_scalar($value)) { + return (string) $value; + } + + if ((\is_object($value) && method_exists($value, '__toString')) || $value instanceof \Stringable) { return (string) $value; } @@ -80,24 +86,27 @@ public function cast(mixed $value) : string } } - public function isStringable(mixed $value) : bool + public function isStringable(mixed $value): bool { - return \is_string($value) || (\is_object($value) && method_exists($value, '__toString')) || $value instanceof \Stringable; + return \is_string($value) || \is_object($value) && method_exists($value, '__toString') || $value instanceof \Stringable; } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return \is_string($value); } - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'string', ]; } - public function toString() : string + #[\Override] + public function toString(): string { return 'string'; } diff --git a/src/lib/types/src/Flow/Types/Type/Native/UnionType.php b/src/lib/types/src/Flow/Types/Type/Native/UnionType.php index 1ae667a0f..8957b917f 100644 --- a/src/lib/types/src/Flow/Types/Type/Native/UnionType.php +++ b/src/lib/types/src/Flow/Types/Type/Native/UnionType.php @@ -26,8 +26,10 @@ * @param Type $left * @param Type $right */ - public function __construct(private Type $left, private Type $right) - { + public function __construct( + private Type $left, + private Type $right, + ) { if ($left instanceof MixedType || $right instanceof MixedType) { throw new InvalidTypeException('UnionType cannot be mixed with MixedType, mixed is a standalone type'); } @@ -54,7 +56,7 @@ public function __construct(private Type $left, private Type $right) * * @return UnionType */ - public static function fromArray(array $data) : self + public static function fromArray(array $data): self { $data = type_structure([ 'type' => type_literal('union'), @@ -62,16 +64,11 @@ public static function fromArray(array $data) : self 'right' => type_map(type_string(), type_mixed()), ])->assert($data); - return new self( - TypeFactory::fromArray($data['left']), - TypeFactory::fromArray($data['right']), - ); + return new self(TypeFactory::fromArray($data['left']), TypeFactory::fromArray($data['right'])); } - /** - * @return TLeft|TRight - */ - public function assert(mixed $value) : mixed + #[\Override] + public function assert(mixed $value): mixed { if ($this->left->isValid($value)) { return $value; @@ -84,7 +81,8 @@ public function assert(mixed $value) : mixed throw InvalidTypeException::value($value, $this); } - public function cast(mixed $value) : mixed + #[\Override] + public function cast(mixed $value): mixed { if ($this->isValid($value)) { return $value; @@ -105,7 +103,7 @@ public function cast(mixed $value) : mixed throw new CastingException($value, $this); } - public function isOptionalType() : bool + public function isOptionalType(): bool { if (\count($this->types()) !== 2) { return false; @@ -124,7 +122,8 @@ public function isOptionalType() : bool return false; } - public function isValid(mixed $value) : bool + #[\Override] + public function isValid(mixed $value): bool { return $this->left->isValid($value) || $this->right->isValid($value); } @@ -132,7 +131,8 @@ public function isValid(mixed $value) : bool /** * @return array{type: 'union', left: array, right: array} */ - public function normalize() : array + #[\Override] + public function normalize(): array { return [ 'type' => 'union', @@ -141,7 +141,8 @@ public function normalize() : array ]; } - public function toString() : string + #[\Override] + public function toString(): string { $stringTypes = []; @@ -169,7 +170,7 @@ public function toString() : string /** * @return Types */ - public function types() : Types + public function types(): Types { return $this->flatTypes; } diff --git a/src/lib/types/src/Flow/Types/Type/TypeDetector.php b/src/lib/types/src/Flow/Types/Type/TypeDetector.php index 43d5f4caa..9071865f4 100644 --- a/src/lib/types/src/Flow/Types/Type/TypeDetector.php +++ b/src/lib/types/src/Flow/Types/Type/TypeDetector.php @@ -4,7 +4,8 @@ namespace Flow\Types\Type; -use function Flow\Types\DSL\{type_array, +use function Flow\Types\DSL\{ + type_array, type_boolean, type_date, type_datetime, @@ -23,7 +24,8 @@ type_uuid, type_xml, type_xml_element, - types}; + types +}; use Flow\Types\Exception\InvalidArgumentException; use Flow\Types\Type; use Flow\Types\Type\Logical\{ListType, StructureType}; @@ -33,7 +35,7 @@ final class TypeDetector /** * @return Type */ - public function detectType(mixed $value) : Type + public function detectType(mixed $value): Type { if (null === $value) { return type_null(); @@ -69,10 +71,12 @@ public function detectType(mixed $value) : Type return type_array(); } + /** @var Types $keyTypes */ + $keyTypes = types(...\array_map($this->detectType(...), \array_keys($value)))->deduplicate(); $detector = new ArrayContentDetector( - types(...\array_map($this->detectType(...), \array_keys($value)))->deduplicate(), + $keyTypes, types(...\array_map($this->detectType(...), \array_values($value)))->deduplicate(), - \array_is_list($value) + \array_is_list($value), ); if ($detector->isList()) { @@ -80,15 +84,19 @@ public function detectType(mixed $value) : Type } if ($detector->isMap()) { - return type_map($detector->firstKeyType(), $detector->valueType()); + $keyType = $detector->firstKeyType(); + + if ($keyType !== null) { + return type_map($keyType, $detector->valueType()); + } } if ($detector->isStructure()) { - /** @var array> $elements */ + /** @var array> $elements */ $elements = []; foreach ($value as $key => $item) { - $elements[$key] = $this->detectType($item); + $elements[(string) $key] = $this->detectType($item); } return new StructureType($elements); diff --git a/src/lib/types/src/Flow/Types/Type/TypeFactory.php b/src/lib/types/src/Flow/Types/Type/TypeFactory.php index 57f1f83e9..4e226ef83 100644 --- a/src/lib/types/src/Flow/Types/Type/TypeFactory.php +++ b/src/lib/types/src/Flow/Types/Type/TypeFactory.php @@ -4,7 +4,8 @@ namespace Flow\Types\Type; -use function Flow\Types\DSL\{type_array, +use function Flow\Types\DSL\{ + type_array, type_boolean, type_callable, type_date, @@ -27,7 +28,8 @@ type_time_zone, type_uuid, type_xml, - type_xml_element}; + type_xml_element +}; use Flow\Types\Exception\InvalidArgumentException; use Flow\Types\Type; use Flow\Types\Type\Logical\{ClassStringType, InstanceOfType, ListType, LiteralType, MapType, OptionalType, StructureType}; @@ -40,7 +42,7 @@ final class TypeFactory * * @return Type */ - public static function fromArray(array $data) : Type + public static function fromArray(array $data): Type { type_array()->assert($data); @@ -85,7 +87,7 @@ public static function fromArray(array $data) : Type 'numeric-string' => type_numeric_string(), 'html' => type_html(), 'html_element' => type_html_element(), - default => throw new InvalidArgumentException("Unknown type '" . (\is_string($data['type']) ? $data['type'] : \gettype($data['type'])) . "'"), + default => throw new InvalidArgumentException("Unknown type '{$type}'"), }; } @@ -94,13 +96,13 @@ public static function fromArray(array $data) : Type * * @return Type */ - public static function fromString(string $name) : Type + public static function fromString(string $name): Type { return match (\mb_strtolower($name)) { - 'int','integer' => self::fromArray(['type' => 'integer', 'scalar_type' => 'integer']), + 'int', 'integer' => self::fromArray(['type' => 'integer', 'scalar_type' => 'integer']), 'float' => self::fromArray(['type' => 'float', 'scalar_type' => 'float']), 'string' => self::fromArray(['type' => 'string', 'scalar_type' => 'string']), - 'bool','boolean' => self::fromArray(['type' => 'boolean', 'scalar_type' => 'boolean']), + 'bool', 'boolean' => self::fromArray(['type' => 'boolean', 'scalar_type' => 'boolean']), default => self::fromArray(['type' => $name]), }; } diff --git a/src/lib/types/src/Flow/Types/Type/TypeNarrower.php b/src/lib/types/src/Flow/Types/Type/TypeNarrower.php index c78fe4580..aa256c0af 100644 --- a/src/lib/types/src/Flow/Types/Type/TypeNarrower.php +++ b/src/lib/types/src/Flow/Types/Type/TypeNarrower.php @@ -11,5 +11,5 @@ interface TypeNarrower /** * @return Type */ - public function narrow(mixed $value) : Type; + public function narrow(mixed $value): Type; } diff --git a/src/lib/types/src/Flow/Types/Type/Types.php b/src/lib/types/src/Flow/Types/Type/Types.php index 5a334a878..69bd71559 100644 --- a/src/lib/types/src/Flow/Types/Type/Types.php +++ b/src/lib/types/src/Flow/Types/Type/Types.php @@ -19,7 +19,7 @@ /** * @var ?Type */ - private ?Type $first; + private null|Type $first; /** * @var array> @@ -35,7 +35,8 @@ public function __construct(Type ...$types) $this->first = $types[0] ?? null; } - public function __toString() : string + #[\Override] + public function __toString(): string { $types = []; @@ -49,12 +50,13 @@ public function __toString() : string /** * @return array> */ - public function all() : array + public function all(): array { return $this->types; } - public function count() : int + #[\Override] + public function count(): int { return \count($this->types); } @@ -62,7 +64,7 @@ public function count() : int /** * @return Types */ - public function deduplicate() : self + public function deduplicate(): self { $types = []; @@ -76,7 +78,7 @@ public function deduplicate() : self /** * @return ?Type */ - public function first() : ?Type + public function first(): null|Type { return $this->first; } @@ -84,7 +86,7 @@ public function first() : ?Type /** * @param Type $type */ - public function has(Type $type) : bool + public function has(Type $type): bool { foreach ($this->types as $existingType) { if (type_equals($existingType, $type)) { @@ -98,7 +100,7 @@ public function has(Type $type) : bool /** * @param Type ...$types */ - public function hasAll(Type ...$types) : bool + public function hasAll(Type ...$types): bool { foreach ($types as $type) { if (!$this->has($type)) { @@ -112,7 +114,7 @@ public function hasAll(Type ...$types) : bool /** * @param Type ...$types */ - public function hasAny(Type ...$types) : bool + public function hasAny(Type ...$types): bool { foreach ($this->types as $existingType) { foreach ($types as $type) { @@ -130,9 +132,9 @@ public function hasAny(Type ...$types) : bool * * @return Types */ - public function only(Type ...$types) : self + public function only(Type ...$types): self { - $filteredTypes = \array_filter($this->types, static function (Type $type) use ($types) : bool { + $filteredTypes = \array_filter($this->types, static function (Type $type) use ($types): bool { foreach ($types as $keepType) { if (type_equals($type, $keepType)) { return true; @@ -150,7 +152,7 @@ public function only(Type ...$types) : self * * @return Types */ - public function reduceOptionals() : self + public function reduceOptionals(): self { $types = []; @@ -158,7 +160,11 @@ public function reduceOptionals() : self if ($type instanceof OptionalType) { $types[] = $type->base(); } elseif ($type instanceof UnionType && $type->isOptionalType()) { - $types[] = $type->types()->without(type_null())->first(); + $firstType = $type->types()->without(type_null())->first(); + + if ($firstType !== null) { + $types[] = $firstType; + } } else { $types[] = $type; } @@ -172,9 +178,9 @@ public function reduceOptionals() : self * * @return Types */ - public function without(Type ...$types) : self + public function without(Type ...$types): self { - $filteredTypes = \array_filter($this->types, static function (Type $type) use ($types) : bool { + $filteredTypes = \array_filter($this->types, static function (Type $type) use ($types): bool { foreach ($types as $withoutType) { if (type_equals($type, $withoutType)) { return false; diff --git a/src/lib/types/src/Flow/Types/Type/ValueComparator.php b/src/lib/types/src/Flow/Types/Type/ValueComparator.php index d185764b7..a46d60817 100644 --- a/src/lib/types/src/Flow/Types/Type/ValueComparator.php +++ b/src/lib/types/src/Flow/Types/Type/ValueComparator.php @@ -10,14 +10,14 @@ final readonly class ValueComparator { - public function __construct(private Comparator $comparator = new Comparator()) - { - } + public function __construct( + private Comparator $comparator = new Comparator(), + ) {} /** * @param array> $types */ - public function assertAllTypesComparable(array $types, Operator|string $operator) : void + public function assertAllTypesComparable(array $types, Operator|string $operator): void { $operator = \is_string($operator) ? Operator::from($operator) : $operator; @@ -25,7 +25,12 @@ public function assertAllTypesComparable(array $types, Operator|string $operator foreach ($types as $nextType) { foreach ($types as $baseType) { if (!$this->comparator->comparable($baseType, $nextType)) { - throw new InvalidArgumentException(\sprintf("Can't compare '(%s %s %s)' due to data type mismatch.", $baseType->toString(), $operator->value, $nextType->toString())); + throw new InvalidArgumentException(\sprintf( + "Can't compare '(%s %s %s)' due to data type mismatch.", + $baseType->toString(), + $operator->value, + $nextType->toString(), + )); } } } @@ -36,12 +41,17 @@ public function assertAllTypesComparable(array $types, Operator|string $operator * @param Type $left * @param Type $right */ - public function assertComparableTypes(Type $left, Type $right, Operator|string $operator) : void + public function assertComparableTypes(Type $left, Type $right, Operator|string $operator): void { $operator = \is_string($operator) ? Operator::from($operator) : $operator; if (!$this->comparator->comparable($left, $right)) { - throw new InvalidArgumentException(\sprintf("Can't compare '(%s %s %s)' due to data type mismatch.", $left->toString(), $operator->value, $right->toString())); + throw new InvalidArgumentException(\sprintf( + "Can't compare '(%s %s %s)' due to data type mismatch.", + $left->toString(), + $operator->value, + $right->toString(), + )); } } } diff --git a/src/lib/types/src/Flow/Types/Value/Uuid.php b/src/lib/types/src/Flow/Types/Value/Uuid.php index 9fab5ff65..6848fc05c 100644 --- a/src/lib/types/src/Flow/Types/Value/Uuid.php +++ b/src/lib/types/src/Flow/Types/Value/Uuid.php @@ -31,10 +31,12 @@ public function __construct(string|UuidInterface|\Symfony\Component\Uid\Uuid $va } elseif (self::isValid($value)) { $this->value = $value; } else { - throw new RuntimeException("\Ramsey\Uuid\Uuid nor \Symfony\Component\Uid\Uuid class not found, please add 'ramsey/uuid' or 'symfony/uid' as a dependency to the project first."); + throw new RuntimeException( + "\Ramsey\Uuid\Uuid nor \Symfony\Component\Uid\Uuid class not found, please add 'ramsey/uuid' or 'symfony/uid' as a dependency to the project first.", + ); } } catch (\InvalidArgumentException $e) { - throw new InvalidArgumentException("Invalid UUID: '{$value}'", $e->getCode(), $e); + throw new InvalidArgumentException("Invalid UUID: '{$value}'", (int) $e->getCode(), $e); } } elseif ($value instanceof UuidInterface) { $this->value = $value->toString(); @@ -43,12 +45,12 @@ public function __construct(string|UuidInterface|\Symfony\Component\Uid\Uuid $va } } - public static function fromString(string $value) : self + public static function fromString(string $value): self { return new self($value); } - public static function isValid(string $value) : bool + public static function isValid(string $value): bool { if (\strlen($value) !== 36) { return false; @@ -57,17 +59,18 @@ public static function isValid(string $value) : bool return 1 === \preg_match(self::UUID_REGEXP, $value); } - public function __toString() : string + #[\Override] + public function __toString(): string { return $this->toString(); } - public function isEqual(self $type) : bool + public function isEqual(self $type): bool { return $this->toString() === $type->toString(); } - public function toString() : string + public function toString(): string { return $this->value; } diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Fixtures/StringableObject.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Fixtures/StringableObject.php index f5e685394..c9f8f228c 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Fixtures/StringableObject.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Fixtures/StringableObject.php @@ -6,6 +6,7 @@ final class StringableObject implements \Stringable { + #[\Override] public function __toString() : string { return ''; diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Native/StringTypeTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Native/StringTypeTest.php index c1feba667..fdbe30ff4 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Native/StringTypeTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Native/StringTypeTest.php @@ -106,6 +106,7 @@ public static function cast_data_provider() : \Generator yield 'Stringable' => [ 'value' => new class() implements \Stringable { + #[\Override] public function __toString() : string { return 'stringable'; diff --git a/src/tools/documentation/src/Flow/Documentation/FunctionCollector.php b/src/tools/documentation/src/Flow/Documentation/FunctionCollector.php index 979b01dba..1c68b267d 100644 --- a/src/tools/documentation/src/Flow/Documentation/FunctionCollector.php +++ b/src/tools/documentation/src/Flow/Documentation/FunctionCollector.php @@ -16,6 +16,7 @@ class FunctionCollector extends NodeVisitorAbstract private string $currentNamespace = ''; + #[\Override] public function enterNode(Node $node) : int|Node|null { if ($node instanceof Namespace_) { diff --git a/tools/mago/.gitignore b/tools/mago/.gitignore new file mode 100644 index 000000000..5657f6ea7 --- /dev/null +++ b/tools/mago/.gitignore @@ -0,0 +1 @@ +vendor \ No newline at end of file diff --git a/tools/mago/composer.json b/tools/mago/composer.json new file mode 100644 index 000000000..82551d9da --- /dev/null +++ b/tools/mago/composer.json @@ -0,0 +1,13 @@ +{ + "name": "flow-php/flow-tools", + "description": "Flow PHP ETL - Tools", + "minimum-stability": "dev", + "prefer-stable": true, + "require-dev": { + "php": "~8.3.0 || ~8.4.0 || ~8.5.0", + "carthage-software/mago": "dev-main" + }, + "config": { + "allow-plugins": true + } +} diff --git a/tools/mago/composer.lock b/tools/mago/composer.lock new file mode 100644 index 000000000..1fab6c3b2 --- /dev/null +++ b/tools/mago/composer.lock @@ -0,0 +1,83 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "ff2049ec9a6a53390cb3fa206508c814", + "packages": [], + "packages-dev": [ + { + "name": "carthage-software/mago", + "version": "dev-main", + "source": { + "type": "git", + "url": "https://github.com/carthage-software/mago.git", + "reference": "7c8e9a2b390513d4eee7ed0874942e7f5631aafe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/carthage-software/mago/zipball/7c8e9a2b390513d4eee7ed0874942e7f5631aafe", + "reference": "7c8e9a2b390513d4eee7ed0874942e7f5631aafe", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.6", + "php": "~8.1 || ~8.2 || ~8.3 || ~8.4 || ~8.5 || ~8.6" + }, + "require-dev": { + "composer/composer": "^2.8" + }, + "default-branch": true, + "bin": [ + "composer/bin/mago" + ], + "type": "composer-plugin", + "extra": { + "class": "Mago\\MagoPlugin" + }, + "autoload": { + "psr-4": { + "Mago\\": "composer/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT OR Apache-2.0" + ], + "authors": [ + { + "name": "Saif Eddin Gmati", + "email": "azjezz@carthage.software" + } + ], + "description": "Mago is a toolchain for PHP that aims to provide a set of tools to help developers write better code.", + "keywords": [ + "dev" + ], + "support": { + "issues": "https://github.com/carthage-software/mago/issues", + "source": "https://github.com/carthage-software/mago/tree/main" + }, + "funding": [ + { + "url": "https://github.com/azjezz", + "type": "github" + } + ], + "time": "2025-12-12T02:25:06+00:00" + } + ], + "aliases": [], + "minimum-stability": "dev", + "stability-flags": { + "carthage-software/mago": 20 + }, + "prefer-stable": true, + "prefer-lowest": false, + "platform": {}, + "platform-dev": { + "php": "~8.3.0 || ~8.4.0 || ~8.5.0" + }, + "plugin-api-version": "2.6.0" +}