summaryrefslogtreecommitdiff
path: root/src/RegistrationNumber.php
diff options
context:
space:
mode:
authorLi Zhineng <[email protected]>2025-05-26 20:31:11 +0800
committerLi Zhineng <[email protected]>2025-05-26 20:31:11 +0800
commit79ae86031262b2c20267c9081ef78840e8375fe5 (patch)
tree65d84ebdc7675e1a64f1b45ff3eaeb8063950669 /src/RegistrationNumber.php
parentb6ec153f88b593d52c20a98bd012f53fd60966ef (diff)
downloadvehicle-license-china-79ae86031262b2c20267c9081ef78840e8375fe5.tar.gz
vehicle-license-china-79ae86031262b2c20267c9081ef78840e8375fe5.zip
fix test cases
Diffstat (limited to 'src/RegistrationNumber.php')
-rw-r--r--src/RegistrationNumber.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/RegistrationNumber.php b/src/RegistrationNumber.php
index 678633d..eca7166 100644
--- a/src/RegistrationNumber.php
+++ b/src/RegistrationNumber.php
@@ -383,11 +383,18 @@ final readonly class RegistrationNumber
private static function checkSuffix(
string $region, string $authority, string $sequence, string $suffix
): bool {
+ // Ensure the HK or Macau suffix is only available to Guangdong-Z
if (in_array($suffix, self::GUANGDONG_Z_SPECIAL_SUFFIXS, strict: true)) {
return $region === self::GUANGDONG_PROVINCE
&& $authority === self::GUANGDONG_SPECIAL_AUTHORITY;
}
+ // Ensure the Guangdong-Z license plate ends with either an "HK" or a "Macau" suffix
+ if ($region === self::GUANGDONG_PROVINCE
+ && $authority === self::GUANGDONG_SPECIAL_AUTHORITY) {
+ return in_array($suffix, self::GUANGDONG_Z_SPECIAL_SUFFIXS, strict: true);
+ }
+
if ($suffix !== '' && ! in_array($suffix, self::AVAILLABLE_SUFFIXS, strict: true)) {
$len = mb_strlen($sequence);