summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhineng Li <[email protected]>2026-01-21 11:05:07 +0800
committerZhineng Li <[email protected]>2026-01-21 11:05:07 +0800
commita5de9abfebcde99547882e4dd6142ddf096606ef (patch)
tree0eed673f181f0eb4b439a26fcbd06bae5b6c86d2
parent2844a84d2de3054836818fdf5098e50ba1a33eae (diff)
downloadvehicle-license-china-a5de9abfebcde99547882e4dd6142ddf096606ef.tar.gz
vehicle-license-china-a5de9abfebcde99547882e4dd6142ddf096606ef.zip
support php 8.2
-rw-r--r--composer.json6
-rw-r--r--docker-compose.yml4
-rw-r--r--src/RegistrationNumber.php32
3 files changed, 24 insertions, 18 deletions
diff --git a/composer.json b/composer.json
index 3f25547..5097777 100644
--- a/composer.json
+++ b/composer.json
@@ -20,14 +20,16 @@
}
],
"require": {
- "php": "^8.3"
+ "php": "^8.2"
},
"require-dev": {
- "phpunit/phpunit": "^12"
+ "phpunit/phpunit": "^11.4|^12.0"
},
"scripts": {
"test": "phpunit",
"matrix": [
+ "COMPOSER_FLAGS=--prefer-lowest docker compose run --rm php82",
+ "COMPOSER_FLAGS=--prefer-stable docker compose run --rm php82",
"COMPOSER_FLAGS=--prefer-lowest docker compose run --rm php83",
"COMPOSER_FLAGS=--prefer-stable docker compose run --rm php83",
"COMPOSER_FLAGS=--prefer-lowest docker compose run --rm php84",
diff --git a/docker-compose.yml b/docker-compose.yml
index 7a38dc4..8bbdb51 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -8,6 +8,10 @@ x-test: &test
command: sh scripts/test.sh
services:
+ php82:
+ <<: *test
+ image: php:8.2-cli-alpine
+
php83:
<<: *test
image: php:8.3-cli-alpine
diff --git a/src/RegistrationNumber.php b/src/RegistrationNumber.php
index 1b5e936..e560872 100644
--- a/src/RegistrationNumber.php
+++ b/src/RegistrationNumber.php
@@ -11,7 +11,7 @@ final readonly class RegistrationNumber
*
* @var string[][]
*/
- private const array AUTHORITIES = [
+ private const AUTHORITIES = [
'京' => [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
@@ -129,7 +129,7 @@ final readonly class RegistrationNumber
/**
* @var string[]
*/
- private const array CLEAN_ENERGY_FIRST_LETTERS = [
+ private const CLEAN_ENERGY_FIRST_LETTERS = [
'D', 'A', 'B', 'C', 'E',
'F', 'G', 'H', 'J', 'K',
];
@@ -137,14 +137,14 @@ final readonly class RegistrationNumber
/**
* @var string[]
*/
- private const array BATTERY_ELECTRIC_LETTERS = [
+ private const BATTERY_ELECTRIC_LETTERS = [
'D', 'A', 'B', 'C', 'E',
];
/**
* @var string[]
*/
- private const array AVAILLABLE_SUFFIXS = [
+ private const AVAILLABLE_SUFFIXS = [
self::EMBASSY_SUFFIX,
self::CONSULATE_SUFFIX,
self::POLICE_SUFFIX,
@@ -159,32 +159,32 @@ final readonly class RegistrationNumber
/**
* @var string[]
*/
- private const array GUANGDONG_Z_SPECIAL_SUFFIXS = [
+ private const GUANGDONG_Z_SPECIAL_SUFFIXS = [
self::HONG_KONG_SUFFIX,
self::MACAU_SUFFIX,
];
- private const string GUANGDONG_PROVINCE = '粤';
+ private const GUANGDONG_PROVINCE = '粤';
- private const string GUANGDONG_SPECIAL_AUTHORITY = 'Z';
+ private const GUANGDONG_SPECIAL_AUTHORITY = 'Z';
- private const string EMBASSY_SUFFIX = '使';
+ private const EMBASSY_SUFFIX = '使';
- private const string CONSULATE_SUFFIX = '领';
+ private const CONSULATE_SUFFIX = '领';
- private const string POLICE_SUFFIX = '警';
+ private const POLICE_SUFFIX = '警';
- private const string COACH_SUFFIX = '学';
+ private const COACH_SUFFIX = '学';
- private const string TRAILER_SUFFIX = '挂';
+ private const TRAILER_SUFFIX = '挂';
- private const string HONG_KONG_SUFFIX = '港';
+ private const HONG_KONG_SUFFIX = '港';
- private const string MACAU_SUFFIX = '澳';
+ private const MACAU_SUFFIX = '澳';
- private const string TEST_SUFFIX = '试';
+ private const TEST_SUFFIX = '试';
- private const string SPECIAL_SUFFIX = '超';
+ private const SPECIAL_SUFFIX = '超';
public string $region;