-
Notifications
You must be signed in to change notification settings - Fork 2
feat: replace platform references with proposition terminology #398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request introduces a new "Proposition" concept to replace the legacy "Platform" terminology throughout the codebase, while maintaining full backward compatibility. The change adds a new PropositionManager and Proposition facade as the preferred API, while keeping the Platform facade functional but deprecated.
Key changes:
- New Proposition API: Added PropositionManager, PropositionManagerInterface, Proposition facade, and Proposition class with constants
- Backward compatibility layer: Platform API remains functional via delegation, with deprecation notices added
- Context model updates: GlobalContext and DeliveryOptionsConfig now contain both
proposition(new) andplatform(legacy) properties with identical data - Comprehensive test coverage: New test files ensure parity between old and new APIs
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Proposition/PropositionManager.php | New manager implementing proposition-specific logic with runtime platform detection |
| src/Proposition/PropositionManagerInterface.php | Interface defining proposition operations (all, get, getPropositionName, getCarriers) |
| src/Facade/Proposition.php | New facade providing clean API for proposition operations |
| src/Account/Proposition.php | New constants class for proposition IDs and names |
| src/Platform/PlatformManager.php | Added deprecated getPropositionName() method delegating to getPlatform() |
| src/Facade/Platform.php | Added deprecation notice to docblock |
| src/Context/Model/GlobalContext.php | Added proposition property alongside platform for dual support |
| src/Context/Model/DeliveryOptionsConfig.php | Added proposition property alongside platform for dual support |
| config/pdk-services.php | Registered PropositionManagerInterface service binding |
| tests/Unit/Proposition/PropositionManagerTest.php | Comprehensive test suite with parity tests |
| tests/Unit/Context/PropositionContextTest.php | Tests for context models with dual property support |
| tests/snapshots/*.json | Updated snapshots reflecting new proposition properties |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #398 +/- ##
=========================================
Coverage 94.91% 94.91%
Complexity 2032 2032
=========================================
Files 359 359
Lines 6642 6645 +3
=========================================
+ Hits 6304 6307 +3
Misses 338 338 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
4dc4a99 to
1aea3be
Compare
20d81ab to
bb5ff42
Compare
1a8e651 to
e054aa9
Compare
995569f to
f079211
Compare
- Add Proposition class with new constants - Add @deprecated annotations to Platform class and facade - Add proposition property to GlobalContext and DeliveryOptionsConfig - Update snapshots and tests for new proposition property Co-Authored-By: Warp <[email protected]>
f079211 to
570f3af
Compare
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace MyParcelNL\Pdk\Account; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now, there's nothing under the "Account" namespace in the API for propositions, and likely won't be for some time. The Proposition service for now would be standalone, so I'd suggest putting it under a Proposition namespace?
| ]) | ||
| ); | ||
|
|
||
| $this->attributes['proposition'] = $filteredData; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest not mapping proposition to platform config here, there's no point in passing them both otherwise. (so platform is the proposition mapped to a legacy format, proposition is the new proposition config)
| 'packageType' => 'package', | ||
| 'pickupLocationsDefaultView' => $pickupLocationsDefaultView, | ||
| 'allowPickupLocationsViewSelection' => $allowPickupLocationsViewSelection, | ||
| 'proposition' => Platform::LEGACY_MYPARCEL_NAME, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proposition should use the new CONSTANT_CASE names, not the legacy ones
Summary:
• Add Proposition class with constants (new terminology alongside legacy Platform)
• Add deprecated annotations to Platform class and facade
• Add proposition property to context models alongside existing platform property for backwards compatibility
• All existing functionality remains unchanged - this is a non-breaking terminology refactor
Changes:
• NEW: src/Account/Proposition.php - New constants class
• MODIFIED: src/Account/Platform.php - Added deprecated annotation
• MODIFIED: src/Facade/Platform.php - Added deprecated annotation pointing to PropositionService
• MODIFIED: src/Context/Model/GlobalContext.php - Added proposition property (array)
• MODIFIED: src/Context/Model/DeliveryOptionsConfig.php - Added proposition property (string)
• MODIFIED: tests/Unit/App/Context/Model/DeliveryOptionsConfigTest.php - Updated assertions
• MODIFIED: 3 snapshot files - Added proposition property
• DELETED: 2 old PropositionManager snapshot files (cleanup)
Notes:
• Uses existing PropositionService for all logic (no duplication)
• Platform constants and facade remain fully functional for backwards compatibility
INT-1085