-
-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathdiff.txt
More file actions
579 lines (564 loc) · 15.6 KB
/
diff.txt
File metadata and controls
579 lines (564 loc) · 15.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
commit 7c0537685b24386bbde12d005999f97785c21229
Author: Norbert Orzechowicz <contact@norbert.tech>
Date: Sun Mar 8 10:54:56 2026 -0500
chore: remove deprecated dsl functions
diff --git a/src/core/etl/src/Flow/ETL/DSL/functions.php b/src/core/etl/src/Flow/ETL/DSL/functions.php
index 9d48aaa03..515bdb798 100644
--- a/src/core/etl/src/Flow/ETL/DSL/functions.php
+++ b/src/core/etl/src/Flow/ETL/DSL/functions.php
@@ -5,38 +5,8 @@ declare(strict_types=1);
namespace Flow\ETL\DSL;
use function Flow\Filesystem\DSL\path_real;
-use function Flow\Types\DSL\{
- dom_element_to_string as dom_element_to_string_new,
- get_type as get_type_new,
- type_array as type_array_new,
- type_boolean as type_boolean_new,
- type_callable as type_callable_new,
- type_date as type_date_new,
- type_datetime as type_datetime_new,
- type_enum as type_enum_new,
- type_equals as type_equals_new,
- type_float as type_float_new,
- type_from_array as type_from_array_new,
- type_instance_of as type_instance_of_new,
- type_integer as type_integer_new,
- type_is as type_is_new,
- type_is_any as type_is_any_new,
- type_is_nullable as is_nullable_new,
- type_json as type_json_new,
- type_list as type_list_new,
- type_map as type_map_new,
- type_null as type_null_new,
- type_optional as type_optional_new,
- type_resource as type_resource_new,
- type_string as type_string_new,
- type_structure as type_structure_new,
- type_time as type_time_new,
- type_union as type_union_new,
- type_uuid as type_uuid_new,
- type_xml as type_xml_new,
- type_xml_element as type_xml_element_new,
- types as types_new
-};
+use function Flow\Types\DSL\type_array;
+
use Dom\{HTMLDocument, HTMLElement};
use Flow\Calculator\Rounding;
use Flow\Clock\SystemClock;
@@ -219,11 +189,9 @@ use Flow\Types\Type\Logical\{DateTimeType,
DateType,
HTMLElementType,
HTMLType,
- InstanceOfType,
JsonType,
ListType,
MapType,
- OptionalType,
StructureType,
TimeType,
UuidType,
@@ -232,19 +200,14 @@ use Flow\Types\Type\Logical\{DateTimeType,
use Flow\Types\Type\Native\{
ArrayType,
BooleanType,
- CallableType,
EnumType,
FloatType,
IntegerType,
- NullType,
- ResourceType,
- StringType,
- UnionType
+ StringType
};
-use Flow\Types\Type\{TypeFactory, Types};
+use Flow\Types\Type\TypeFactory;
use Flow\Types\Value\Json;
use Psr\Clock\ClockInterface;
-use UnitEnum;
/**
* Alias for data_frame() : Flow.
@@ -382,17 +345,6 @@ function batches(Extractor $extractor, int $size) : BatchExtractor
return new BatchExtractor($extractor, $size);
}
-/**
- * @param int<1, max> $chunk_size
- *
- * @deprecated use batches() instead
- */
-#[DocumentationDSL(module: Module::CORE, type: DSLType::EXTRACTOR)]
-function chunks_from(Extractor $extractor, int $chunk_size) : BatchExtractor
-{
- return new BatchExtractor($extractor, $chunk_size);
-}
-
#[DocumentationDSL(module: Module::CORE, type: DSLType::EXTRACTOR)]
function from_pipeline(Pipeline $pipeline) : PipelineExtractor
{
@@ -751,102 +703,6 @@ function structure_entry(string $name, ?array $value, StructureType $type, ?Meta
return new StructureEntry($name, $value, $type, $metadata);
}
-/**
- * @template T
- *
- * @param array<string, Type<T>> $elements
- *
- * @return StructureType<T>
- *
- * @deprecated please use \Flow\Types\DSL\type_structure(array $elements) instead
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_structure(array $elements) : StructureType
-{
- return type_structure_new($elements);
-}
-
-/**
- * @template T
- *
- * @param Type<T> $first
- * @param Type<T> $second
- * @param Type<T> ...$types
- *
- * @return Type<T>
- *
- * @deprecated please use \Flow\Types\DSL\type_union(Type $first, Type $second, Type ...$types) : UnionType
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_union(Type $first, Type $second, Type ...$types) : Type
-{
- return type_union_new($first, $second, ...$types);
-}
-
-/**
- * @template T
- *
- * @param Type<T> $type
- *
- * @return Type<?T>
- *
- * @deprecated please use \Flow\Types\DSL\type_optional(Type $type) : OptionalType
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_optional(Type $type) : Type
-{
- return type_optional_new($type);
-}
-
-/**
- * @param array<mixed> $data
- *
- * @return Type<mixed>
- *
- * @deprecated please use \Flow\Types\DSL\type_from_array(array $data) : Type
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_from_array(array $data) : Type
-{
- return type_from_array_new($data);
-}
-
-/**
- * @param \Flow\Types\Type<mixed> $type
- *
- * @deprecated please use \Flow\Types\DSL\is_nullable(Type $type) : bool
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function is_nullable(Type $type) : bool
-{
- return is_nullable_new($type);
-}
-
-/**
- * @param Type<mixed> $left
- * @param Type<mixed> $right
- *
- * @deprecated please use \Flow\Types\DSL\type_equals(Type $left, Type $right) : bool
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_equals(Type $left, Type $right) : bool
-{
- return type_equals_new($left, $right);
-}
-
-/**
- * @param Type<mixed> ...$types
- *
- * @deprecated please use \Flow\Types\DSL\types(Type ...$types) : Types
- *
- * @return Types<mixed>
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function types(Type ...$types) : Types
-{
- return types_new(...$types);
-}
-
/**
* @template T
*
@@ -861,37 +717,6 @@ function list_entry(string $name, ?array $value, ListType $type, ?Metadata $meta
return new ListEntry($name, $value, $type, $metadata);
}
-/**
- * @template T
- *
- * @param Type<T> $element
- *
- * @return ListType<T>
- *
- * @deprecated please use \Flow\Types\DSL\type_list(Type $element) : ListType
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_list(Type $element) : Type
-{
- return type_list_new($element);
-}
-
-/**
- * @template TValue
- *
- * @param IntegerType|StringType $key_type
- * @param Type<TValue> $value_type
- *
- * @return MapType<int|string, TValue>
- *
- * @deprecated please use \Flow\Types\DSL\type_map(StringType|IntegerType $key_type, Type $value_type) : MapType
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_map(StringType|IntegerType $key_type, Type $value_type) : MapType
-{
- return type_map_new($key_type, $value_type);
-}
-
/**
* @template TKey of array-key
* @template TValue
@@ -907,212 +732,6 @@ function map_entry(string $name, ?array $value, MapType $mapType, ?Metadata $met
return new MapEntry($name, $value, $mapType, $metadata);
}
-/**
- * @deprecated please use \Flow\Types\DSL\type_json() : JsonType
- *
- * @return Type<Json>
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_json() : Type
-{
- return type_json_new();
-}
-
-/**
- * @deprecated please use \Flow\Types\DSL\type_datetime() : DateTimeType
- *
- * @return Type<\DateTimeInterface>
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_datetime() : Type
-{
- return type_datetime_new();
-}
-
-/**
- * @deprecated please use \Flow\Types\DSL\type_date() : DateType
- *
- * @return Type<\DateTimeInterface>
- */
-#[DocumentationDSL(module: Module::CORE, type: DSLType::TYPE)]
-function type_date() : Type
-{
- return type_date_new();
-}
-
-/**
- * @deprecated please use \Flow\Types\DSL\type_time() : TimeType
- *
- * @return Type<\DateInterval>
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_time() : Type
-{
- return type_time_new();
-}
-
-/**
- * @deprecated please use \Flow\Types\DSL\type_xml() : XMLType
- *
- * @return Type<\DOMDocument>
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_xml() : Type
-{
- return type_xml_new();
-}
-
-/**
- * @deprecated please use \Flow\Types\DSL\type_xml_element() : XMLElementType
- *
- * @return Type<\DOMElement>
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_xml_element() : Type
-{
- return type_xml_element_new();
-}
-
-/**
- * @deprecated please use \Flow\Types\DSL\type_uuid() : UuidType
- *
- * @return Type<\Flow\Types\Value\Uuid>
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_uuid() : Type
-{
- return type_uuid_new();
-}
-
-/**
- * @deprecated please use \Flow\Types\DSL\type_integer() : IntegerType
- *
- * @return Type<int>
- */
-#[DocumentationDSL(module: Module::CORE, type: DSLType::TYPE)]
-function type_int() : Type
-{
- return type_integer_new();
-}
-
-/**
- * @deprecated please use \Flow\Types\DSL\type_integer() : IntegerType
- *
- * @return Type<int>
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_integer() : Type
-{
- return type_integer_new();
-}
-
-/**
- * @deprecated please use \Flow\Types\DSL\type_string() : StringType
- *
- * @return Type<string>
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_string() : Type
-{
- return type_string_new();
-}
-
-/**
- * @deprecated please use \Flow\Types\DSL\type_float() : FloatType
- *
- * @return Type<float>
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_float() : Type
-{
- return type_float_new();
-}
-
-/**
- * @deprecated please use \Flow\Types\DSL\type_boolean() : BooleanType
- *
- * @return Type<bool>
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_boolean() : Type
-{
- return type_boolean_new();
-}
-
-/**
- * @template T of object
- *
- * @param class-string<T> $class
- *
- * @return Type<T>
- *
- * @deprecated please use \Flow\Types\DSL\type_instance_of(string $class) : InstanceOfType
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_instance_of(string $class) : Type
-{
- return type_instance_of_new($class);
-}
-
-/**
- * @deprecated please use \Flow\Types\DSL\type_resource() : ResourceType
- *
- * @return Type<resource>
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_resource() : Type
-{
- return type_resource_new();
-}
-
-/**
- * @deprecated please use \Flow\Types\DSL\type_array() : ArrayType
- *
- * @return Type<array<mixed>>
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_array() : Type
-{
- return type_array_new();
-}
-
-/**
- * @deprecated please use \Flow\Types\DSL\type_callable() : CallableType
- *
- * @return Type<callable>
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_callable() : Type
-{
- return type_callable_new();
-}
-
-/**
- * @deprecated please use \Flow\Types\DSL\type_null() : NullType
- *
- * @return Type<null>
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_null() : Type
-{
- return type_null_new();
-}
-
-/**
- * @template T of UnitEnum
- *
- * @param class-string<T> $class
- *
- * @return Type<T>
- *
- * @deprecated please use \Flow\Types\DSL\type_enum(string $class) : EnumType
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_enum(string $class) : Type
-{
- return type_enum_new($class);
-}
-
/**
* @param Entry<mixed> ...$entry
*/
@@ -1709,7 +1328,7 @@ function array_to_rows(array $data, EntryFactory $entryFactory, array|Partitions
$rows = [];
foreach ($data as $row) {
- $row = type_array_new()->assert($row);
+ $row = type_array()->assert($row);
$rows[] = array_to_row($row, $entryFactory, $partitions, $schema);
}
@@ -1885,7 +1504,7 @@ function schema_selective_validator() : SelectiveValidator
function schema_from_json(string $schema) : Schema
{
$decodedSchema = \json_decode($schema, true, 512, JSON_THROW_ON_ERROR);
- $decodedSchema = type_array_new()->assert($decodedSchema);
+ $decodedSchema = type_array()->assert($decodedSchema);
return Schema::fromArray($decodedSchema);
}
@@ -2037,22 +1656,6 @@ function xml_element_schema(string $name, bool $nullable = false, ?Metadata $met
return new XMLElementDefinition($name, $nullable, $metadata);
}
-/**
- * @template T
- *
- * @param StructureType<T>|Type<array<string, T>> $type
- *
- * @return StructureDefinition<T>
- *
- * @deprecated Use `structure_schema()` instead
- */
-#[DocumentationDSL(module: Module::CORE, type: DSLType::SCHEMA)]
-function struct_schema(string $name, StructureType|Type $type, bool $nullable = false, ?Metadata $metadata = null) : StructureDefinition
-{
- /** @var StructureType<T> $type */
- return new StructureDefinition($name, $type, $nullable, $metadata);
-}
-
/**
* @template T
*
@@ -2242,28 +1845,6 @@ function execution_lenient() : ExecutionMode
return ExecutionMode::LENIENT;
}
-/**
- * @return Type<mixed>
- *
- * @deprecated Please use \Flow\Types\DSL\get_type($value) instead
- */
-#[DocumentationDSL(module: Module::CORE, type: DSLType::DATA_FRAME)]
-function get_type(mixed $value) : Type
-{
- return get_type_new($value);
-}
-
-/**
- * @param Schema $schema
- *
- * @deprecated Please use schema_to_ascii($schema) instead
- */
-#[DocumentationDSL(module: Module::CORE, type: DSLType::SCHEMA)]
-function print_schema(Schema $schema, ?SchemaFormatter $formatter = null) : string
-{
- return ($formatter ?? new ASCIISchemaFormatter())->format($schema);
-}
-
#[DocumentationDSL(module: Module::CORE, type: DSLType::DATA_FRAME)]
function print_rows(Rows $rows, int|bool $truncate = false, ?Formatter $formatter = null) : string
{
@@ -2385,35 +1966,6 @@ function is_type(Type|array $type, mixed $value) : bool
return false;
}
-/**
- * @template T
- *
- * @param \Flow\Types\Type<T> $type
- * @param class-string<Type<mixed>> $typeClass
- *
- * @deprecated please use \Flow\Types\DSL\type_is($type, $typeClass): bool instead
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_is(Type $type, string $typeClass) : bool
-{
- return type_is_new($type, $typeClass);
-}
-
-/**
- * @template T
- *
- * @param Type<T> $type
- * @param class-string<Type<T>> $typeClass
- * @param class-string<Type<T>> ...$typeClasses
- *
- * @deprecated please use \Flow\Types\DSL\type_is_any($type, $typeClass, ...$typeClasses): bool instead
- */
-#[DocumentationDSL(module: Module::DEPRECATED, type: DSLType::DEPRECATED)]
-function type_is_any(Type $type, string $typeClass, string ...$typeClasses) : bool
-{
- return type_is_any_new($type, $typeClass, ...$typeClasses);
-}
-
#[DocumentationDSL(module: Module::CORE, type: DSLType::DATA_FRAME)]
function generate_random_string(int $length = 32, NativePHPRandomValueGenerator $generator = new NativePHPRandomValueGenerator()) : string
{
@@ -2434,15 +1986,6 @@ function random_string(
return new RandomString($length, $generator);
}
-/**
- * @deprecated Please use \Flow\Types\DSL\dom_element_to_string() instead
- */
-#[DocumentationDSL(module: Module::CORE, type: DSLType::DATA_FRAME)]
-function dom_element_to_string(\DOMElement $element, bool $format_output = false, bool $preserver_white_space = false) : string|false
-{
- return dom_element_to_string_new($element, $format_output, $preserver_white_space);
-}
-
#[DocumentationDSL(module: Module::CORE, type: DSLType::HELPER)]
function date_interval_to_milliseconds(\DateInterval $interval) : int
{