From 9cbb4602e76fe8bb1a1626a4221c7f5262f4c771 Mon Sep 17 00:00:00 2001 From: Luca Rath-Heel Date: Wed, 21 Dec 2022 10:16:18 +0100 Subject: [PATCH] Make salutation gender neutral (#342) --- Dynamic/Types/SalutationType.php | 6 +- Resources/translations/admin.de.json | 4 +- Resources/translations/admin.en.json | 4 +- Resources/translations/messages.de.xliff | 10 ++- Resources/translations/messages.en.xliff | 10 ++- Resources/translations/messages.fr.xliff | 10 ++- Resources/translations/messages.nl.xliff | 10 ++- composer.json | 1 + phpstan-baseline.neon | 84 +----------------------- 9 files changed, 49 insertions(+), 90 deletions(-) diff --git a/Dynamic/Types/SalutationType.php b/Dynamic/Types/SalutationType.php index ae88c069..95b2b80e 100644 --- a/Dynamic/Types/SalutationType.php +++ b/Dynamic/Types/SalutationType.php @@ -34,10 +34,11 @@ public function getConfiguration(): FormFieldTypeConfiguration public function build(FormBuilderInterface $builder, FormField $field, string $locale, array $options): void { - $options['choice_translation_domain'] = 'messages'; + $options['translation_domain'] = 'messages'; $options['expanded'] = false; $options['multiple'] = false; $options['choices'] = $this->getChoices(); + $options['placeholder'] = 'sulu_form.salutation_please_choose'; $type = ChoiceType::class; $builder->add($field->getKey(), $type, $options); } @@ -48,8 +49,9 @@ public function build(FormBuilderInterface $builder, FormField $field, string $l protected function getChoices(): array { return [ - 'sulu_form.salutation_mr' => 'mr', 'sulu_form.salutation_ms' => 'ms', + 'sulu_form.salutation_mr' => 'mr', + 'sulu_form.salutation_neutral' => 'neutral', ]; } } diff --git a/Resources/translations/admin.de.json b/Resources/translations/admin.de.json index 3c18fc42..9053e247 100644 --- a/Resources/translations/admin.de.json +++ b/Resources/translations/admin.de.json @@ -82,8 +82,10 @@ "sulu_form.sendinblue_redirection_url": "Weiterleitungs-URL", "sulu_form.sendinblue_attribute_name_first_name": "Attribut-Name [Vorname]", "sulu_form.sendinblue_attribute_name_last_name": "Attribut-Name [Nachname]", - "sulu_form.salutation_mr": "Herr", "sulu_form.salutation_ms": "Frau", + "sulu_form.salutation_mr": "Herr", + "sulu_form.salutation_neutral": "Neutral", + "sulu_form.salutation_please_choose": "Bitte auswählen", "sulu_form.single_form_selection.no_form_selected": "Kein Formular ausgewählt", "sulu_form.single_form_selection.overlay_title": "Wählen Sie ein Formular aus", "sulu_activity.resource.forms": "Formular", diff --git a/Resources/translations/admin.en.json b/Resources/translations/admin.en.json index e13e3d88..2d852a93 100644 --- a/Resources/translations/admin.en.json +++ b/Resources/translations/admin.en.json @@ -82,8 +82,10 @@ "sulu_form.sendinblue_redirection_url": "Redirection url", "sulu_form.sendinblue_attribute_name_first_name": "Attribute name [First name]", "sulu_form.sendinblue_attribute_name_last_name": "Attribute name [Last name]", - "sulu_form.salutation_mr": "Mr.", "sulu_form.salutation_ms": "Ms.", + "sulu_form.salutation_mr": "Mr.", + "sulu_form.salutation_neutral": "Neutral", + "sulu_form.salutation_please_choose": "Please choose", "sulu_form.single_form_selection.no_form_selected": "No form selected", "sulu_form.single_form_selection.overlay_title": "Select a form", "sulu_activity.resource.forms": "Form", diff --git a/Resources/translations/messages.de.xliff b/Resources/translations/messages.de.xliff index 5ba752fe..3f9d90e7 100644 --- a/Resources/translations/messages.de.xliff +++ b/Resources/translations/messages.de.xliff @@ -18,6 +18,14 @@ sulu_form.mail.plain_text Diese Mail kann nur in HTML angezeigt werden + + sulu_form.salutation_neutral + Neutral + + + sulu_form.salutation_please_choose + Bitte auswählen + - \ No newline at end of file + diff --git a/Resources/translations/messages.en.xliff b/Resources/translations/messages.en.xliff index 47c8314b..c41186dc 100644 --- a/Resources/translations/messages.en.xliff +++ b/Resources/translations/messages.en.xliff @@ -18,6 +18,14 @@ sulu_form.mail.plain_text This mail can only be viewed in HTML + + sulu_form.salutation_neutral + Neutral + + + sulu_form.salutation_please_choose + Please choose + - \ No newline at end of file + diff --git a/Resources/translations/messages.fr.xliff b/Resources/translations/messages.fr.xliff index 3c72d74b..eaaad4b3 100644 --- a/Resources/translations/messages.fr.xliff +++ b/Resources/translations/messages.fr.xliff @@ -18,6 +18,14 @@ sulu_form.mail.plain_text Ce courrier ne peut être visualisé qu'en HTML + + sulu_form.salutation_neutral + Neutre + + + sulu_form.salutation_please_choose + Veuillez choisir + - \ No newline at end of file + diff --git a/Resources/translations/messages.nl.xliff b/Resources/translations/messages.nl.xliff index 32d83d1f..c36376c8 100644 --- a/Resources/translations/messages.nl.xliff +++ b/Resources/translations/messages.nl.xliff @@ -18,6 +18,14 @@ sulu_form.mail.plain_text Deze mail is alleen in HTML te bekijken + + sulu_form.salutation_neutral + Neutrale + + + sulu_form.salutation_please_choose + Gelieve te kiezen + - \ No newline at end of file + diff --git a/composer.json b/composer.json index 0763fb5a..125ee829 100644 --- a/composer.json +++ b/composer.json @@ -45,6 +45,7 @@ "jackalope/jackalope-doctrine-dbal": "^1.3.2", "jangregor/phpstan-prophecy": "^1.0", "massive/search-bundle": "^2.0", + "phpspec/prophecy": "^1.14", "phpstan/phpstan": "^1.0", "phpstan/phpstan-doctrine": "^1.0", "phpstan/phpstan-phpunit": "^1.0", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 10905217..eafa423c 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -5,11 +5,6 @@ parameters: count: 1 path: Admin/DynamicListAdmin.php - - - message: "#^Parameter \\#1 \\$tabOrder of method Sulu\\\\Bundle\\\\AdminBundle\\\\Admin\\\\View\\\\ListViewBuilderInterface\\:\\:setTabOrder\\(\\) expects int, mixed given\\.$#" - count: 1 - path: Admin/DynamicListAdmin.php - - message: "#^Parameter \\#1 \\$viewName of method Sulu\\\\Bundle\\\\AdminBundle\\\\Admin\\\\View\\\\ViewCollection\\:\\:has\\(\\) expects string, mixed given\\.$#" count: 1 @@ -17,7 +12,7 @@ parameters: - message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" - count: 2 + count: 1 path: Admin/DynamicListAdmin.php - @@ -410,11 +405,6 @@ parameters: count: 1 path: Dynamic/Checksum.php - - - message: "#^Cannot access offset 'lists' on array\\|false\\.$#" - count: 1 - path: Dynamic/Helper/MailchimpListSelect.php - - message: "#^Property Sulu\\\\Bundle\\\\FormBundle\\\\Dynamic\\\\Helper\\\\MailchimpListSelect\\:\\:\\$apiKey \\(string\\) does not accept string\\|null\\.$#" count: 1 @@ -445,21 +435,6 @@ parameters: count: 1 path: Dynamic/Helper/SendinblueMailTemplateSelect.php - - - message: "#^Cannot access an offset on mixed\\.$#" - count: 2 - path: Dynamic/Types/AttachmentType.php - - - - message: "#^Cannot access offset 'accept' on mixed\\.$#" - count: 1 - path: Dynamic/Types/AttachmentType.php - - - - message: "#^Cannot access offset 'max' on mixed\\.$#" - count: 1 - path: Dynamic/Types/AttachmentType.php - - message: "#^Cannot call method getDefaultValue\\(\\) on Sulu\\\\Bundle\\\\FormBundle\\\\Entity\\\\FormFieldTranslation\\|null\\.$#" count: 1 @@ -640,11 +615,6 @@ parameters: count: 1 path: Dynamic/Types/FirstNameType.php - - - message: "#^Cannot access offset 'type' on mixed\\.$#" - count: 1 - path: Dynamic/Types/FreeTextType.php - - message: "#^Cannot call method getDefaultValue\\(\\) on Sulu\\\\Bundle\\\\FormBundle\\\\Entity\\\\FormFieldTranslation\\|null\\.$#" count: 1 @@ -655,11 +625,6 @@ parameters: count: 1 path: Dynamic/Types/FunctionType.php - - - message: "#^Cannot access offset 'type' on mixed\\.$#" - count: 1 - path: Dynamic/Types/HeadlineType.php - - message: "#^Cannot call method getDefaultValue\\(\\) on Sulu\\\\Bundle\\\\FormBundle\\\\Entity\\\\FormFieldTranslation\\|null\\.$#" count: 1 @@ -715,11 +680,6 @@ parameters: count: 1 path: Dynamic/Types/RadioButtonsType.php - - - message: "#^Cannot access offset 'options' on mixed\\.$#" - count: 1 - path: Dynamic/Types/RecaptchaType.php - - message: "#^Cannot call method getDefaultValue\\(\\) on Sulu\\\\Bundle\\\\FormBundle\\\\Entity\\\\FormFieldTranslation\\|null\\.$#" count: 1 @@ -735,11 +695,6 @@ parameters: count: 1 path: Dynamic/Types/SendinblueType.php - - - message: "#^Cannot access offset 'type' on mixed\\.$#" - count: 1 - path: Dynamic/Types/SpacerType.php - - message: "#^Cannot call method getDefaultValue\\(\\) on Sulu\\\\Bundle\\\\FormBundle\\\\Entity\\\\FormFieldTranslation\\|null\\.$#" count: 1 @@ -1102,7 +1057,7 @@ parameters: - message: "#^Cannot access offset 'type' on array\\|bool\\|float\\|int\\|string\\.$#" - count: 2 + count: 1 path: Form/Builder.php - @@ -1130,11 +1085,6 @@ parameters: count: 1 path: Form/Builder.php - - - message: "#^Parameter \\#1 \\$id of method Sulu\\\\Bundle\\\\FormBundle\\\\Form\\\\Builder\\:\\:build\\(\\) expects int, mixed given\\.$#" - count: 1 - path: Form/Builder.php - - message: "#^Parameter \\#2 \\$type of method Sulu\\\\Bundle\\\\FormBundle\\\\Dynamic\\\\Checksum\\:\\:check\\(\\) expects string, mixed given\\.$#" count: 1 @@ -1150,31 +1100,16 @@ parameters: count: 1 path: Form/Builder.php - - - message: "#^Parameter \\#3 \\$typeId of method Sulu\\\\Bundle\\\\FormBundle\\\\Form\\\\Builder\\:\\:build\\(\\) expects string, mixed given\\.$#" - count: 1 - path: Form/Builder.php - - message: "#^Parameter \\#4 \\$formId of method Sulu\\\\Bundle\\\\FormBundle\\\\Dynamic\\\\Checksum\\:\\:check\\(\\) expects int, mixed given\\.$#" count: 1 path: Form/Builder.php - - - message: "#^Parameter \\#4 \\$locale of method Sulu\\\\Bundle\\\\FormBundle\\\\Form\\\\Builder\\:\\:build\\(\\) expects string\\|null, mixed given\\.$#" - count: 1 - path: Form/Builder.php - - message: "#^Parameter \\#5 \\$formName of method Sulu\\\\Bundle\\\\FormBundle\\\\Dynamic\\\\Checksum\\:\\:check\\(\\) expects string, mixed given\\.$#" count: 1 path: Form/Builder.php - - - message: "#^Parameter \\#5 \\$name of method Sulu\\\\Bundle\\\\FormBundle\\\\Form\\\\Builder\\:\\:build\\(\\) expects string, mixed given\\.$#" - count: 1 - path: Form/Builder.php - - message: "#^Parameter \\#6 \\$webspaceKey of method Sulu\\\\Bundle\\\\FormBundle\\\\Form\\\\Builder\\:\\:createForm\\(\\) expects string, string\\|null given\\.$#" count: 1 @@ -1750,21 +1685,6 @@ parameters: count: 1 path: Repository/DynamicRepository.php - - - message: "#^Parameter \\#2 \\$search of method Sulu\\\\Bundle\\\\FormBundle\\\\Repository\\\\DynamicRepository\\:\\:addSearchFilter\\(\\) expects string\\|null, mixed given\\.$#" - count: 1 - path: Repository/DynamicRepository.php - - - - message: "#^Parameter \\#3 \\$searchFields of method Sulu\\\\Bundle\\\\FormBundle\\\\Repository\\\\DynamicRepository\\:\\:addSearchFilter\\(\\) expects array\\\\|null, mixed given\\.$#" - count: 1 - path: Repository/DynamicRepository.php - - - - message: "#^Parameter \\#3 \\$toDate of method Sulu\\\\Bundle\\\\FormBundle\\\\Repository\\\\DynamicRepository\\:\\:addDateRangeFilter\\(\\) expects string\\|null, mixed given\\.$#" - count: 1 - path: Repository/DynamicRepository.php - - message: "#^Cannot cast mixed to int\\.$#" count: 1