Skip to content

feat: update Rates to use readonly properties#34

Open
owenvoke wants to merge 2 commits intomainfrom
feature/readonly-deprecations
Open

feat: update Rates to use readonly properties#34
owenvoke wants to merge 2 commits intomainfrom
feature/readonly-deprecations

Conversation

@owenvoke
Copy link
Copy Markdown
Member

This updates to use readonly public properties for Rates, and improves type hinting further.

Copy link
Copy Markdown

Copilot AI left a 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 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\Rates into a final readonly DTO with public readonly properties and deprecate the old getters.
  • Mark multiple exchange rate provider classes (and ValidateCurrencyCodes) as final readonly to better express immutability.
  • Improve phpdoc types from non-empty-array<int, string> to non-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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants