Simplify how we load and save files in data/#1629
Merged
henriquemoody merged 1 commit intoRespect:mainfrom Jan 26, 2026
Merged
Conversation
6e3f95a to
accb6c2
Compare
alganet
reviewed
Jan 26, 2026
55bb7fa to
91ffb5d
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors data file loading and saving by introducing two new helper classes: DataLoader (replacing DomainInfo) and DataSaver. The goal is to unify and simplify how data files in the data/ directory are accessed and updated.
Changes:
- Introduced
DataLoaderclass to centralize data file loading with caching - Introduced
DataSaverclass to standardize data file saving across update commands - Removed
DomainInfoclass and migrated its functionality toDataLoader - Updated validators (
Tld,PostalCode,PublicDomainSuffix) to use the newDataLoader - Updated command classes to use
DataSaverfor file writing
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Helpers/DataLoader.php | New helper class providing unified data file loading with static caching |
| src-dev/Helpers/DataSaver.php | New helper class providing standardized data file writing with consistent formatting |
| tests/unit/Helpers/DataLoaderTest.php | Unit tests for the new DataLoader functionality |
| src/Helpers/DomainInfo.php | Removed legacy domain-specific data loader |
| src/Validators/Tld.php | Refactored to use DataLoader and Envelope pattern with Call/In validators |
| src/Validators/PublicDomainSuffix.php | Updated to use DataLoader instead of DomainInfo |
| src/Validators/PostalCode.php | Updated to use DataLoader for postal code data |
| src-dev/Commands/UpdatePostalCodesCommand.php | Refactored to use DataSaver dependency injection |
| src-dev/Commands/UpdateDomainToplevelCommand.php | Refactored to use DataSaver dependency injection |
| src-dev/Commands/UpdateDomainSuffixesCommand.php | Refactored to use DataSaver dependency injection |
| bin/console | Updated to instantiate and inject DataSaver into commands |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c75bba1 to
9affc71
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1629 +/- ##
============================================
+ Coverage 97.93% 98.01% +0.07%
+ Complexity 960 956 -4
============================================
Files 197 197
Lines 2230 2219 -11
============================================
- Hits 2184 2175 -9
+ Misses 46 44 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
We had different ways of saving and loading files from `data/`, so I decided to unify them to simplify things. I repurposed the `DomainInfo` class and named it `DataLoader`, so we can use the same class to load anything from the `data/` directory.
9affc71 to
4390e4f
Compare
alganet
approved these changes
Jan 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We had different ways of saving and loading files from
data/, so I decided to unify them to simplify things. I repurposed theDomainInfoclass and named itDataLoader, so we can use the same class to load anything from thedata/directory.