Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR modernizes the package’s value objects and providers by adopting PHP’s readonly features and improving PHPStan type hints, while keeping backwards compatibility via deprecated accessors on Rates.
Changes:
- Convert
Worksome\Exchange\Support\Ratesinto afinal readonlyDTO with public readonly properties and deprecate the old getters. - Mark multiple exchange rate provider classes (and
ValidateCurrencyCodes) asfinal readonlyto better express immutability. - Improve phpdoc types from
non-empty-array<int, string>tonon-empty-list<string>and update command/docs to use property access.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Support/Rates.php | Makes Rates a readonly DTO with public properties and adds deprecations for legacy getters. |
| src/Support/FlatCurrencyCodeProvider.php | Adds {@inheritdoc} docblock for all(). |
| src/ExchangeServiceProvider.php | Minor instantiation syntax simplification in the binding closure. |
| src/ExchangeRateProviders/NullProvider.php | Marks provider as final readonly. |
| src/ExchangeRateProviders/FrankfurterProvider.php | Marks provider as final readonly. |
| src/ExchangeRateProviders/FixerProvider.php | Marks provider as final readonly. |
| src/ExchangeRateProviders/ExchangeRateHostProvider.php | Marks provider as final readonly. |
| src/ExchangeRateProviders/CurrencyGEOProvider.php | Marks provider as final readonly. |
| src/ExchangeRateProviders/CachedProvider.php | Marks provider as final readonly. |
| src/Exchange.php | Makes validator dependency readonly; updates doc types; minor instantiation syntax simplification. |
| src/Contracts/ExchangeRateProvider.php | Updates phpdoc to non-empty-list<string>. |
| src/Contracts/CurrencyCodeProvider.php | Updates phpdoc to non-empty-list<string>. |
| src/Contracts/Actions/ValidatesCurrencyCodes.php | Updates phpdoc param/return types to non-empty-list<string>. |
| src/Commands/ViewLatestRatesCommand.php | Tightens return shape typing and switches rendering to use Rates public properties. |
| src/Commands/InstallCommand.php | Switches description string quoting. |
| src/Commands/Concerns/HasUsefulConsoleMethods.php | Collapses the mixin docblock formatting. |
| src/Actions/ValidateCurrencyCodes.php | Marks action as final readonly. |
| README.md | Updates usage example to read Rates via properties. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This updates to use
readonlypublic properties forRates, and improves type hinting further.