Skip to content

Commit d53a84a

Browse files
committed
chore: cleanup deprecated code from data frame
1 parent 7c05376 commit d53a84a

53 files changed

Lines changed: 700 additions & 517 deletions

Some content is hidden

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

diff.txt

Lines changed: 579 additions & 0 deletions
Large diffs are not rendered by default.

documentation/upgrading.md

Lines changed: 110 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,114 @@ Please follow the instructions for your specific version to ensure a smooth upgr
1313

1414
The Meilisearch adapter has been removed from Flow PHP. If you were using it, please migrate to Elasticsearch adapter.
1515

16+
### 2) Removed deprecated DSL functions
17+
18+
All type-related DSL functions have been moved from `Flow\ETL\DSL` to `Flow\Types\DSL`. Update your imports accordingly.
19+
20+
| Removed Function | Replacement |
21+
|---------------------------|-------------------------------------------|
22+
| `chunks_from()` | `batches()` |
23+
| `type_structure()` | `\Flow\Types\DSL\type_structure()` |
24+
| `type_union()` | `\Flow\Types\DSL\type_union()` |
25+
| `type_optional()` | `\Flow\Types\DSL\type_optional()` |
26+
| `type_from_array()` | `\Flow\Types\DSL\type_from_array()` |
27+
| `is_nullable()` | `\Flow\Types\DSL\type_is_nullable()` |
28+
| `type_equals()` | `\Flow\Types\DSL\type_equals()` |
29+
| `types()` | `\Flow\Types\DSL\types()` |
30+
| `type_list()` | `\Flow\Types\DSL\type_list()` |
31+
| `type_map()` | `\Flow\Types\DSL\type_map()` |
32+
| `type_json()` | `\Flow\Types\DSL\type_json()` |
33+
| `type_datetime()` | `\Flow\Types\DSL\type_datetime()` |
34+
| `type_date()` | `\Flow\Types\DSL\type_date()` |
35+
| `type_time()` | `\Flow\Types\DSL\type_time()` |
36+
| `type_xml()` | `\Flow\Types\DSL\type_xml()` |
37+
| `type_xml_element()` | `\Flow\Types\DSL\type_xml_element()` |
38+
| `type_uuid()` | `\Flow\Types\DSL\type_uuid()` |
39+
| `type_int()` | `\Flow\Types\DSL\type_integer()` |
40+
| `type_integer()` | `\Flow\Types\DSL\type_integer()` |
41+
| `type_string()` | `\Flow\Types\DSL\type_string()` |
42+
| `type_float()` | `\Flow\Types\DSL\type_float()` |
43+
| `type_boolean()` | `\Flow\Types\DSL\type_boolean()` |
44+
| `type_instance_of()` | `\Flow\Types\DSL\type_instance_of()` |
45+
| `type_resource()` | `\Flow\Types\DSL\type_resource()` |
46+
| `type_array()` | `\Flow\Types\DSL\type_array()` |
47+
| `type_callable()` | `\Flow\Types\DSL\type_callable()` |
48+
| `type_null()` | `\Flow\Types\DSL\type_null()` |
49+
| `type_enum()` | `\Flow\Types\DSL\type_enum()` |
50+
| `struct_schema()` | `structure_schema()` |
51+
| `get_type()` | `\Flow\Types\DSL\get_type()` |
52+
| `print_schema()` | `schema_to_ascii()` |
53+
| `type_is()` | `\Flow\Types\DSL\type_is()` |
54+
| `type_is_any()` | `\Flow\Types\DSL\type_is_any()` |
55+
| `dom_element_to_string()` | `\Flow\Types\DSL\dom_element_to_string()` |
56+
57+
### 3) Removed deprecated DataFrame methods
58+
59+
| Removed Method | Replacement |
60+
|----------------------------------------|--------------------------------------------------------------|
61+
| `DataFrame::validate()` | `DataFrame::match()` |
62+
| `DataFrame::renameAll()` | `DataFrame::renameEach(rename_replace(...))` |
63+
| `DataFrame::renameAllLowerCase()` | `DataFrame::renameEach(rename_style(StringStyles::LOWER))` |
64+
| `DataFrame::renameAllUpperCase()` | `DataFrame::renameEach(rename_style(StringStyles::UPPER))` |
65+
| `DataFrame::renameAllUpperCaseFirst()` | `DataFrame::renameEach(rename_style(StringStyles::UCFIRST))` |
66+
| `DataFrame::renameAllUpperCaseWord()` | `DataFrame::renameEach(rename_style(StringStyles::UCWORDS))` |
67+
| `DataFrame::renameAllStyle()` | `DataFrame::renameEach(rename_style(...))` |
68+
69+
### 4) Removed deprecated Schema methods
70+
71+
| Removed Method | Replacement |
72+
|---------------------------|-------------------------------|
73+
| `Schema::entries()` | `Schema::references()->all()` |
74+
| `Schema::getDefinition()` | `Schema::get()` |
75+
| `Schema::nullable()` | `Schema::makeNullable()` |
76+
77+
### 5) Removed deprecated Definition methods
78+
79+
| Removed Method | Replacement |
80+
|--------------------------|------------------------------|
81+
| `Definition::nullable()` | `Definition::makeNullable()` |
82+
83+
This applies to all Definition implementations: `BooleanDefinition`, `DateDefinition`, `DateTimeDefinition`,
84+
`EnumDefinition`, `FloatDefinition`, `HTMLDefinition`, `HTMLElementDefinition`, `IntegerDefinition`, `JsonDefinition`,
85+
`ListDefinition`, `MapDefinition`, `StringDefinition`, `StructureDefinition`, `TimeDefinition`, `UuidDefinition`,
86+
`XMLDefinition`, `XMLElementDefinition`.
87+
88+
### 6) Removed deprecated FileExtractor and PathFiltering methods
89+
90+
| Removed Method | Replacement |
91+
|------------------------------|-----------------------------------|
92+
| `FileExtractor::addFilter()` | `FileExtractor::withPathFilter()` |
93+
| `PathFiltering::addFilter()` | `PathFiltering::withPathFilter()` |
94+
95+
### 7) Removed deprecated ScalarFunctionChain methods
96+
97+
| Removed Method | Replacement |
98+
|----------------------------------------------|---------------------------------------------------|
99+
| `ScalarFunctionChain::domElementAttribute()` | `ScalarFunctionChain::domElementAttributeValue()` |
100+
101+
### 8) Removed deprecated Config constants
102+
103+
| Removed Constant | Replacement |
104+
|-------------------------------|-----------------------------------|
105+
| `Config::CACHE_DIR_ENV` | `CacheConfig::CACHE_DIR_ENV` |
106+
| `Config::SORT_MAX_MEMORY_ENV` | `SortConfig::SORT_MAX_MEMORY_ENV` |
107+
108+
### 9) Removed deprecated Transformers
109+
110+
| Removed Transformer | Replacement |
111+
|-----------------------------------------|--------------------------------------------------|
112+
| `EntryNameStyleConverterTransformer` | Use `DataFrame::renameEach(rename_style(...))` |
113+
| `RenameAllCaseTransformer` | Use `DataFrame::renameEach(rename_style(...))` |
114+
| `RenameStrReplaceAllEntriesTransformer` | Use `DataFrame::renameEach(rename_replace(...))` |
115+
116+
### 10) Removed deprecated classes
117+
118+
| Removed Class | Replacement |
119+
|-------------------------------------------------|--------------------------------|
120+
| `Flow\ETL\Function\StyleConverter\StringStyles` | `Flow\ETL\String\StringStyles` |
121+
122+
---
123+
16124
## Upgrading from 0.28.x to 0.29.x
17125

18126
### 1) JsonType now uses Json value object instead of string
@@ -48,7 +156,7 @@ $jsonString = $json->toString(); // get the string
48156
$jsonArray = $json->toArray(); // get as array
49157
```
50158

51-
If you were using `JsonEntry::value()` and edxpected an array:
159+
If you were using `JsonEntry::value()` and expected an array:
52160

53161
Before:
54162

@@ -224,6 +332,7 @@ This means all classes related to Schema now live under `Flow\ETL\Schema` namesp
224332
The old method is now deprecated and will be removed in the next release.
225333

226334
### 2) Replaced `Flow\ETL\Function\ScalarFunction\TypedScalarFunction` with
335+
227336
`Flow\ETL\Function\ScalarFunction\ScalarResult`.
228337

229338
The old interface was used to allow defining the return type of the ScalarFunctions.

src/bridge/symfony/http-foundation/tests/Flow/Bridge/Symfony/HttpFoundation/Tests/Integration/FlowStreamedResponseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function test_stream_closure_receives_report_with_schema_when_enabled() :
7878
self::assertNotNull($receivedReport);
7979
self::assertSame(2, $receivedReport->statistics()->totalRows());
8080
self::assertNotNull($receivedReport->schema());
81-
self::assertCount(2, $receivedReport->schema()->entries());
81+
self::assertCount(2, $receivedReport->schema()->references()->all());
8282
}
8383

8484
public function test_streaming_array_response_to_csv() : void

src/core/etl/src/Flow/ETL/Config.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,6 @@
2121
*/
2222
final readonly class Config
2323
{
24-
/**
25-
* @deprecated Use CacheConfig::CACHE_DIR_ENV instead
26-
*/
27-
public const string CACHE_DIR_ENV = 'FLOW_LOCAL_FILESYSTEM_CACHE_DIR';
28-
29-
/**
30-
* @deprecated Use SortConfig::SORT_MAX_MEMORY_ENV instead
31-
*/
32-
public const string SORT_MAX_MEMORY_ENV = 'FLOW_SORT_MAX_MEMORY';
33-
3424
public function __construct(
3525
private string $id,
3626
private string $name,

src/core/etl/src/Flow/ETL/DataFrame.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -860,20 +860,6 @@ public function until(ScalarFunction $function) : self
860860
return $this;
861861
}
862862

863-
/**
864-
* @deprecated Please use DataFrame::match instead
865-
*
866-
* @lazy
867-
*
868-
* @param null|SchemaValidator $validator - when null, StrictValidator gets initialized
869-
*/
870-
public function validate(Schema $schema, ?SchemaValidator $validator = null) : self
871-
{
872-
$this->match($schema, $validator);
873-
874-
return $this;
875-
}
876-
877863
/**
878864
* @lazy
879865
* This method is useful mostly in development when

src/core/etl/src/Flow/ETL/Extractor/FileExtractor.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@
99

1010
interface FileExtractor
1111
{
12-
/**
13-
* @deprecated Use withPathFilter instead
14-
*/
15-
public function addFilter(Filter $filter) : self;
16-
1712
public function filter() : Filter;
1813

1914
public function source() : Path;

src/core/etl/src/Flow/ETL/Extractor/PathFiltering.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@ trait PathFiltering
1111
{
1212
private ?Filter $filter = null;
1313

14-
/**
15-
* @deprecated Use withPathFilter instead
16-
*/
17-
public function addFilter(Filter $filter) : self
18-
{
19-
return $this->withPathFilter($filter);
20-
}
21-
2214
public function filter() : Filter
2315
{
2416
return $this->filter ?? new OnlyFiles();

src/core/etl/src/Flow/ETL/Function/ScalarFunctionChain.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,6 @@ public function divide(ScalarFunction|int|float|string $value, ScalarFunction|in
222222
return new Divide($this, $value, $scale, $rounding);
223223
}
224224

225-
/**
226-
* @deprecated Use domElementAttributeValue instead
227-
*/
228-
public function domElementAttribute(ScalarFunction|string $attribute) : DOMElementAttributeValue
229-
{
230-
return new DOMElementAttributeValue($this, $attribute);
231-
}
232-
233225
public function domElementAttributesCount() : DOMElementAttributesCount
234226
{
235227
return new DOMElementAttributesCount($this);

src/core/etl/src/Flow/ETL/Schema.php

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,6 @@ public function definitions() : array
135135
return $this->definitions;
136136
}
137137

138-
/**
139-
* @deprecated use references() : References instead
140-
*
141-
* @return array<Reference>
142-
*/
143-
public function entries() : array
144-
{
145-
return $this->references()->all();
146-
}
147-
148138
/**
149139
* @return null|Definition<mixed>
150140
*/
@@ -175,18 +165,6 @@ public function get(string|Reference $ref) : Definition
175165
return $this->findDefinition($ref) ?: throw new SchemaDefinitionNotFoundException((string) $ref);
176166
}
177167

178-
/**
179-
* @deprecated please use Schema::get() instead
180-
*
181-
* @throw SchemaDefinitionNotFoundException
182-
*
183-
* @return Definition<mixed>
184-
*/
185-
public function getDefinition(string|Reference $ref) : Definition
186-
{
187-
return $this->get($ref);
188-
}
189-
190168
/**
191169
* Gracefully remove entries from schema without throwing an exception if entry does not exist.
192170
*/
@@ -321,16 +299,6 @@ public function normalize() : array
321299
return $definitions;
322300
}
323301

324-
/**
325-
* @deprecated use makeNullable instead
326-
*
327-
* @return Schema
328-
*/
329-
public function nullable() : self
330-
{
331-
return $this->makeNullable();
332-
}
333-
334302
public function references() : References
335303
{
336304
$refs = [];

src/core/etl/src/Flow/ETL/Schema/Definition.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,6 @@ public function metadata() : Metadata;
6161
*/
6262
public function normalize() : array;
6363

64-
/**
65-
* @deprecated Use makeNullable() instead
66-
*
67-
* @return static
68-
*/
69-
public function nullable() : static;
70-
7164
/**
7265
* @return static
7366
*/

0 commit comments

Comments
 (0)