Improve config merge behavior and add FieldKey constants#96
Merged
dereuromark merged 1 commit intomasterfrom Mar 23, 2026
Merged
Conversation
This commit addresses two improvements:
1. **Fix configuration merge to properly merge fields**
- When the same DTO is defined in multiple config files, fields are now
properly merged instead of overwritten
- Field attributes from later files override earlier ones while preserving
attributes not specified in later files
- Finder now sorts files alphabetically for consistent merge order,
allowing numbered prefixes (01-base.php, 02-override.php) to control order
2. **Add FieldKey constants class**
- Introduces `FieldKey` class with constants for all field metadata keys
- Reduces magic strings throughout the codebase
- Improves IDE autocompletion and static analysis
- Updates Builder, DtoValidator, and FieldCompletor to use these constants
Tests added for:
- Config merge preserving fields from multiple files
- DTO-level attribute merging
- Field attribute override behavior
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #96 +/- ##
============================================
+ Coverage 82.63% 83.08% +0.45%
- Complexity 1409 1415 +6
============================================
Files 40 41 +1
Lines 3426 3476 +50
============================================
+ Hits 2831 2888 +57
+ Misses 595 588 -7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This was referenced Mar 23, 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.
Summary
FieldKeyconstants class to reduce magic strings throughout the codebaseChanges
Config Merge Fix
When the same DTO is defined in multiple configuration files, fields are now properly merged:
This enables modular configuration where you can:
FieldKey Constants
Introduces
FieldKeyclass with constants for all field metadata keys:FieldKey::NAME,FieldKey::TYPE,FieldKey::REQUIRED, etc.FieldKey::metadataKeys()method for runtime metadata key listFieldKey::defaults()method for default field valuesUpdated
Builder,DtoValidator, andFieldCompletorto use these constants.Finder Sorting
Files in
config/dto/directory are now sorted alphabetically to ensure:Breaking Changes
None - this is a backwards-compatible enhancement.