Merge pull request #11 from sinabe/feature-qriban-ref

Feature qriban ref
This commit is contained in:
benvia 2023-03-16 10:18:36 +01:00 committed by GitHub
commit c7a1ab0a72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 2354 additions and 2197 deletions

View File

@ -1,6 +1,7 @@
# Swiss QR Invoice for Dolibarr # Swiss QR Invoice for Dolibarr
This repository is a set of files to add Swiss QR invoice to Dolibarr ERP/CRM. This repository is a set of files to add Swiss QR invoice to Dolibarr ERP/CRM.
The model supports QR-IBAN or classic IBAN.
## Requirement ## Requirement
@ -9,7 +10,8 @@ This set of files is actually tested on Dolibarr 16.0.1 with PHP 7.4.29
## Installation ## Installation
1. Copy each files with the same name in the same directory of the Dolibarr installation. 1. Copy each files with the same name in the same directory of the Dolibarr installation.
2. Activated invoice templates in the Setup -> Modules/Apllications -> Invoices 2. Activated invoice templates in the Setup -> Modules/Apllications -> Invoices.
3. In case of QR-IBAN add the variable SI_SWISSQR_REF in Configuration->Other Setup. You receive this number from your bank (BESR-ID).
## Baed on ## Baed on
@ -18,7 +20,8 @@ This set of files is actually tested on Dolibarr 16.0.1 with PHP 7.4.29
# QR facture suisse pour Dolibarr # QR facture suisse pour Dolibarr
Ce dépôt est un ensemble de fichiers pour ajouter la facture QR suisse à l'ERP/CRM Dolibarr Ce dépôt est un ensemble de fichiers pour ajouter la facture QR suisse à l'ERP/CRM Dolibarr.
Le modèle supporte le QR-IBAN ou l'IBAN classic.
## Prérequis ## Prérequis
@ -27,11 +30,13 @@ Ces fichiers sont actuellement testés avec Dolibarr 16.0.1 et PHP 7.4.29
## Installation ## Installation
1. Copier l'ensemble des fichiers dans les mêmes répertoires de votre installation Dolibarr. 1. Copier l'ensemble des fichiers dans les mêmes répertoires de votre installation Dolibarr.
2. Activer le modèle de facture dans Configuration->Modules/Applications -> Factures 2. Activer le modèle de facture dans Configuration->Modules/Applications -> Factures.
3. Dans le cas du QR-IBAN ajouter la variable SI_SWISSQR_REF dans Configuration->Divers. Vous recevez ce numéro de votre banque (BESR-ID).
# Swiss QR Invoice für Dolibarr # Swiss QR Invoice für Dolibarr
Dieses Repository enthält eine Reihe von Dateien, um die Schweizer QR-Rechnung zu Dolibarr ERP/CRM hinzuzufügen. Dieses Repository enthält eine Reihe von Dateien, um die Schweizer QR-Rechnung zu Dolibarr ERP/CRM hinzuzufügen.
Die Vorlage unterstützt QR-IBAN oder IBAN classic.
## Anforderung ## Anforderung
@ -40,17 +45,20 @@ Dieser Satz von Dateien ist auf Dolibarr 16.0.1 mit PHP 7.4.29 getestet.
## Installation ## Installation
1. Kopieren Sie alle Dateien mit dem gleichen Namen in das gleiche Verzeichnis der Dolibarr-Installation. 1. Kopieren Sie alle Dateien mit dem gleichen Namen in das gleiche Verzeichnis der Dolibarr-Installation.
2. Aktivieren Sie die Rechnungsvorlagen im Setup -> Module/Applikationen -> Rechnungen 2. Aktivieren Sie die Rechnungsvorlagen im Setup -> Module/Applikationen -> Rechnungen.
3. Im Fall von QR-IBAN fügen Sie die Variable SI_SWISSQR_REF in Konfiguration->Diverses hinzu. Sie erhalten diese Nummer von Ihrer Bank (BESR-ID).
# Fattura QR svizzera per Dolibarr # Fattura QR svizzera per Dolibarr
Questo repository è un insieme di file per aggiungere la fattura Swiss QR all'ERP/CRM Dolibarr. Questo repository è un insieme di file per aggiungere la fattura Swiss QR all'ERP/CRM Dolibarr.
Il modello supporta QR-IBAN o IBAN classico.
## Requisiti ## Requisiti
Questo set di file è stato testato su Dolibarr 16.0.1 con PHP 7.4.29. Questo set di file è stato testato su Dolibarr 16.0.1 con PHP 7.4.29
## Installazione ## Installazione
1. Copiare i file con lo stesso nome nella stessa directory dell'installazione di Dolibarr. 1. Copiare i file con lo stesso nome nella stessa directory dell'installazione di Dolibarr.
2. Attivare i modelli di fattura in Impostazione -> Moduli/Allegati -> Fatture. 2. Attivare i modelli di fattura in Impostazione -> Moduli/Allegati -> Fatture.
3. In caso di QR-IBAN, aggiungere la variabile SI_SWISSQR_REF in Configurazione->Varie. Questo numero viene fornito dalla banca (BESR-ID).

File diff suppressed because it is too large Load Diff

View File

@ -59,24 +59,27 @@
}, },
{ {
"name": "dasprid/enum", "name": "dasprid/enum",
"version": "1.0.3", "version": "1.0.4",
"version_normalized": "1.0.3.0", "version_normalized": "1.0.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/DASPRiD/Enum.git", "url": "https://github.com/DASPRiD/Enum.git",
"reference": "5abf82f213618696dda8e3bf6f64dd042d8542b2" "reference": "8e6b6ea76eabbf19ea2bf5b67b98e1860474012f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/DASPRiD/Enum/zipball/5abf82f213618696dda8e3bf6f64dd042d8542b2", "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/8e6b6ea76eabbf19ea2bf5b67b98e1860474012f",
"reference": "5abf82f213618696dda8e3bf6f64dd042d8542b2", "reference": "8e6b6ea76eabbf19ea2bf5b67b98e1860474012f",
"shasum": "" "shasum": ""
}, },
"require": {
"php": ">=7.1 <9.0"
},
"require-dev": { "require-dev": {
"phpunit/phpunit": "^7 | ^8 | ^9", "phpunit/phpunit": "^7 | ^8 | ^9",
"squizlabs/php_codesniffer": "^3.4" "squizlabs/php_codesniffer": "*"
}, },
"time": "2020-10-02T16:03:48+00:00", "time": "2023-03-01T18:44:03+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -103,7 +106,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/DASPRiD/Enum/issues", "issues": "https://github.com/DASPRiD/Enum/issues",
"source": "https://github.com/DASPRiD/Enum/tree/1.0.3" "source": "https://github.com/DASPRiD/Enum/tree/1.0.4"
}, },
"install-path": "../dasprid/enum" "install-path": "../dasprid/enum"
}, },
@ -500,17 +503,17 @@
}, },
{ {
"name": "symfony/intl", "name": "symfony/intl",
"version": "v5.4.15", "version": "v5.4.21",
"version_normalized": "5.4.15.0", "version_normalized": "5.4.21.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/intl.git", "url": "https://github.com/symfony/intl.git",
"reference": "2cb39da7f6e7b7344d7d5317dbee8db9d12cc714" "reference": "32c2d958b88f5c7f0b080774d7d15d4c87769bc8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/intl/zipball/2cb39da7f6e7b7344d7d5317dbee8db9d12cc714", "url": "https://api.github.com/repos/symfony/intl/zipball/32c2d958b88f5c7f0b080774d7d15d4c87769bc8",
"reference": "2cb39da7f6e7b7344d7d5317dbee8db9d12cc714", "reference": "32c2d958b88f5c7f0b080774d7d15d4c87769bc8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -521,7 +524,7 @@
"require-dev": { "require-dev": {
"symfony/filesystem": "^4.4|^5.0|^6.0" "symfony/filesystem": "^4.4|^5.0|^6.0"
}, },
"time": "2022-10-19T14:28:49+00:00", "time": "2023-02-17T21:35:35+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -571,7 +574,7 @@
"localization" "localization"
], ],
"support": { "support": {
"source": "https://github.com/symfony/intl/tree/v5.4.15" "source": "https://github.com/symfony/intl/tree/v5.4.21"
}, },
"funding": [ "funding": [
{ {
@ -591,17 +594,17 @@
}, },
{ {
"name": "symfony/options-resolver", "name": "symfony/options-resolver",
"version": "v5.4.11", "version": "v5.4.21",
"version_normalized": "5.4.11.0", "version_normalized": "5.4.21.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/options-resolver.git", "url": "https://github.com/symfony/options-resolver.git",
"reference": "54f14e36aa73cb8f7261d7686691fd4d75ea2690" "reference": "4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/54f14e36aa73cb8f7261d7686691fd4d75ea2690", "url": "https://api.github.com/repos/symfony/options-resolver/zipball/4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9",
"reference": "54f14e36aa73cb8f7261d7686691fd4d75ea2690", "reference": "4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -610,7 +613,7 @@
"symfony/polyfill-php73": "~1.0", "symfony/polyfill-php73": "~1.0",
"symfony/polyfill-php80": "^1.16" "symfony/polyfill-php80": "^1.16"
}, },
"time": "2022-07-20T13:00:38+00:00", "time": "2023-02-14T08:03:56+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -643,7 +646,7 @@
"options" "options"
], ],
"support": { "support": {
"source": "https://github.com/symfony/options-resolver/tree/v5.4.11" "source": "https://github.com/symfony/options-resolver/tree/v5.4.21"
}, },
"funding": [ "funding": [
{ {
@ -1345,17 +1348,17 @@
}, },
{ {
"name": "symfony/property-access", "name": "symfony/property-access",
"version": "v5.4.15", "version": "v5.4.21",
"version_normalized": "5.4.15.0", "version_normalized": "5.4.21.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/property-access.git", "url": "https://github.com/symfony/property-access.git",
"reference": "0f3e8f40a1d3da90f674b3dd772e4777ccde4273" "reference": "bbd4442bfbdf3992550772539ba743d6d834534f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/property-access/zipball/0f3e8f40a1d3da90f674b3dd772e4777ccde4273", "url": "https://api.github.com/repos/symfony/property-access/zipball/bbd4442bfbdf3992550772539ba743d6d834534f",
"reference": "0f3e8f40a1d3da90f674b3dd772e4777ccde4273", "reference": "bbd4442bfbdf3992550772539ba743d6d834534f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1370,7 +1373,7 @@
"suggest": { "suggest": {
"psr/cache-implementation": "To cache access methods." "psr/cache-implementation": "To cache access methods."
}, },
"time": "2022-10-27T07:55:40+00:00", "time": "2023-02-16T09:33:00+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -1409,7 +1412,7 @@
"reflection" "reflection"
], ],
"support": { "support": {
"source": "https://github.com/symfony/property-access/tree/v5.4.15" "source": "https://github.com/symfony/property-access/tree/v5.4.21"
}, },
"funding": [ "funding": [
{ {
@ -1429,17 +1432,17 @@
}, },
{ {
"name": "symfony/property-info", "name": "symfony/property-info",
"version": "v5.4.17", "version": "v5.4.21",
"version_normalized": "5.4.17.0", "version_normalized": "5.4.21.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/property-info.git", "url": "https://github.com/symfony/property-info.git",
"reference": "12e1f7b3d73b1f3690aa524b92b5de9937507361" "reference": "722737086d76b4edabfc2d50a48cebd4b8cd5546"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/property-info/zipball/12e1f7b3d73b1f3690aa524b92b5de9937507361", "url": "https://api.github.com/repos/symfony/property-info/zipball/722737086d76b4edabfc2d50a48cebd4b8cd5546",
"reference": "12e1f7b3d73b1f3690aa524b92b5de9937507361", "reference": "722737086d76b4edabfc2d50a48cebd4b8cd5546",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1467,7 +1470,7 @@
"symfony/doctrine-bridge": "To use Doctrine metadata", "symfony/doctrine-bridge": "To use Doctrine metadata",
"symfony/serializer": "To use Serializer metadata" "symfony/serializer": "To use Serializer metadata"
}, },
"time": "2022-12-20T11:10:57+00:00", "time": "2023-02-16T09:33:00+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -1503,7 +1506,7 @@
"validator" "validator"
], ],
"support": { "support": {
"source": "https://github.com/symfony/property-info/tree/v5.4.17" "source": "https://github.com/symfony/property-info/tree/v5.4.21"
}, },
"funding": [ "funding": [
{ {
@ -1523,17 +1526,17 @@
}, },
{ {
"name": "symfony/string", "name": "symfony/string",
"version": "v5.4.17", "version": "v5.4.21",
"version_normalized": "5.4.17.0", "version_normalized": "5.4.21.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/string.git", "url": "https://github.com/symfony/string.git",
"reference": "55733a8664b8853b003e70251c58bc8cb2d82a6b" "reference": "edac10d167b78b1d90f46a80320d632de0bd9f2f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/55733a8664b8853b003e70251c58bc8cb2d82a6b", "url": "https://api.github.com/repos/symfony/string/zipball/edac10d167b78b1d90f46a80320d632de0bd9f2f",
"reference": "55733a8664b8853b003e70251c58bc8cb2d82a6b", "reference": "edac10d167b78b1d90f46a80320d632de0bd9f2f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1553,7 +1556,7 @@
"symfony/translation-contracts": "^1.1|^2", "symfony/translation-contracts": "^1.1|^2",
"symfony/var-exporter": "^4.4|^5.0|^6.0" "symfony/var-exporter": "^4.4|^5.0|^6.0"
}, },
"time": "2022-12-12T15:54:21+00:00", "time": "2023-02-22T08:00:55+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -1592,7 +1595,7 @@
"utf8" "utf8"
], ],
"support": { "support": {
"source": "https://github.com/symfony/string/tree/v5.4.17" "source": "https://github.com/symfony/string/tree/v5.4.21"
}, },
"funding": [ "funding": [
{ {
@ -1693,17 +1696,17 @@
}, },
{ {
"name": "symfony/validator", "name": "symfony/validator",
"version": "v5.4.17", "version": "v5.4.21",
"version_normalized": "5.4.17.0", "version_normalized": "5.4.21.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/validator.git", "url": "https://github.com/symfony/validator.git",
"reference": "621b820204a238d754f7f60241fcbdb1687641ea" "reference": "0ba987d705962a4f6571d31a8e1aed18ad2c9f55"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/validator/zipball/621b820204a238d754f7f60241fcbdb1687641ea", "url": "https://api.github.com/repos/symfony/validator/zipball/0ba987d705962a4f6571d31a8e1aed18ad2c9f55",
"reference": "621b820204a238d754f7f60241fcbdb1687641ea", "reference": "0ba987d705962a4f6571d31a8e1aed18ad2c9f55",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1732,7 +1735,7 @@
"require-dev": { "require-dev": {
"doctrine/annotations": "^1.13|^2", "doctrine/annotations": "^1.13|^2",
"doctrine/cache": "^1.11|^2.0", "doctrine/cache": "^1.11|^2.0",
"egulias/email-validator": "^2.1.10|^3", "egulias/email-validator": "^2.1.10|^3|^4",
"symfony/cache": "^4.4|^5.0|^6.0", "symfony/cache": "^4.4|^5.0|^6.0",
"symfony/config": "^4.4|^5.0|^6.0", "symfony/config": "^4.4|^5.0|^6.0",
"symfony/console": "^4.4|^5.0|^6.0", "symfony/console": "^4.4|^5.0|^6.0",
@ -1761,7 +1764,7 @@
"symfony/translation": "For translating validation errors.", "symfony/translation": "For translating validation errors.",
"symfony/yaml": "" "symfony/yaml": ""
}, },
"time": "2022-12-21T19:20:17+00:00", "time": "2023-02-22T19:16:45+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -1789,7 +1792,7 @@
"description": "Provides tools to validate values", "description": "Provides tools to validate values",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/validator/tree/v5.4.17" "source": "https://github.com/symfony/validator/tree/v5.4.21"
}, },
"funding": [ "funding": [
{ {

View File

@ -3,7 +3,7 @@
'name' => '__root__', 'name' => '__root__',
'pretty_version' => 'dev-master', 'pretty_version' => 'dev-master',
'version' => 'dev-master', 'version' => 'dev-master',
'reference' => '4f030b05af2d8e0e4875c40d35686b88e7924979', 'reference' => '0b5bf953d7af542abca30ebb41f2db12add3f214',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
@ -13,7 +13,7 @@
'__root__' => array( '__root__' => array(
'pretty_version' => 'dev-master', 'pretty_version' => 'dev-master',
'version' => 'dev-master', 'version' => 'dev-master',
'reference' => '4f030b05af2d8e0e4875c40d35686b88e7924979', 'reference' => '0b5bf953d7af542abca30ebb41f2db12add3f214',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
@ -29,9 +29,9 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'dasprid/enum' => array( 'dasprid/enum' => array(
'pretty_version' => '1.0.3', 'pretty_version' => '1.0.4',
'version' => '1.0.3.0', 'version' => '1.0.4.0',
'reference' => '5abf82f213618696dda8e3bf6f64dd042d8542b2', 'reference' => '8e6b6ea76eabbf19ea2bf5b67b98e1860474012f',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../dasprid/enum', 'install_path' => __DIR__ . '/../dasprid/enum',
'aliases' => array(), 'aliases' => array(),
@ -92,18 +92,18 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/intl' => array( 'symfony/intl' => array(
'pretty_version' => 'v5.4.15', 'pretty_version' => 'v5.4.21',
'version' => '5.4.15.0', 'version' => '5.4.21.0',
'reference' => '2cb39da7f6e7b7344d7d5317dbee8db9d12cc714', 'reference' => '32c2d958b88f5c7f0b080774d7d15d4c87769bc8',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/intl', 'install_path' => __DIR__ . '/../symfony/intl',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/options-resolver' => array( 'symfony/options-resolver' => array(
'pretty_version' => 'v5.4.11', 'pretty_version' => 'v5.4.21',
'version' => '5.4.11.0', 'version' => '5.4.21.0',
'reference' => '54f14e36aa73cb8f7261d7686691fd4d75ea2690', 'reference' => '4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/options-resolver', 'install_path' => __DIR__ . '/../symfony/options-resolver',
'aliases' => array(), 'aliases' => array(),
@ -182,27 +182,27 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/property-access' => array( 'symfony/property-access' => array(
'pretty_version' => 'v5.4.15', 'pretty_version' => 'v5.4.21',
'version' => '5.4.15.0', 'version' => '5.4.21.0',
'reference' => '0f3e8f40a1d3da90f674b3dd772e4777ccde4273', 'reference' => 'bbd4442bfbdf3992550772539ba743d6d834534f',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/property-access', 'install_path' => __DIR__ . '/../symfony/property-access',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/property-info' => array( 'symfony/property-info' => array(
'pretty_version' => 'v5.4.17', 'pretty_version' => 'v5.4.21',
'version' => '5.4.17.0', 'version' => '5.4.21.0',
'reference' => '12e1f7b3d73b1f3690aa524b92b5de9937507361', 'reference' => '722737086d76b4edabfc2d50a48cebd4b8cd5546',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/property-info', 'install_path' => __DIR__ . '/../symfony/property-info',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/string' => array( 'symfony/string' => array(
'pretty_version' => 'v5.4.17', 'pretty_version' => 'v5.4.21',
'version' => '5.4.17.0', 'version' => '5.4.21.0',
'reference' => '55733a8664b8853b003e70251c58bc8cb2d82a6b', 'reference' => 'edac10d167b78b1d90f46a80320d632de0bd9f2f',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/string', 'install_path' => __DIR__ . '/../symfony/string',
'aliases' => array(), 'aliases' => array(),
@ -218,9 +218,9 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/validator' => array( 'symfony/validator' => array(
'pretty_version' => 'v5.4.17', 'pretty_version' => 'v5.4.21',
'version' => '5.4.17.0', 'version' => '5.4.21.0',
'reference' => '621b820204a238d754f7f60241fcbdb1687641ea', 'reference' => '0ba987d705962a4f6571d31a8e1aed18ad2c9f55',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/validator', 'install_path' => __DIR__ . '/../symfony/validator',
'aliases' => array(), 'aliases' => array(),

View File

@ -0,0 +1,47 @@
name: Tests
on: [push, pull_request]
jobs:
php-tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
php: [8.2, 8.1, 8.0, 7.4, 7.3, 7.2, 7.1]
dependency-version: [prefer-stable]
os: [ubuntu-latest, windows-latest]
name: ${{ matrix.os }} - PHP${{ matrix.php }} - ${{ matrix.dependency-version }}
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout code
uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
- name: Install dependencies
run: |
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/phpunit
- name: Code Sniffer
run: vendor/bin/phpcs

View File

@ -1,6 +1,6 @@
# PHP 7.1 enums # PHP 7.1 enums
[![Build Status](https://travis-ci.org/DASPRiD/Enum.svg?branch=master)](https://travis-ci.org/DASPRiD/Enum) [![Build Status](https://github.com/DASPRiD/Enum/actions/workflows/tests.yml/badge.svg)](https://github.com/DASPRiD/Enum/actions?query=workflow%3Atests)
[![Coverage Status](https://coveralls.io/repos/github/DASPRiD/Enum/badge.svg?branch=master)](https://coveralls.io/github/DASPRiD/Enum?branch=master) [![Coverage Status](https://coveralls.io/repos/github/DASPRiD/Enum/badge.svg?branch=master)](https://coveralls.io/github/DASPRiD/Enum?branch=master)
[![Latest Stable Version](https://poser.pugx.org/dasprid/enum/v/stable)](https://packagist.org/packages/dasprid/enum) [![Latest Stable Version](https://poser.pugx.org/dasprid/enum/v/stable)](https://packagist.org/packages/dasprid/enum)
[![Total Downloads](https://poser.pugx.org/dasprid/enum/downloads)](https://packagist.org/packages/dasprid/enum) [![Total Downloads](https://poser.pugx.org/dasprid/enum/downloads)](https://packagist.org/packages/dasprid/enum)
@ -41,7 +41,7 @@ final class WeekDay extends AbstractEnum
protected const SATURDAY = null; protected const SATURDAY = null;
protected const SUNDAY = null; protected const SUNDAY = null;
} }
``` ```
If you need to provide constants for either internal use or public use, you can mark them as either private or public, If you need to provide constants for either internal use or public use, you can mark them as either private or public,
in which case they will be ignored by the enum, which only considers protected constants as valid values. As you can in which case they will be ignored by the enum, which only considers protected constants as valid values. As you can
@ -56,16 +56,16 @@ function tellItLikeItIs(WeekDay $weekDay)
case WeekDay::MONDAY(): case WeekDay::MONDAY():
echo 'Mondays are bad.'; echo 'Mondays are bad.';
break; break;
case WeekDay::FRIDAY(): case WeekDay::FRIDAY():
echo 'Fridays are better.'; echo 'Fridays are better.';
break; break;
case WeekDay::SATURDAY(): case WeekDay::SATURDAY():
case WeekDay::SUNDAY(): case WeekDay::SUNDAY():
echo 'Weekends are best.'; echo 'Weekends are best.';
break; break;
default: default:
echo 'Midweek days are so-so.'; echo 'Midweek days are so-so.';
} }
@ -107,14 +107,14 @@ final class Planet extends AbstractEnum
protected const SATURN = [5.688e+26, 6.0268e7]; protected const SATURN = [5.688e+26, 6.0268e7];
protected const URANUS = [8.686e+25, 2.5559e7]; protected const URANUS = [8.686e+25, 2.5559e7];
protected const NEPTUNE = [1.024e+26, 2.4746e7]; protected const NEPTUNE = [1.024e+26, 2.4746e7];
/** /**
* Universal gravitational constant. * Universal gravitational constant.
* *
* @var float * @var float
*/ */
private const G = 6.67300E-11; private const G = 6.67300E-11;
/** /**
* Mass in kilograms. * Mass in kilograms.
* *
@ -124,32 +124,32 @@ final class Planet extends AbstractEnum
/** /**
* Radius in meters. * Radius in meters.
* *
* @var float * @var float
*/ */
private $radius; private $radius;
protected function __construct(float $mass, float $radius) protected function __construct(float $mass, float $radius)
{ {
$this->mass = $mass; $this->mass = $mass;
$this->radius = $radius; $this->radius = $radius;
} }
public function mass() : float public function mass() : float
{ {
return $this->mass; return $this->mass;
} }
public function radius() : float public function radius() : float
{ {
return $this->radius; return $this->radius;
} }
public function surfaceGravity() : float public function surfaceGravity() : float
{ {
return self::G * $this->mass / ($this->radius * $this->radius); return self::G * $this->mass / ($this->radius * $this->radius);
} }
public function surfaceWeight(float $otherMass) : float public function surfaceWeight(float $otherMass) : float
{ {
return $otherMass * $this->surfaceGravity(); return $otherMass * $this->surfaceGravity();

View File

@ -14,9 +14,12 @@
"enum", "enum",
"map" "map"
], ],
"require": {
"php": ">=7.1 <9.0"
},
"require-dev": { "require-dev": {
"phpunit/phpunit": "^7 | ^8 | ^9", "phpunit/phpunit": "^7 | ^8 | ^9",
"squizlabs/php_codesniffer": "^3.4" "squizlabs/php_codesniffer": "*"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

View File

@ -88,6 +88,31 @@ final class EnumMap implements Serializable, IteratorAggregate
$this->values = array_fill(0, count($this->keyUniverse), null); $this->values = array_fill(0, count($this->keyUniverse), null);
} }
public function __serialize(): array
{
$values = [];
foreach ($this->values as $ordinal => $value) {
if (null === $value) {
continue;
}
$values[$ordinal] = $this->unmaskNull($value);
}
return [
'keyType' => $this->keyType,
'valueType' => $this->valueType,
'allowNullValues' => $this->allowNullValues,
'values' => $values,
];
}
public function __unserialize(array $data): void
{
$this->unserialize(serialize($data));
}
/** /**
* Checks whether the map types match the supplied ones. * Checks whether the map types match the supplied ones.
* *
@ -261,22 +286,7 @@ final class EnumMap implements Serializable, IteratorAggregate
public function serialize() : string public function serialize() : string
{ {
$values = []; return serialize($this->__serialize());
foreach ($this->values as $ordinal => $value) {
if (null === $value) {
continue;
}
$values[$ordinal] = $this->unmaskNull($value);
}
return serialize([
'keyType' => $this->keyType,
'valueType' => $this->valueType,
'allowNullValues' => $this->allowNullValues,
'values' => $values,
]);
} }
public function unserialize($serialized) : void public function unserialize($serialized) : void

View File

@ -25,8 +25,8 @@ abstract class HourTransformer extends Transformer
/** /**
* Returns a normalized hour value suitable for the hour transformer type. * Returns a normalized hour value suitable for the hour transformer type.
* *
* @param int $hour The hour value * @param int $hour The hour value
* @param string $marker An optional AM/PM marker * @param string|null $marker An optional AM/PM marker
* *
* @return int The normalized hour value * @return int The normalized hour value
*/ */

View File

@ -35,10 +35,18 @@ class QuarterTransformer extends Transformer
return $this->padLeft($quarter, $length); return $this->padLeft($quarter, $length);
case 3: case 3:
return 'Q'.$quarter; return 'Q'.$quarter;
default: case 4:
$map = [1 => '1st quarter', 2 => '2nd quarter', 3 => '3rd quarter', 4 => '4th quarter']; $map = [1 => '1st quarter', 2 => '2nd quarter', 3 => '3rd quarter', 4 => '4th quarter'];
return $map[$quarter]; return $map[$quarter];
default:
if (\defined('INTL_ICU_VERSION') && version_compare(\INTL_ICU_VERSION, '70.1', '<')) {
$map = [1 => '1st quarter', 2 => '2nd quarter', 3 => '3rd quarter', 4 => '4th quarter'];
return $map[$quarter];
} else {
return $quarter;
}
} }
} }

View File

@ -124,7 +124,7 @@ abstract class IntlDateFormatter
* @param int|null $datetype Type of date formatting, one of the format type constants * @param int|null $datetype Type of date formatting, one of the format type constants
* @param int|null $timetype Type of time formatting, one of the format type constants * @param int|null $timetype Type of time formatting, one of the format type constants
* @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier * @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier
* @param int $calendar Calendar to use for formatting or parsing. The only currently * @param int|null $calendar Calendar to use for formatting or parsing. The only currently
* supported value is IntlDateFormatter::GREGORIAN (or null using the default calendar, i.e. "GREGORIAN") * supported value is IntlDateFormatter::GREGORIAN (or null using the default calendar, i.e. "GREGORIAN")
* @param string|null $pattern Optional pattern to use when formatting * @param string|null $pattern Optional pattern to use when formatting
* *
@ -418,11 +418,11 @@ abstract class IntlDateFormatter
/** /**
* Parse string to a timestamp value. * Parse string to a timestamp value.
* *
* @param string $value String to convert to a time value * @param string $value String to convert to a time value
* @param int $position Not supported. Position at which to start the parsing in $value (zero-based) * @param int|null $position Not supported. Position at which to start the parsing in $value (zero-based)
* If no error occurs before $value is consumed, $parse_pos will * If no error occurs before $value is consumed, $parse_pos will
* contain -1 otherwise it will contain the position at which parsing * contain -1 otherwise it will contain the position at which parsing
* ended. If $parse_pos > strlen($value), the parse fails immediately. * ended. If $parse_pos > strlen($value), the parse fails immediately.
* *
* @return int|false Parsed value as a timestamp * @return int|false Parsed value as a timestamp
* *
@ -494,7 +494,7 @@ abstract class IntlDateFormatter
/** /**
* Set the formatter's pattern. * Set the formatter's pattern.
* *
* @param string $pattern A pattern string in conformance with the ICU IntlDateFormatter documentation * @param string|null $pattern A pattern string in conformance with the ICU IntlDateFormatter documentation
* *
* @return bool true on success or false on failure * @return bool true on success or false on failure
* *

View File

@ -1,4 +1,4 @@
Copyright (c) 2004-2022 Fabien Potencier Copyright (c) 2004-present Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -152,8 +152,8 @@ abstract class Locale
/** /**
* Not supported. Returns the localized display name for the locale language. * Not supported. Returns the localized display name for the locale language.
* *
* @param string $locale The locale code to return the display language from * @param string $locale The locale code to return the display language from
* @param string $inLocale Optional format locale code to use to display the language name * @param string|null $inLocale Optional format locale code to use to display the language name
* *
* @return string * @return string
* *
@ -169,8 +169,8 @@ abstract class Locale
/** /**
* Not supported. Returns the localized display name for the locale. * Not supported. Returns the localized display name for the locale.
* *
* @param string $locale The locale code to return the display locale name from * @param string $locale The locale code to return the display locale name from
* @param string $inLocale Optional format locale code to use to display the locale name * @param string|null $inLocale Optional format locale code to use to display the locale name
* *
* @return string * @return string
* *
@ -186,8 +186,8 @@ abstract class Locale
/** /**
* Not supported. Returns the localized display name for the locale region. * Not supported. Returns the localized display name for the locale region.
* *
* @param string $locale The locale code to return the display region from * @param string $locale The locale code to return the display region from
* @param string $inLocale Optional format locale code to use to display the region name * @param string|null $inLocale Optional format locale code to use to display the region name
* *
* @return string * @return string
* *
@ -203,8 +203,8 @@ abstract class Locale
/** /**
* Not supported. Returns the localized display name for the locale script. * Not supported. Returns the localized display name for the locale script.
* *
* @param string $locale The locale code to return the display script from * @param string $locale The locale code to return the display script from
* @param string $inLocale Optional format locale code to use to display the script name * @param string|null $inLocale Optional format locale code to use to display the script name
* *
* @return string * @return string
* *
@ -220,8 +220,8 @@ abstract class Locale
/** /**
* Not supported. Returns the localized display name for the locale variant. * Not supported. Returns the localized display name for the locale variant.
* *
* @param string $locale The locale code to return the display variant from * @param string $locale The locale code to return the display variant from
* @param string $inLocale Optional format locale code to use to display the variant name * @param string|null $inLocale Optional format locale code to use to display the variant name
* *
* @return string * @return string
* *
@ -301,10 +301,10 @@ abstract class Locale
/** /**
* Not supported. Returns the closest language tag for the locale. * Not supported. Returns the closest language tag for the locale.
* *
* @param array $langtag A list of the language tags to compare to locale * @param array $langtag A list of the language tags to compare to locale
* @param string $locale The locale to use as the language range when matching * @param string $locale The locale to use as the language range when matching
* @param bool $canonicalize If true, the arguments will be converted to canonical form before matching * @param bool $canonicalize If true, the arguments will be converted to canonical form before matching
* @param string $default The locale to use if no match is found * @param string|null $default The locale to use if no match is found
* *
* @see https://php.net/locale.lookup * @see https://php.net/locale.lookup
* *

View File

@ -244,10 +244,10 @@ abstract class NumberFormatter
/** /**
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") * @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
* @param int $style Style of the formatting, one of the format style constants. * @param int|null $style Style of the formatting, one of the format style constants.
* The only supported styles are NumberFormatter::DECIMAL * The only supported styles are NumberFormatter::DECIMAL
* and NumberFormatter::CURRENCY. * and NumberFormatter::CURRENCY.
* @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or * @param string|null $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax * NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation * described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
* *
@ -281,10 +281,10 @@ abstract class NumberFormatter
* Static constructor. * Static constructor.
* *
* @param string|null $locale The locale code. The only supported locale is "en" (or null using the default locale, i.e. "en") * @param string|null $locale The locale code. The only supported locale is "en" (or null using the default locale, i.e. "en")
* @param int $style Style of the formatting, one of the format style constants. * @param int|null $style Style of the formatting, one of the format style constants.
* The only currently supported styles are NumberFormatter::DECIMAL * The only currently supported styles are NumberFormatter::DECIMAL
* and NumberFormatter::CURRENCY. * and NumberFormatter::CURRENCY.
* @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or * @param string|null $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax * NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation * described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
* *
@ -485,9 +485,9 @@ abstract class NumberFormatter
/** /**
* Not supported. Parse a currency number. * Not supported. Parse a currency number.
* *
* @param string $value The value to parse * @param string $value The value to parse
* @param string $currency Parameter to receive the currency name (reference) * @param string $currency Parameter to receive the currency name (reference)
* @param int $position Offset to begin the parsing on return this value will hold the offset at which the parsing ended * @param int|null $position Offset to begin the parsing on return this value will hold the offset at which the parsing ended
* *
* @return float|false The parsed numeric value or false on error * @return float|false The parsed numeric value or false on error
* *

View File

@ -32,13 +32,13 @@ abstract class ResourceBundle
* *
* @see BundleEntryReaderInterface::readEntry() * @see BundleEntryReaderInterface::readEntry()
* *
* @param string[] $indices The indices to read from the bundle * @param string[] $indices The indices to read from the bundle
* @param string $locale The locale to read * @param string|null $locale The locale to read
* @param bool $fallback Whether to merge the value with the value from * @param bool $fallback Whether to merge the value with the value from
* the fallback locale (e.g. "en" for "en_GB"). * the fallback locale (e.g. "en" for "en_GB").
* Only applicable if the result is multivalued * Only applicable if the result is multivalued
* (i.e. array or \ArrayAccess) or cannot be found * (i.e. array or \ArrayAccess) or cannot be found
* in the requested locale. * in the requested locale.
* *
* @return mixed returns an array or {@link \ArrayAccess} instance for * @return mixed returns an array or {@link \ArrayAccess} instance for
* complex data and a scalar value for simple data * complex data and a scalar value for simple data

View File

@ -1,4 +1,4 @@
Copyright (c) 2004-2022 Fabien Potencier Copyright (c) 2004-present Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,4 +1,4 @@
Copyright (c) 2004-2022 Fabien Potencier Copyright (c) 2004-present Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -60,7 +60,7 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property
public function __construct(DocBlockFactoryInterface $docBlockFactory = null, array $mutatorPrefixes = null, array $accessorPrefixes = null, array $arrayMutatorPrefixes = null) public function __construct(DocBlockFactoryInterface $docBlockFactory = null, array $mutatorPrefixes = null, array $accessorPrefixes = null, array $arrayMutatorPrefixes = null)
{ {
if (!class_exists(DocBlockFactory::class)) { if (!class_exists(DocBlockFactory::class)) {
throw new \LogicException(sprintf('Unable to use the "%s" class as the "phpdocumentor/reflection-docblock" package is not installed.', __CLASS__)); throw new \LogicException(sprintf('Unable to use the "%s" class as the "phpdocumentor/reflection-docblock" package is not installed. Try running composer require "phpdocumentor/reflection-docblock".', __CLASS__));
} }
$this->docBlockFactory = $docBlockFactory ?: DocBlockFactory::createInstance(); $this->docBlockFactory = $docBlockFactory ?: DocBlockFactory::createInstance();
@ -200,7 +200,7 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property
} }
} }
if (!isset($types[0])) { if (!isset($types[0]) || [] === $types[0]) {
return null; return null;
} }

View File

@ -11,6 +11,7 @@
namespace Symfony\Component\PropertyInfo\Extractor; namespace Symfony\Component\PropertyInfo\Extractor;
use phpDocumentor\Reflection\Types\ContextFactory;
use PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode; use PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode; use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
@ -59,6 +60,14 @@ final class PhpStanExtractor implements PropertyTypeExtractorInterface, Construc
*/ */
public function __construct(array $mutatorPrefixes = null, array $accessorPrefixes = null, array $arrayMutatorPrefixes = null) public function __construct(array $mutatorPrefixes = null, array $accessorPrefixes = null, array $arrayMutatorPrefixes = null)
{ {
if (!class_exists(ContextFactory::class)) {
throw new \LogicException(sprintf('Unable to use the "%s" class as the "phpdocumentor/type-resolver" package is not installed. Try running composer require "phpdocumentor/type-resolver".', __CLASS__));
}
if (!class_exists(PhpDocParser::class)) {
throw new \LogicException(sprintf('Unable to use the "%s" class as the "phpstan/phpdoc-parser" package is not installed. Try running composer require "phpstan/phpdoc-parser".', __CLASS__));
}
$this->phpStanTypeHelper = new PhpStanTypeHelper(); $this->phpStanTypeHelper = new PhpStanTypeHelper();
$this->mutatorPrefixes = $mutatorPrefixes ?? ReflectionExtractor::$defaultMutatorPrefixes; $this->mutatorPrefixes = $mutatorPrefixes ?? ReflectionExtractor::$defaultMutatorPrefixes;
$this->accessorPrefixes = $accessorPrefixes ?? ReflectionExtractor::$defaultAccessorPrefixes; $this->accessorPrefixes = $accessorPrefixes ?? ReflectionExtractor::$defaultAccessorPrefixes;

View File

@ -1,4 +1,4 @@
Copyright (c) 2015-2022 Fabien Potencier Copyright (c) 2015-present Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -173,7 +173,7 @@ final class PhpDocTypeHelper
case 'boolean': case 'boolean':
return 'bool'; return 'bool';
// real is not part of the PHPDoc standard, so we ignore it // real is not part of the PHPDoc standard, so we ignore it
case 'double': case 'double':
return 'float'; return 'float';

View File

@ -37,8 +37,8 @@ abstract class AbstractUnicodeString extends AbstractString
private const ASCII = "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"; private const ASCII = "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F";
// the subset of folded case mappings that is not in lower case mappings // the subset of folded case mappings that is not in lower case mappings
private const FOLD_FROM = ['İ', 'µ', 'ſ', "\xCD\x85", 'ς', 'ϐ', 'ϑ', 'ϕ', 'ϖ', 'ϰ', 'ϱ', 'ϵ', 'ẛ', "\xE1\xBE\xBE", 'ß', 'İ', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'և', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ẞ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'ᾍ', 'ᾎ', 'ᾏ', 'ᾐ', 'ᾑ', 'ᾒ', 'ᾓ', 'ᾔ', 'ᾕ', 'ᾖ', 'ᾗ', 'ᾘ', 'ᾙ', 'ᾚ', 'ᾛ', 'ᾜ', 'ᾝ', 'ᾞ', 'ᾟ', 'ᾠ', 'ᾡ', 'ᾢ', 'ᾣ', 'ᾤ', 'ᾥ', 'ᾦ', 'ᾧ', 'ᾨ', 'ᾩ', 'ᾪ', 'ᾫ', 'ᾬ', 'ᾭ', 'ᾮ', 'ᾯ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'ᾼ', 'ῂ', 'ῃ', 'ῄ', 'ῆ', 'ῇ', 'ῌ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', ', 'ῤ', 'ῦ', 'ῧ', 'ῲ', 'ῳ', 'ῴ', 'ῶ', 'ῷ', 'ῼ', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ']; private const FOLD_FROM = ['İ', 'µ', 'ſ', "\xCD\x85", 'ς', 'ϐ', 'ϑ', 'ϕ', 'ϖ', 'ϰ', 'ϱ', 'ϵ', 'ẛ', "\xE1\xBE\xBE", 'ß', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'և', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ẞ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'ᾍ', 'ᾎ', 'ᾏ', 'ᾐ', 'ᾑ', 'ᾒ', 'ᾓ', 'ᾔ', 'ᾕ', 'ᾖ', 'ᾗ', 'ᾘ', 'ᾙ', 'ᾚ', 'ᾛ', 'ᾜ', 'ᾝ', 'ᾞ', 'ᾟ', 'ᾠ', 'ᾡ', 'ᾢ', 'ᾣ', 'ᾤ', 'ᾥ', 'ᾦ', 'ᾧ', 'ᾨ', 'ᾩ', 'ᾪ', 'ᾫ', 'ᾬ', 'ᾭ', 'ᾮ', 'ᾯ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'ᾼ', 'ῂ', 'ῃ', 'ῄ', 'ῆ', 'ῇ', 'ῌ', 'ῒ', 'ῖ', 'ῗ', 'ῢ', 'ῤ', 'ῦ', 'ῧ', 'ῲ', 'ῳ', 'ῴ', 'ῶ', 'ῷ', 'ῼ', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ'];
private const FOLD_TO = ['i̇', 'μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', 'ṡ', 'ι', 'ss', 'i̇', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'եւ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'aʾ', 'ss', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὰι', 'αι', 'άι', 'ᾶ', 'ᾶι', 'αι', 'ὴι', 'ηι', 'ήι', 'ῆ', 'ῆι', 'ηι', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', ', 'ῤ', 'ῦ', 'ῧ', 'ὼι', 'ωι', 'ώι', 'ῶ', 'ῶι', 'ωι', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'st', 'st', 'մն', 'մե', 'մի', 'վն', 'մխ']; private const FOLD_TO = ['i̇', 'μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', 'ṡ', 'ι', 'ss', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'եւ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'aʾ', 'ss', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὰι', 'αι', 'άι', 'ᾶ', 'ᾶι', 'αι', 'ὴι', 'ηι', 'ήι', 'ῆ', 'ῆι', 'ηι', 'ῒ', 'ῖ', 'ῗ', 'ῢ', 'ῤ', 'ῦ', 'ῧ', 'ὼι', 'ωι', 'ώι', 'ῶ', 'ῶι', 'ωι', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'st', 'st', 'մն', 'մե', 'մի', 'վն', 'մխ'];
// the subset of upper case mappings that map one code point to many code points // the subset of upper case mappings that map one code point to many code points
private const UPPER_FROM = ['ß', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'և', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ', 'ʼn', 'ΐ', 'ΰ', 'ǰ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾶ', 'ῆ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῶ']; private const UPPER_FROM = ['ß', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'և', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ', 'ʼn', 'ΐ', 'ΰ', 'ǰ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾶ', 'ῆ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῶ'];

View File

@ -1,4 +1,4 @@
Copyright (c) 2019-2022 Fabien Potencier Copyright (c) 2019-present Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -31,7 +31,11 @@ class AtLeastOneOfValidator extends ConstraintValidator
$validator = $this->context->getValidator(); $validator = $this->context->getValidator();
$messages = [$constraint->message]; // Build a first violation to have the base message of the constraint translated
$baseMessageContext = clone $this->context;
$baseMessageContext->buildViolation($constraint->message)->addViolation();
$baseViolations = $baseMessageContext->getViolations();
$messages = [(string) $baseViolations->get(\count($baseViolations) - 1)->getMessage()];
foreach ($constraint->constraints as $key => $item) { foreach ($constraint->constraints as $key => $item) {
if (!\in_array($this->context->getGroup(), $item->groups, true)) { if (!\in_array($this->context->getGroup(), $item->groups, true)) {

View File

@ -16,6 +16,7 @@ use Egulias\EmailValidator\Validation\EmailValidation;
use Egulias\EmailValidator\Validation\NoRFCWarningsValidation; use Egulias\EmailValidator\Validation\NoRFCWarningsValidation;
use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\Validator\Exception\LogicException;
use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Exception\UnexpectedValueException; use Symfony\Component\Validator\Exception\UnexpectedValueException;
@ -71,7 +72,7 @@ class EmailValidator extends ConstraintValidator
if (null === $constraint->mode) { if (null === $constraint->mode) {
if (Email::VALIDATION_MODE_STRICT === $this->defaultMode && !class_exists(EguliasEmailValidator::class)) { if (Email::VALIDATION_MODE_STRICT === $this->defaultMode && !class_exists(EguliasEmailValidator::class)) {
throw new LogicException(sprintf('The "egulias/email-validator" component is required to make the "%s" constraint default to strict mode.', EguliasEmailValidator::class)); throw new LogicException(sprintf('The "egulias/email-validator" component is required to make the "%s" constraint default to strict mode.', Email::class));
} }
$constraint->mode = $this->defaultMode; $constraint->mode = $this->defaultMode;

View File

@ -20,8 +20,6 @@ use Symfony\Component\Validator\Exception\UnexpectedValueException;
* @author Manuel Reinhard <manu@sprain.ch> * @author Manuel Reinhard <manu@sprain.ch>
* @author Michael Schummel * @author Michael Schummel
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*
* @see http://www.michael-schummel.de/2007/10/05/iban-prufung-mit-php/
*/ */
class IbanValidator extends ConstraintValidator class IbanValidator extends ConstraintValidator
{ {
@ -34,107 +32,135 @@ class IbanValidator extends ConstraintValidator
* a BBAN (Basic Bank Account Number) which has a fixed length per country and, * a BBAN (Basic Bank Account Number) which has a fixed length per country and,
* included within it, a bank identifier with a fixed position and a fixed length per country * included within it, a bank identifier with a fixed position and a fixed length per country
* *
* @see https://www.swift.com/sites/default/files/resources/iban_registry.pdf * @see Resources/bin/sync-iban-formats.php
* @see https://www.swift.com/swift-resource/11971/download?language=en
* @see https://en.wikipedia.org/wiki/International_Bank_Account_Number
*/ */
private const FORMATS = [ private const FORMATS = [
// auto-generated
'AD' => 'AD\d{2}\d{4}\d{4}[\dA-Z]{12}', // Andorra 'AD' => 'AD\d{2}\d{4}\d{4}[\dA-Z]{12}', // Andorra
'AE' => 'AE\d{2}\d{3}\d{16}', // United Arab Emirates 'AE' => 'AE\d{2}\d{3}\d{16}', // United Arab Emirates (The)
'AL' => 'AL\d{2}\d{8}[\dA-Z]{16}', // Albania 'AL' => 'AL\d{2}\d{8}[\dA-Z]{16}', // Albania
'AO' => 'AO\d{2}\d{21}', // Angola 'AO' => 'AO\d{2}\d{21}', // Angola
'AT' => 'AT\d{2}\d{5}\d{11}', // Austria 'AT' => 'AT\d{2}\d{5}\d{11}', // Austria
'AX' => 'FI\d{2}\d{6}\d{7}\d{1}', // Aland Islands 'AX' => 'FI\d{2}\d{3}\d{11}', // Finland
'AZ' => 'AZ\d{2}[A-Z]{4}[\dA-Z]{20}', // Azerbaijan 'AZ' => 'AZ\d{2}[A-Z]{4}[\dA-Z]{20}', // Azerbaijan
'BA' => 'BA\d{2}\d{3}\d{3}\d{8}\d{2}', // Bosnia and Herzegovina 'BA' => 'BA\d{2}\d{3}\d{3}\d{8}\d{2}', // Bosnia and Herzegovina
'BE' => 'BE\d{2}\d{3}\d{7}\d{2}', // Belgium 'BE' => 'BE\d{2}\d{3}\d{7}\d{2}', // Belgium
'BF' => 'BF\d{2}\d{23}', // Burkina Faso 'BF' => 'BF\d{2}[\dA-Z]{2}\d{22}', // Burkina Faso
'BG' => 'BG\d{2}[A-Z]{4}\d{4}\d{2}[\dA-Z]{8}', // Bulgaria 'BG' => 'BG\d{2}[A-Z]{4}\d{4}\d{2}[\dA-Z]{8}', // Bulgaria
'BH' => 'BH\d{2}[A-Z]{4}[\dA-Z]{14}', // Bahrain 'BH' => 'BH\d{2}[A-Z]{4}[\dA-Z]{14}', // Bahrain
'BI' => 'BI\d{2}\d{12}', // Burundi 'BI' => 'BI\d{2}\d{5}\d{5}\d{11}\d{2}', // Burundi
'BJ' => 'BJ\d{2}[A-Z]{1}\d{23}', // Benin 'BJ' => 'BJ\d{2}[\dA-Z]{2}\d{22}', // Benin
'BY' => 'BY\d{2}[\dA-Z]{4}\d{4}[\dA-Z]{16}', // Belarus - https://bank.codes/iban/structure/belarus/ 'BL' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France
'BL' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Saint Barthelemy 'BR' => 'BR\d{2}\d{8}\d{5}\d{10}[A-Z]{1}[\dA-Z]{1}', // Brazil
'BR' => 'BR\d{2}\d{8}\d{5}\d{10}[A-Z][\dA-Z]', // Brazil 'BY' => 'BY\d{2}[\dA-Z]{4}\d{4}[\dA-Z]{16}', // Republic of Belarus
'CG' => 'CG\d{2}\d{23}', // Congo 'CF' => 'CF\d{2}\d{23}', // Central African Republic
'CG' => 'CG\d{2}\d{23}', // Congo, Republic of the
'CH' => 'CH\d{2}\d{5}[\dA-Z]{12}', // Switzerland 'CH' => 'CH\d{2}\d{5}[\dA-Z]{12}', // Switzerland
'CI' => 'CI\d{2}[A-Z]{1}\d{23}', // Ivory Coast 'CI' => 'CI\d{2}[A-Z]{1}\d{23}', // Côte d'Ivoire
'CM' => 'CM\d{2}\d{23}', // Cameron 'CM' => 'CM\d{2}\d{23}', // Cameroon
'CR' => 'CR\d{2}0\d{3}\d{14}', // Costa Rica 'CR' => 'CR\d{2}\d{4}\d{14}', // Costa Rica
'CV' => 'CV\d{2}\d{21}', // Cape Verde 'CV' => 'CV\d{2}\d{21}', // Cabo Verde
'CY' => 'CY\d{2}\d{3}\d{5}[\dA-Z]{16}', // Cyprus 'CY' => 'CY\d{2}\d{3}\d{5}[\dA-Z]{16}', // Cyprus
'CZ' => 'CZ\d{2}\d{20}', // Czech Republic 'CZ' => 'CZ\d{2}\d{4}\d{6}\d{10}', // Czechia
'DE' => 'DE\d{2}\d{8}\d{10}', // Germany 'DE' => 'DE\d{2}\d{8}\d{10}', // Germany
'DJ' => 'DJ\d{2}\d{5}\d{5}\d{11}\d{2}', // Djibouti
'DK' => 'DK\d{2}\d{4}\d{9}\d{1}', // Denmark
'DO' => 'DO\d{2}[\dA-Z]{4}\d{20}', // Dominican Republic 'DO' => 'DO\d{2}[\dA-Z]{4}\d{20}', // Dominican Republic
'DK' => 'DK\d{2}\d{4}\d{10}', // Denmark 'DZ' => 'DZ\d{2}\d{22}', // Algeria
'DZ' => 'DZ\d{2}\d{20}', // Algeria
'EE' => 'EE\d{2}\d{2}\d{2}\d{11}\d{1}', // Estonia 'EE' => 'EE\d{2}\d{2}\d{2}\d{11}\d{1}', // Estonia
'ES' => 'ES\d{2}\d{4}\d{4}\d{1}\d{1}\d{10}', // Spain (also includes Canary Islands, Ceuta and Melilla) 'EG' => 'EG\d{2}\d{4}\d{4}\d{17}', // Egypt
'FI' => 'FI\d{2}\d{6}\d{7}\d{1}', // Finland 'ES' => 'ES\d{2}\d{4}\d{4}\d{1}\d{1}\d{10}', // Spain
'FI' => 'FI\d{2}\d{3}\d{11}', // Finland
'FO' => 'FO\d{2}\d{4}\d{9}\d{1}', // Faroe Islands 'FO' => 'FO\d{2}\d{4}\d{9}\d{1}', // Faroe Islands
'FR' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France 'FR' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France
'GF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // French Guyana 'GA' => 'GA\d{2}\d{23}', // Gabon
'GB' => 'GB\d{2}[A-Z]{4}\d{6}\d{8}', // United Kingdom of Great Britain and Northern Ireland 'GB' => 'GB\d{2}[A-Z]{4}\d{6}\d{8}', // United Kingdom
'GE' => 'GE\d{2}[A-Z]{2}\d{16}', // Georgia 'GE' => 'GE\d{2}[A-Z]{2}\d{16}', // Georgia
'GF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France
'GG' => 'GB\d{2}[A-Z]{4}\d{6}\d{8}', // United Kingdom
'GI' => 'GI\d{2}[A-Z]{4}[\dA-Z]{15}', // Gibraltar 'GI' => 'GI\d{2}[A-Z]{4}[\dA-Z]{15}', // Gibraltar
'GL' => 'GL\d{2}\d{4}\d{9}\d{1}', // Greenland 'GL' => 'GL\d{2}\d{4}\d{9}\d{1}', // Greenland
'GP' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Guadeloupe 'GP' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France
'GQ' => 'GQ\d{2}\d{23}', // Equatorial Guinea
'GR' => 'GR\d{2}\d{3}\d{4}[\dA-Z]{16}', // Greece 'GR' => 'GR\d{2}\d{3}\d{4}[\dA-Z]{16}', // Greece
'GT' => 'GT\d{2}[\dA-Z]{4}[\dA-Z]{20}', // Guatemala 'GT' => 'GT\d{2}[\dA-Z]{4}[\dA-Z]{20}', // Guatemala
'GW' => 'GW\d{2}[\dA-Z]{2}\d{19}', // Guinea-Bissau
'HN' => 'HN\d{2}[A-Z]{4}\d{20}', // Honduras
'HR' => 'HR\d{2}\d{7}\d{10}', // Croatia 'HR' => 'HR\d{2}\d{7}\d{10}', // Croatia
'HU' => 'HU\d{2}\d{3}\d{4}\d{1}\d{15}\d{1}', // Hungary 'HU' => 'HU\d{2}\d{3}\d{4}\d{1}\d{15}\d{1}', // Hungary
'IE' => 'IE\d{2}[A-Z]{4}\d{6}\d{8}', // Ireland 'IE' => 'IE\d{2}[A-Z]{4}\d{6}\d{8}', // Ireland
'IL' => 'IL\d{2}\d{3}\d{3}\d{13}', // Israel 'IL' => 'IL\d{2}\d{3}\d{3}\d{13}', // Israel
'IM' => 'GB\d{2}[A-Z]{4}\d{6}\d{8}', // United Kingdom
'IQ' => 'IQ\d{2}[A-Z]{4}\d{3}\d{12}', // Iraq
'IR' => 'IR\d{2}\d{22}', // Iran 'IR' => 'IR\d{2}\d{22}', // Iran
'IS' => 'IS\d{2}\d{4}\d{2}\d{6}\d{10}', // Iceland 'IS' => 'IS\d{2}\d{4}\d{2}\d{6}\d{10}', // Iceland
'IT' => 'IT\d{2}[A-Z]{1}\d{5}\d{5}[\dA-Z]{12}', // Italy 'IT' => 'IT\d{2}[A-Z]{1}\d{5}\d{5}[\dA-Z]{12}', // Italy
'JE' => 'GB\d{2}[A-Z]{4}\d{6}\d{8}', // United Kingdom
'JO' => 'JO\d{2}[A-Z]{4}\d{4}[\dA-Z]{18}', // Jordan 'JO' => 'JO\d{2}[A-Z]{4}\d{4}[\dA-Z]{18}', // Jordan
'KW' => 'KW\d{2}[A-Z]{4}\d{22}', // KUWAIT 'KM' => 'KM\d{2}\d{23}', // Comoros
'KW' => 'KW\d{2}[A-Z]{4}[\dA-Z]{22}', // Kuwait
'KZ' => 'KZ\d{2}\d{3}[\dA-Z]{13}', // Kazakhstan 'KZ' => 'KZ\d{2}\d{3}[\dA-Z]{13}', // Kazakhstan
'LB' => 'LB\d{2}\d{4}[\dA-Z]{20}', // LEBANON 'LB' => 'LB\d{2}\d{4}[\dA-Z]{20}', // Lebanon
'LI' => 'LI\d{2}\d{5}[\dA-Z]{12}', // Liechtenstein (Principality of) 'LC' => 'LC\d{2}[A-Z]{4}[\dA-Z]{24}', // Saint Lucia
'LI' => 'LI\d{2}\d{5}[\dA-Z]{12}', // Liechtenstein
'LT' => 'LT\d{2}\d{5}\d{11}', // Lithuania 'LT' => 'LT\d{2}\d{5}\d{11}', // Lithuania
'LU' => 'LU\d{2}\d{3}[\dA-Z]{13}', // Luxembourg 'LU' => 'LU\d{2}\d{3}[\dA-Z]{13}', // Luxembourg
'LV' => 'LV\d{2}[A-Z]{4}[\dA-Z]{13}', // Latvia 'LV' => 'LV\d{2}[A-Z]{4}[\dA-Z]{13}', // Latvia
'LY' => 'LY\d{2}\d{3}\d{3}\d{15}', // Libya
'MA' => 'MA\d{2}\d{24}', // Morocco
'MC' => 'MC\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Monaco 'MC' => 'MC\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Monaco
'MD' => 'MD\d{2}[\dA-Z]{2}[\dA-Z]{18}', // Moldova 'MD' => 'MD\d{2}[\dA-Z]{2}[\dA-Z]{18}', // Moldova
'ME' => 'ME\d{2}\d{3}\d{13}\d{2}', // Montenegro 'ME' => 'ME\d{2}\d{3}\d{13}\d{2}', // Montenegro
'MF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Saint Martin (French part) 'MF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France
'MG' => 'MG\d{2}\d{23}', // Madagascar 'MG' => 'MG\d{2}\d{23}', // Madagascar
'MK' => 'MK\d{2}\d{3}[\dA-Z]{10}\d{2}', // Macedonia, Former Yugoslav Republic of 'MK' => 'MK\d{2}\d{3}[\dA-Z]{10}\d{2}', // Macedonia
'ML' => 'ML\d{2}[A-Z]{1}\d{23}', // Mali 'ML' => 'ML\d{2}[\dA-Z]{2}\d{22}', // Mali
'MQ' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Martinique 'MQ' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France
'MR' => 'MR\d{2}\d{5}\d{5}\d{11}\d{2}', // Mauritania 'MR' => 'MR\d{2}\d{5}\d{5}\d{11}\d{2}', // Mauritania
'MT' => 'MT\d{2}[A-Z]{4}\d{5}[\dA-Z]{18}', // Malta 'MT' => 'MT\d{2}[A-Z]{4}\d{5}[\dA-Z]{18}', // Malta
'MU' => 'MU\d{2}[A-Z]{4}\d{2}\d{2}\d{12}\d{3}[A-Z]{3}', // Mauritius 'MU' => 'MU\d{2}[A-Z]{4}\d{2}\d{2}\d{12}\d{3}[A-Z]{3}', // Mauritius
'MZ' => 'MZ\d{2}\d{21}', // Mozambique 'MZ' => 'MZ\d{2}\d{21}', // Mozambique
'NC' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // New Caledonia 'NC' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France
'NL' => 'NL\d{2}[A-Z]{4}\d{10}', // The Netherlands 'NE' => 'NE\d{2}[A-Z]{2}\d{22}', // Niger
'NI' => 'NI\d{2}[A-Z]{4}\d{24}', // Nicaragua
'NL' => 'NL\d{2}[A-Z]{4}\d{10}', // Netherlands (The)
'NO' => 'NO\d{2}\d{4}\d{6}\d{1}', // Norway 'NO' => 'NO\d{2}\d{4}\d{6}\d{1}', // Norway
'PF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // French Polynesia 'PF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France
'PK' => 'PK\d{2}[A-Z]{4}[\dA-Z]{16}', // Pakistan 'PK' => 'PK\d{2}[A-Z]{4}[\dA-Z]{16}', // Pakistan
'PL' => 'PL\d{2}\d{8}\d{16}', // Poland 'PL' => 'PL\d{2}\d{8}\d{16}', // Poland
'PM' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Saint Pierre et Miquelon 'PM' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France
'PS' => 'PS\d{2}[A-Z]{4}[\dA-Z]{21}', // Palestine, State of 'PS' => 'PS\d{2}[A-Z]{4}[\dA-Z]{21}', // Palestine, State of
'PT' => 'PT\d{2}\d{4}\d{4}\d{11}\d{2}', // Portugal (plus Azores and Madeira) 'PT' => 'PT\d{2}\d{4}\d{4}\d{11}\d{2}', // Portugal
'QA' => 'QA\d{2}[A-Z]{4}[\dA-Z]{21}', // Qatar 'QA' => 'QA\d{2}[A-Z]{4}[\dA-Z]{21}', // Qatar
'RE' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Reunion 'RE' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France
'RO' => 'RO\d{2}[A-Z]{4}[\dA-Z]{16}', // Romania 'RO' => 'RO\d{2}[A-Z]{4}[\dA-Z]{16}', // Romania
'RS' => 'RS\d{2}\d{3}\d{13}\d{2}', // Serbia 'RS' => 'RS\d{2}\d{3}\d{13}\d{2}', // Serbia
'RU' => 'RU\d{2}\d{9}\d{5}[\dA-Z]{15}', // Russia
'SA' => 'SA\d{2}\d{2}[\dA-Z]{18}', // Saudi Arabia 'SA' => 'SA\d{2}\d{2}[\dA-Z]{18}', // Saudi Arabia
'SC' => 'SC\d{2}[A-Z]{4}\d{2}\d{2}\d{16}[A-Z]{3}', // Seychelles
'SD' => 'SD\d{2}\d{2}\d{12}', // Sudan
'SE' => 'SE\d{2}\d{3}\d{16}\d{1}', // Sweden 'SE' => 'SE\d{2}\d{3}\d{16}\d{1}', // Sweden
'SI' => 'SI\d{2}\d{5}\d{8}\d{2}', // Slovenia 'SI' => 'SI\d{2}\d{5}\d{8}\d{2}', // Slovenia
'SK' => 'SK\d{2}\d{4}\d{6}\d{10}', // Slovak Republic 'SK' => 'SK\d{2}\d{4}\d{6}\d{10}', // Slovakia
'SM' => 'SM\d{2}[A-Z]{1}\d{5}\d{5}[\dA-Z]{12}', // San Marino 'SM' => 'SM\d{2}[A-Z]{1}\d{5}\d{5}[\dA-Z]{12}', // San Marino
'SN' => 'SN\d{2}[A-Z]{1}\d{23}', // Senegal 'SN' => 'SN\d{2}[A-Z]{2}\d{22}', // Senegal
'TF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // French Southern Territories 'SO' => 'SO\d{2}\d{4}\d{3}\d{12}', // Somalia
'ST' => 'ST\d{2}\d{4}\d{4}\d{11}\d{2}', // Sao Tome and Principe
'SV' => 'SV\d{2}[A-Z]{4}\d{20}', // El Salvador
'TD' => 'TD\d{2}\d{23}', // Chad
'TF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France
'TG' => 'TG\d{2}[A-Z]{2}\d{22}', // Togo
'TL' => 'TL\d{2}\d{3}\d{14}\d{2}', // Timor-Leste 'TL' => 'TL\d{2}\d{3}\d{14}\d{2}', // Timor-Leste
'TN' => 'TN\d{2}\d{2}\d{3}\d{13}\d{2}', // Tunisia 'TN' => 'TN\d{2}\d{2}\d{3}\d{13}\d{2}', // Tunisia
'TR' => 'TR\d{2}\d{5}[\dA-Z]{1}[\dA-Z]{16}', // Turkey 'TR' => 'TR\d{2}\d{5}\d{1}[\dA-Z]{16}', // Turkey
'UA' => 'UA\d{2}\d{6}[\dA-Z]{19}', // Ukraine 'UA' => 'UA\d{2}\d{6}[\dA-Z]{19}', // Ukraine
'VA' => 'VA\d{2}\d{3}\d{15}', // Vatican City State 'VA' => 'VA\d{2}\d{3}\d{15}', // Vatican City State
'VG' => 'VG\d{2}[A-Z]{4}\d{16}', // Virgin Islands, British 'VG' => 'VG\d{2}[A-Z]{4}\d{16}', // Virgin Islands
'WF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Wallis and Futuna Islands 'WF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France
'XK' => 'XK\d{2}\d{4}\d{10}\d{2}', // Republic of Kosovo 'XK' => 'XK\d{2}\d{4}\d{10}\d{2}', // Kosovo
'YT' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Mayotte 'YT' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France
]; ];
/** /**

View File

@ -1,4 +1,4 @@
Copyright (c) 2004-2022 Fabien Potencier Copyright (c) 2004-present Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -130,16 +130,22 @@ abstract class ConstraintValidatorTestCase extends TestCase
$context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath); $context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath);
$context->setConstraint($this->constraint); $context->setConstraint($this->constraint);
$contextualValidator = $this->getMockBuilder(AssertingContextualValidator::class) $contextualValidatorMockBuilder = $this->getMockBuilder(AssertingContextualValidator::class)
->setConstructorArgs([$context]) ->setConstructorArgs([$context]);
->setMethods([ $contextualValidatorMethods = [
'atPath', 'atPath',
'validate', 'validate',
'validateProperty', 'validateProperty',
'validatePropertyValue', 'validatePropertyValue',
'getViolations', 'getViolations',
]) ];
->getMock(); // PHPUnit 10 removed MockBuilder::setMethods()
if (method_exists($contextualValidatorMockBuilder, 'onlyMethods')) {
$contextualValidatorMockBuilder->onlyMethods($contextualValidatorMethods);
} else {
$contextualValidatorMockBuilder->setMethods($contextualValidatorMethods);
}
$contextualValidator = $contextualValidatorMockBuilder->getMock();
$contextualValidator->expects($this->any()) $contextualValidator->expects($this->any())
->method('atPath') ->method('atPath')
->willReturnCallback(function ($path) use ($contextualValidator) { ->willReturnCallback(function ($path) use ($contextualValidator) {

View File

@ -43,7 +43,7 @@
"symfony/translation": "^4.4|^5.0|^6.0", "symfony/translation": "^4.4|^5.0|^6.0",
"doctrine/annotations": "^1.13|^2", "doctrine/annotations": "^1.13|^2",
"doctrine/cache": "^1.11|^2.0", "doctrine/cache": "^1.11|^2.0",
"egulias/email-validator": "^2.1.10|^3" "egulias/email-validator": "^2.1.10|^3|^4"
}, },
"conflict": { "conflict": {
"doctrine/annotations": "<1.13", "doctrine/annotations": "<1.13",