Skip to content

Conversation

@villfa
Copy link

@villfa villfa commented Oct 28, 2025

Hi,

This pull request is related to #35.

Previously, I used this configuration to support the Canary Islands:

\PostalCodes::override([
            'IC' => '/^(?:(35|38)\d{3})$/',
]);

It allowed me to check codes like this:

$inCanaryIslands = \PostalCodes::passes('IC', $code);

However, it stopped working. after updating to v3.7.0+.

This PR restores that behaviour and makes the postal code pattern more restrictive, ensuring that only codes starting with 35 or 38 are considered valid (source).

Copy link
Owner

@axlon axlon left a comment

Choose a reason for hiding this comment

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

Hello, thank you for your PR. The patterns file is generated from Google's API so we shouldn't edit it directly. Instead what I think we should do is:

  1. Look for an override
  2. Look for an alias
  3. If there was an alias look for an override for that
  4. Use the original (or aliased) pattern

This would make the IC country code behave like all other country codes without having to maintain it separately

@villfa villfa force-pushed the fix/canary-islands branch 2 times, most recently from 43ea662 to 0ad269b Compare November 14, 2025 08:07
@villfa villfa force-pushed the fix/canary-islands branch from 0ad269b to 85af390 Compare November 14, 2025 08:08
@villfa
Copy link
Author

villfa commented Nov 14, 2025

Hi @axlon,
Thanks for the feedback.
I've updated the PR accordingly.

@villfa villfa requested a review from axlon November 14, 2025 08:11
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.

2 participants