Skip to content

Conversation

@jonwaldstein
Copy link
Contributor

@jonwaldstein jonwaldstein commented Jun 13, 2025

Updated to match current ISO 4217 standards as of 2024.

Major changes include:

  • Removed obsolete codes: BYR (→BYN), EEK (→EUR), GHC (→GHS), LVL (→EUR),
    LTL (→EUR), TRL (→TRY), VEF (→VES), ZWD (→ZWL)
  • Added 74+ missing current ISO 4217 codes including AED, AMD, AOA, BHD, etc.
  • Kept commonly used non-ISO codes: GGP, IMP, JEP, TVD
  • Total codes increased from 95 to 169 for better global coverage
  • Updated unit tests

@jonwaldstein jonwaldstein changed the title Refactor: update the Currency Rule to match ISO-4217 standards and override ability Refactor: update the Currency Rule to match ISO-4217 standards with added override ability Jun 13, 2025
Copy link

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 refactors the Currency validation rule to align with the ISO-4217 list as of 2024, adds the ability to inject a custom currency list via the constructor, and updates unit tests accordingly.

  • Updated the internal currency codes list (removed obsolete, added 74+ new codes, retained select non-ISO codes).
  • Introduced a constructor parameter to override default currency codes.
  • Expanded and reorganized unit tests to cover overrides, obsolete codes, new codes, and case insensitivity.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/unit/Rules/CurrencyTest.php Fixed and expanded tests: custom override, providers for obsolete/new codes, case sensitivity
src/Rules/Currency.php Added constructor override, switched validation to use instance codes, updated currencyCodes list
Comments suppressed due to low confidence (2)

src/Rules/Currency.php:82

  • The currencyCodes() method was updated in version 1.1.0, so the @since tag should be updated from 1.0.0 to 1.1.0 to reflect the latest changes.
* @since 1.0.0

tests/unit/Rules/CurrencyTest.php:1

  • The leading "git " on the opening PHP tag looks like a typo and will cause a syntax error. Please remove it so the file starts with <?php.
git <?php

Copy link
Contributor

@JasonTheAdams JasonTheAdams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update! One recommendation.

@jonwaldstein jonwaldstein force-pushed the fix/update-currency-list branch from e2abb67 to 0619820 Compare June 13, 2025 21:51
@jonwaldstein jonwaldstein changed the title Refactor: update the Currency Rule to match ISO-4217 standards with added override ability Refactor: update the Currency Rule to match ISO-4217 standards Jun 13, 2025
@JasonTheAdams
Copy link
Contributor

@jonwaldstein I merged develop into the branch to fix the tests workflow.

@JasonTheAdams JasonTheAdams merged commit 2c6346a into develop Jun 16, 2025
1 check passed
@JasonTheAdams JasonTheAdams deleted the fix/update-currency-list branch June 16, 2025 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants