diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a9b8f8536c..37b62f133b 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,7 +1,7 @@ parameters: ignoreErrors: - - message: "#^Parameter \\#1 \\$input of function str_pad expects string, int given\\.$#" + message: "#^Parameter \\#1 \\$string of function str_pad expects string, int given\\.$#" count: 1 path: src/Faker/Calculator/Iban.php @@ -610,11 +610,6 @@ parameters: count: 1 path: src/Faker/ORM/Spot/Populator.php - - - message: "#^Class UnitEnum not found\\.$#" - count: 2 - path: src/Faker/Provider/Base.php - - message: """ #^Instantiation of deprecated class Faker\\\\DefaultGenerator\\: @@ -629,7 +624,7 @@ parameters: path: src/Faker/Provider/Base.php - - message: "#^Parameter \\#1 \\$input of function str_pad expects string, int given\\.$#" + message: "#^Parameter \\#1 \\$string of function str_pad expects string, int given\\.$#" count: 1 path: src/Faker/Provider/Base.php @@ -679,12 +674,12 @@ parameters: path: src/Faker/Provider/Lorem.php - - message: "#^Parameter \\#1 \\$str of function md5 expects string, int given\\.$#" + message: "#^Parameter \\#1 \\$string of function md5 expects string, int given\\.$#" count: 1 path: src/Faker/Provider/Miscellaneous.php - - message: "#^Parameter \\#1 \\$str of function sha1 expects string, int given\\.$#" + message: "#^Parameter \\#1 \\$string of function sha1 expects string, int given\\.$#" count: 1 path: src/Faker/Provider/Miscellaneous.php @@ -774,7 +769,7 @@ parameters: path: src/Faker/Provider/en_NG/Address.php - - message: "#^Parameter \\#1 \\$input of function str_pad expects string, int given\\.$#" + message: "#^Parameter \\#1 \\$string of function str_pad expects string, int given\\.$#" count: 1 path: src/Faker/Provider/en_ZA/Person.php @@ -899,12 +894,7 @@ parameters: path: src/Faker/Provider/pt_PT/Address.php - - message: "#^Left side of \\|\\| is always true\\.$#" - count: 1 - path: src/Faker/Provider/pt_PT/Person.php - - - - message: "#^Right side of \\|\\| is always false\\.$#" + message: "#^Binary operation \"\\*\" between string and int results in an error\\.$#" count: 1 path: src/Faker/Provider/pt_PT/Person.php @@ -914,7 +904,7 @@ parameters: path: src/Faker/Provider/ro_RO/Person.php - - message: "#^Parameter \\#1 \\$input of function str_pad expects string, int given\\.$#" + message: "#^Parameter \\#1 \\$string of function str_pad expects string, int given\\.$#" count: 1 path: src/Faker/Provider/ru_RU/Company.php @@ -934,7 +924,7 @@ parameters: path: src/Faker/Provider/sv_SE/Municipality.php - - message: "#^Parameter \\#1 \\$input of function str_pad expects string, int given\\.$#" + message: "#^Parameter \\#1 \\$string of function str_pad expects string, int given\\.$#" count: 1 path: src/Faker/Provider/zh_CN/Address.php @@ -944,7 +934,7 @@ parameters: path: src/Faker/Provider/zh_CN/Address.php - - message: "#^Parameter \\#1 \\$autoload_function of function spl_autoload_register expects callable\\(string\\)\\: void, Closure\\(mixed\\)\\: bool given\\.$#" + message: "#^Parameter \\#1 \\$callback of function spl_autoload_register expects \\(callable\\(string\\)\\: void\\)\\|null, Closure\\(mixed\\)\\: bool given\\.$#" count: 1 path: src/autoload.php diff --git a/psalm.baseline.xml b/psalm.baseline.xml index 170c7c2780..07afc3cf03 100644 --- a/psalm.baseline.xml +++ b/psalm.baseline.xml @@ -141,26 +141,18 @@ - [static::class, 'randomDigit'] - static function ($matches) { + + + }]]> - - \UnitEnum - \UnitEnum - Closure - - enum_exists($array) - enum_exists($array) - diff --git a/src/Faker/Provider/fr_FR/Address.php b/src/Faker/Provider/fr_FR/Address.php index 106f648cca..d6dbb76cca 100644 --- a/src/Faker/Provider/fr_FR/Address.php +++ b/src/Faker/Provider/fr_FR/Address.php @@ -34,7 +34,11 @@ class Address extends \Faker\Provider\Address ]; protected static $buildingNumber = ['%', '%#', '%#', '%#', '%##']; - protected static $postcode = ['#####', '## ###']; + + /** + * @see https://en.wikipedia.org/wiki/Postal_codes_in_France + */ + protected static $postcode = ['#####']; protected static $country = [ 'Afghanistan', 'Afrique du sud', 'Albanie', 'Algérie', 'Allemagne', 'Andorre', 'Angola', 'Anguilla', 'Antarctique', 'Antigua et Barbuda', 'Antilles néerlandaises', 'Arabie saoudite', 'Argentine', 'Arménie', 'Aruba', 'Australie', 'Autriche', 'Azerbaïdjan', 'Bahamas', 'Bahrain', 'Bangladesh', 'Belgique', 'Belize', 'Benin', 'Bermudes (Les)', 'Bhoutan', 'Biélorussie', 'Bolivie', 'Bosnie-Herzégovine', 'Botswana', 'Bouvet (Îles)', 'Brunei', 'Brésil', 'Bulgarie', 'Burkina Faso', 'Burundi', 'Cambodge', 'Cameroun', 'Canada', 'Cap Vert', 'Cayman (Îles)', 'Chili', 'Chine (Rép. pop.)', 'Christmas (Île)', 'Chypre', 'Cocos (Îles)', 'Colombie', 'Comores', 'Cook (Îles)', 'Corée du Nord', 'Corée, Sud', 'Costa Rica', 'Croatie', 'Cuba', 'Côte d\'Ivoire', 'Danemark', 'Djibouti', 'Dominique', 'Égypte', 'El Salvador', 'Émirats arabes unis', 'Équateur', 'Érythrée', 'Espagne', 'Estonie', 'États-Unis', 'Ethiopie', 'Falkland (Île)', 'Fidji (République des)', 'Finlande', 'France', 'Féroé (Îles)', 'Gabon', diff --git a/test/Faker/Provider/fr_FR/AddressTest.php b/test/Faker/Provider/fr_FR/AddressTest.php index 1f48f54d5f..c2bd8697b4 100644 --- a/test/Faker/Provider/fr_FR/AddressTest.php +++ b/test/Faker/Provider/fr_FR/AddressTest.php @@ -10,6 +10,14 @@ */ final class AddressTest extends TestCase { + public function testPostcode(): void + { + $postcode = $this->faker->postcode(); + self::assertNotEmpty($postcode); + self::assertIsString($postcode); + self::assertMatchesRegularExpression('@^\d{5}$@', $postcode); + } + public function testSecondaryAddress(): void { self::assertEquals('Étage 007', $this->faker->secondaryAddress());