diff --git a/.php_cs.dist.php b/.php_cs.dist.php index c9cd4d06d..4ad5af914 100644 --- a/.php_cs.dist.php +++ b/.php_cs.dist.php @@ -21,52 +21,52 @@ $config $rules = $config->getRules(); $riskyRules = [ - 'final_internal_class' => false, - 'no_useless_sprintf' => false, - 'dir_constant' => false, - 'no_alias_functions' => false, - 'implode_call' => false, - 'combine_nested_dirname' => false, - 'pow_to_exponentiation' => false, - 'comment_to_phpdoc' => false, - 'no_unset_on_property' => false, - 'strict_param' => false, - 'native_constant_invocation' => false, - 'php_unit_test_annotation' => false, - 'php_unit_no_expectation_annotation' => false, - 'declare_strict_types' => false, - 'function_to_constant' => false, - 'is_null' => false, - 'native_function_invocation' => false, 'ternary_to_elvis_operator' => false, - 'no_trailing_whitespace_in_string' => false, - 'no_unreachable_default_argument_value' => false, - 'php_unit_test_case_static_method_calls' => false, - 'strict_comparison' => false, - 'array_push' => false, - 'ereg_to_preg' => false, - 'error_suppression' => false, - 'fopen_flag_order' => false, - 'fopen_flags' => false, - 'logical_operators' => false, - 'modernize_types_casting' => false, - 'no_homoglyph_names' => false, - 'no_unneeded_final_method' => false, - 'non_printable_character' => false, - 'ordered_traits' => false, 'php_unit_mock_short_will_return' => false, 'php_unit_set_up_tear_down_visibility' => false, - 'set_type_to_cast' => false, - 'string_line_ending' => false, - 'ordered_interfaces' => false, + 'php_unit_construct' => false, + 'php_unit_dedicate_assert' => false, 'php_unit_expectation' => false, 'php_unit_mock' => false, 'php_unit_namespaced' => false, - 'random_api_migration' => false, - 'static_lambda' => false, - 'php_unit_construct' => false, - 'psr_autoloading' => false, - 'php_unit_dedicate_assert' => false, + 'php_unit_no_expectation_annotation' => false, + 'php_unit_test_case_static_method_calls' => false, + 'php_unit_test_annotation' => false, + // 'final_internal_class' => false, + // 'strict_param' => false, + // 'declare_strict_types' => false, + // 'strict_comparison' => false, + // 'no_unreachable_default_argument_value' => false, + // 'ereg_to_preg' => false, + // 'ordered_interfaces' => false, + // 'error_suppression' => false, + // 'non_printable_character' => false, + // 'ordered_traits' => false, + // 'no_useless_sprintf' => false, + // 'dir_constant' => false, + // 'no_alias_functions' => false, + // 'implode_call' => false, + // 'combine_nested_dirname' => false, + // 'pow_to_exponentiation' => false, + // 'comment_to_phpdoc' => false, + // 'no_unset_on_property' => false, + // 'native_constant_invocation' => false, + // 'function_to_constant' => false, + // 'is_null' => false, + // 'native_function_invocation' => false, + // 'no_trailing_whitespace_in_string' => false, + // 'array_push' => false, + // 'fopen_flag_order' => false, + // 'fopen_flags' => false, + // 'logical_operators' => false, + // 'modernize_types_casting' => false, + // 'no_homoglyph_names' => false, + // 'no_unneeded_final_method' => false, + // 'random_api_migration' => false, + // 'static_lambda' => false, + // 'set_type_to_cast' => false, + // 'string_line_ending' => false, + // 'psr_autoloading' => false, ]; $rules = array_merge( diff --git a/CHANGELOG.md b/CHANGELOG.md index caf9a9249..ec27da83d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,18 +11,44 @@ and this project adheres to ## Unreleased +* [person search] fix bug when using birthdate after and birthdate before +* [person search] increase pertinence when lastname begins with search pattern + +## Test releases + +### Test release 2021-11-19 - bis + +* [household] do not allow to create two addresses on the same date +* [activity] handle case when there is no social action associated to social issue +* [activity] layout for issues / actions +* [activity][bugfix] in edit mode, the form will now load the social action list + +### Test release 2021-11-29 + +* [person] suggest entities (person | thirdparty) when creating/editing the accompanying course (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/119) +* [activity] add custom validation on the Activity class, based on what is required from the ActivityType (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/188) * [main] translate multiselect messages when selecting/creating address * [main] set the coordinates of the city when creating a new address OR choosing "pas d'adresse complète" * Use the user.label in accompanying course banner, instead of username; * fix: show validation message when closing accompanying course; * [thirdparty] link from modal to thirdparty detail page fixed (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/228) +* [assets] new asset to style suggestions lists (with add/remove item link) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/258) +* [accompanyingCourseWorkEdit] improves hyphenation and line breaks for long badges +* [acompanyingCourse] improve Resume page + * complete all needed informations, + * actions and activities are clickables, + * better placement with js masonry blocks on top of content area, + * https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/101 + * https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/295 +* [activity/calendar] on show page, concerned groups of persons table adapt itself to isVisibles options * [activity] remove the "plus" button in activity list * [activity] check ACL on activity list in person context * [list for accompanying course in person] filter list using ACL * [validation] toasts are displayed for errors when modifying accompanying course (generalization required). +* [period] only the user can enable confidentiality * add an endpoint for checking permissions. See https://gitlab.com/Chill-Projet/chill-bundles/-/merge_requests/232 - -## Test releases +* [activity] for a new activity: suggest and create on-the-fly locations based on the accompanying course location + location of the suggested parties +* [calendar] for a new rdv: suggest and create on-the-fly locations based on the accompanying course location + location of the suggested parties ### Test release 2021-11-22 @@ -52,7 +78,7 @@ and this project adheres to * [accompanyingCourse] Ability to close accompanying course (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/296) * [task] Select2 field in task form to allow search for a user (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/167) * [list result] show all courses, except ones with period closed - +* [accompanyingCourse] improve banner with small carousel to display slide social-issues or slide associated persons (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/69) ### Test release 2021-11-15 diff --git a/CONVENTIONS.md b/CONVENTIONS.md index 4dcdb08ea..2543e54b7 100644 --- a/CONVENTIONS.md +++ b/CONVENTIONS.md @@ -56,28 +56,28 @@ Arborescence: Comment s'échaffaudent les styles dans Chill ? -1. l'entrypoint **mod_bootstrap** (module bootstrap) est le premier niveau. Toutes les parties(modules) de bootstrap sont convoquées dans le fichier ```bootstrap.js``` situé dans ```ChillMainBundle/Resources/public/module/bootstrap```. - * Au début, ce fichier importe le fichier ```variables.scss``` qui détermine la plupart des réglages bootstrap tels qu'on les a personnalisés. Ce fichier surcharge l'original, et de nombreuses variables y sont adaptées pour Chill. +1. l'entrypoint **mod_bootstrap** (module bootstrap) est le premier niveau. Toutes les parties(modules) de bootstrap sont convoquées dans le fichier ```bootstrap.js``` situé dans ```ChillMainBundle/Resources/public/module/bootstrap```. + * Au début, ce fichier importe le fichier ```variables.scss``` qui détermine la plupart des réglages bootstrap tels qu'on les a personnalisés. Ce fichier surcharge l'original, et de nombreuses variables y sont adaptées pour Chill. * On veillera à ce qu'on puisse toujours comparer ce fichier à l'original de bootstrap. En cas de mise à jour de bootstrap, il faudra générer un diff, et adapter ce diff sur le fichier variable de la nouvelle version. - * A la fin on importe le fichier ```custom.scss```, qui comprends des adaptations de bootstrap pour le préparer à notre thème Chill. + * A la fin on importe le fichier ```custom.scss```, qui comprends des adaptations de bootstrap pour le préparer à notre thème Chill. * ce ```custom.scss``` peut être splitté en plus petits fichiers avec des ```@import 'custom/...'``` * L'idée est que cette première couche bootstrap règle un partie importante des styles de l'application, en particulier ce qui touche aux position du layout, aux points de bascules responsive, aux marges et écarts appliqués par défauts aux éléments qu'on manipule. 2. l'entrypoint **chill** est le second niveau. Il contient le thème Chill qui est reconnaissable à l'application. * Chaque bundle a un dossier ```Resources/public/chill``` dans lequel on peut trouver une feuille sass principale, qui est éventuellement splittée avec des ```@imports```. Toutes ces feuilles sont compilées dans un unique entrypoint Chill, c'est le thème de l'application. Celui-ci surcharge bootstrap. - * La feuille chillmain.scss devrait contenir les cascades de styles les plus générales, celles qui sont appliquées à de nombreux endroits de l'application. + * La feuille chillmain.scss devrait contenir les cascades de styles les plus générales, celles qui sont appliquées à de nombreux endroits de l'application. * La feuille chillperson.scss va aussi retrouver des styles propres aux différents contextes des personnes: person, household et accompanyingcourse. * Certains bundles plus secondaires ne contiennent que des styles spécifiques à leur fonctionnement. 3. les entrypoints **vue_** sont utilisés pour des composants vue. Les fichiers vue peuvent contenir un bloc de styles scss. Ce sont des styles qui ne concernent que le composant et son héritage, le tag ```scoped``` précise justement sa portée (voir la doc). -4. les entrypoints **page_** sont utilisés pour ajouter des assets spécifiques à certaines pages, le plus souvent des scripts et des styles. +4. les entrypoints **page_** sont utilisés pour ajouter des assets spécifiques à certaines pages, le plus souvent des scripts et des styles. ## Taguer du code html et construire la cascade de styles L'exemple suivant montre comment taguer sans excès un élément de code. On remarque que: -* il n'est pas nécessaire de taguer toutes les classes intérieures, +* il n'est pas nécessaire de taguer toutes les classes intérieures, * il ne faut pas répéter la classe parent dans toutes les classes enfants. La cascade sass va permettre de saisir le html avec souplesse sans alourdir la structure des balises. * souvent la première classe sera déclinée par plusieurs classes qui commencent de la même manière: ```bloc-dark``` ajoute juste la version sombre de ```bloc```, on ne met pas ```bloc dark```, car on ne souhaite pas que la classe ```dark``` de ```bloc``` interagisse avec la même classe ```dark``` de ```table```. On aura donc un élément ```bloc bloc-dark``` et un élément ```table table-dark```. @@ -94,11 +94,11 @@ L'exemple suivant montre comment taguer sans excès un élément de code. On rem ``` -Finalement, il importe ici de définir ce qu'est un bloc, ce qu'est une zone d'actions et ce qu'est un bouton. Ces 3 éléments existent de manière autonome, ce sont les seuls qu'on tagge. +Finalement, il importe ici de définir ce qu'est un bloc, ce qu'est une zone d'actions et ce qu'est un bouton. Ces 3 éléments existent de manière autonome, ce sont les seuls qu'on tagge. Par exemple pour mettre un style au titre on précise juste h3 dans la cascade bloc. -```sass +```scss div.bloc { // un bloc générique, utilisé à plusieurs endroits &.bloc-dark { @@ -113,12 +113,12 @@ div.bloc { } } div.mon-bloc { - // des exceptions spécifiques à mon-bloc, + // des exceptions spécifiques à mon-bloc, // qui sont des adaptations de bloc } ul.record_actions { - // va uniformiser tous les record_actions de l'application + // va uniformiser tous les record_actions de l'application li { //... } @@ -260,7 +260,7 @@ Exemple: address|chill_entity_render_box ``` -Justification: +Justification: * des éléments sont parfois personnalisés par installation (par exemple, le nom de chaque utilisateur sera suivi par le nom du service) * pour rationaliser et rendre semblable les affichages @@ -270,13 +270,13 @@ A prevoir: * toujours trois positions: * inline - * block + * block * item (dans un tableau, une ligne) > block et item sont en fait la même option passée au render_box: render: bloc. Il y a aussi ‘raw’ pour le inline, et ‘label’ pour une titraille configurable avec des options. -> quand on passe l’option render: bloc, on peut placer le render_box dans une boucle for plus large qui fonctionne avec la classe flex-table ou la classe flex-bloc, ce qui donnera un affichage en rangée (table) ou en blocs. [name=Mathieu] - +> quand on passe l’option render: bloc, on peut placer le render_box dans une boucle for plus large qui fonctionne avec la classe flex-table ou la classe flex-bloc, ce qui donnera un affichage en rangée (table) ou en blocs. [name=Mathieu] + #### En vue @@ -292,13 +292,13 @@ A chaque fois qu'on indique le nom d'une personne, un parcours, un ménage, il y Ces éléments sont toujours proposé par des `render_box` par défaut. Des options permettent de les désactiver dans des cas particuliers -> à discuter, quelques réflexion: -> quelle est la logique qui domine pour les boutons ? on a symbolisé les 4 actions du crud par des couleurs: bleu(show) orange(edit) vert(create) et rouge(delete). -> Est-ce que c'est ça qui prime, et comment ça s'articule avec la logique des pictos ? +> à discuter, quelques réflexion: +> quelle est la logique qui domine pour les boutons ? on a symbolisé les 4 actions du crud par des couleurs: bleu(show) orange(edit) vert(create) et rouge(delete). +> Est-ce que c'est ça qui prime, et comment ça s'articule avec la logique des pictos ? > Par exemple, il pourrait être logique d'utiliser l'oeil bleu pour voir l'objet, qu'il s'agisse d'une personne ou d'un parcours, ce serait plutôt le contexte, et l'infobulle (title) qui préciserait le contexte. > Je pense que les pictos de boutons doivent faire référence à l'action, mais pas à l'objet. Autrement dit je n'utiliserais jamais l'icone du ménage ou du parcours dans les boutons. > Pour représenter les ménages et les parcours, je pense qu'il faudrait trouver autre chose que forkawesome. Si c'est des pictos, trouver un motif différents et de tailles différente. Réfléchir à un couplage picto-couleur-forme différent, qui exprime le contexte et qui se distingue bien des boutons. -> Idem pour les badges, il faut une palette de badge qui couvre tous les besoins: socialIssue, socialActions, socialReason, members, etc. [name=Mathieu] +> Idem pour les badges, il faut une palette de badge qui couvre tous les besoins: socialIssue, socialActions, socialReason, members, etc. [name=Mathieu] ### Formulaires @@ -350,7 +350,7 @@ A chaque fois qu'un élément est créé par un formulaire, un message flash doi > "L'élément a été créé" -Le nom de l'élément peut être remplacé par quelque chose de plus pertinent: +Le nom de l'élément peut être remplacé par quelque chose de plus pertinent: > * L'activité a été créée > * Le rendez-vous a été créé @@ -362,7 +362,7 @@ Le nom de l'élément peut être remplacé par quelque chose de plus pertinent: A chaque fois qu'un élément est enregistré, un message flash doit apparaitre: > * Les données ont été modifiées -> +> #### Erreur sur un formulaire (erreur de validation) @@ -377,7 +377,35 @@ Les erreurs doivent apparaitre attachée au champ qui les concerne. Toutefois, i A chaque fois qu'un lien est indiqué, vérifier si on ne doit pas utiliser la fonction `chill_return_path`, `chill_forward_return_path` ou `chill_return_path_or`. * depuis la page liste, vers l'ouverture d'un élément, ou le bouton création => utiliser `chill_path_add_return_path` -* dans ces pages d'éditions, +* dans ces pages d'éditions, * utiliser `chill_return_path_or` dans le bouton "Cancel"; * pour les boutons "enregistrer et voir" et "Enregistrer et fermer" => ? +### Assets pour les listes de suggestion + +Créer une liste de suggestions à ajouter (tout l'item est cliquable) +```html + +``` +Créer une liste de suggestions à enlever (avec une croix rouge cliquable, l'ancre a est vide) +```html + +``` +Créer un titre enlevable (avec une croix rouge cliquable, l'ancre a est vide) +```html +
+ title + +
+``` diff --git a/docs/source/_static/code/exports/BirthdateFilter.php b/docs/source/_static/code/exports/BirthdateFilter.php index 5ddcf3bfe..2c3cd765f 100644 --- a/docs/source/_static/code/exports/BirthdateFilter.php +++ b/docs/source/_static/code/exports/BirthdateFilter.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\PersonBundle\Export\Filter; use Chill\MainBundle\Export\ExportElementValidatedInterface; @@ -16,7 +18,7 @@ use Doctrine\ORM\Query\Expr; use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Validator\Context\ExecutionContextInterface; -class BirthdateFilter implements FilterInterface, ExportElementValidatedInterface +class BirthdateFilter implements ExportElementValidatedInterface, FilterInterface { // add specific role for this filter public function addRole() diff --git a/docs/source/_static/code/exports/CountPerson.php b/docs/source/_static/code/exports/CountPerson.php index 5ea9d6214..98c4fcd00 100644 --- a/docs/source/_static/code/exports/CountPerson.php +++ b/docs/source/_static/code/exports/CountPerson.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\PersonBundle\Export\Export; use Chill\MainBundle\Export\ExportInterface; @@ -89,7 +91,7 @@ class CountPerson implements ExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { // we gather all center the user choose. - $centers = array_map(function ($el) { return $el['center']; }, $acl); + $centers = array_map(static function ($el) { return $el['center']; }, $acl); $qb = $this->entityManager->createQueryBuilder(); diff --git a/docs/source/development/pagination/example.php b/docs/source/development/pagination/example.php index cd71649c9..ed91d16a7 100644 --- a/docs/source/development/pagination/example.php +++ b/docs/source/development/pagination/example.php @@ -7,11 +7,13 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\MyBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; -class ItemController extends Controller +class example extends Controller { public function yourAction() { diff --git a/docs/source/development/useful-snippets/controller-secured-for-person.php b/docs/source/development/useful-snippets/controller-secured-for-person.php index 126a8cad4..325b5da90 100644 --- a/docs/source/development/useful-snippets/controller-secured-for-person.php +++ b/docs/source/development/useful-snippets/controller-secured-for-person.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\HealthBundle\Controller; use Chill\HealthBundle\Security\Authorization\ConsultationVoter; @@ -25,7 +27,7 @@ class ConsultationController extends Controller */ public function listAction($id) { - /* @var $person \Chill\PersonBundle\Entity\Person */ + /** @var \Chill\PersonBundle\Entity\Person $person */ $person = $this->get('chill.person.repository.person') ->find($id); @@ -35,7 +37,7 @@ class ConsultationController extends Controller $this->denyAccessUnlessGranted(PersonVoter::SEE, $person); - /* @var $authorizationHelper \Chill\MainBundle\Security\Authorization\AuthorizationHelper */ + /** @var \Chill\MainBundle\Security\Authorization\AuthorizationHelper $authorizationHelper */ $authorizationHelper = $this->get('chill.main.security.' . 'authorization.helper'); diff --git a/docs/source/development/user-interface/widgets/ChillMainConfiguration.php b/docs/source/development/user-interface/widgets/ChillMainConfiguration.php index 7d8964903..2786b3376 100644 --- a/docs/source/development/user-interface/widgets/ChillMainConfiguration.php +++ b/docs/source/development/user-interface/widgets/ChillMainConfiguration.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\MainBundle\DependencyInjection; use Chill\MainBundle\DependencyInjection\Widget\AddWidgetConfigurationTrait; @@ -17,7 +19,7 @@ namespace Chill\MainBundle\DependencyInjection; /** * Configure the main bundle. */ - class Configuration implements ConfigurationInterface + class ChillMainConfiguration implements ConfigurationInterface { use AddWidgetConfigurationTrait; @@ -27,7 +29,7 @@ namespace Chill\MainBundle\DependencyInjection; private $containerBuilder; public function __construct( - array $widgetFactories = [], + array $widgetFactories, ContainerBuilder $containerBuilder ) { // we register here widget factories (see below) diff --git a/docs/source/development/user-interface/widgets/ChillMainExtension.php b/docs/source/development/user-interface/widgets/ChillMainExtension.php index 1a784fd5f..e054ebca1 100644 --- a/docs/source/development/user-interface/widgets/ChillMainExtension.php +++ b/docs/source/development/user-interface/widgets/ChillMainExtension.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\MainBundle\DependencyInjection; use Chill\MainBundle\DependencyInjection\Widget\Factory\WidgetFactoryInterface; diff --git a/docs/source/development/user-interface/widgets/ChillPersonAddAPersonListWidgetFactory.php b/docs/source/development/user-interface/widgets/ChillPersonAddAPersonListWidgetFactory.php index f3a93a3e6..31121c253 100644 --- a/docs/source/development/user-interface/widgets/ChillPersonAddAPersonListWidgetFactory.php +++ b/docs/source/development/user-interface/widgets/ChillPersonAddAPersonListWidgetFactory.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\PersonBundle\Widget; use Chill\MainBundle\DependencyInjection\Widget\Factory\AbstractWidgetFactory; @@ -16,7 +18,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; /** * add configuration for the person_list widget. */ -class PersonListWidgetFactory extends AbstractWidgetFactory +class ChillPersonAddAPersonListWidgetFactory extends AbstractWidgetFactory { /* * append the option to the configuration @@ -36,8 +38,8 @@ class PersonListWidgetFactory extends AbstractWidgetFactory ->end(); } - /* - * return an array with the allowed places where the widget can be rendered + /** + * return an array with the allowed places where the widget can be rendered. * * @return string[] */ @@ -59,8 +61,8 @@ class PersonListWidgetFactory extends AbstractWidgetFactory return 'chill_person.widget.person_list'; } - /* - * return the widget alias + /** + * return the widget alias. * * @return string */ diff --git a/docs/source/development/user-interface/widgets/ChillPersonAddAPersonWidget.php b/docs/source/development/user-interface/widgets/ChillPersonAddAPersonWidget.php index d74c7936b..266682e3b 100644 --- a/docs/source/development/user-interface/widgets/ChillPersonAddAPersonWidget.php +++ b/docs/source/development/user-interface/widgets/ChillPersonAddAPersonWidget.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\PersonBundle\Widget; use Chill\MainBundle\Security\Authorization\AuthorizationHelper; @@ -27,7 +29,7 @@ use Twig_Environment; * * The configuration is defined by `PersonListWidgetFactory` */ -class PersonListWidget implements WidgetInterface +class ChillPersonAddAPersonWidget implements WidgetInterface { /** * the authorization helper. diff --git a/docs/source/development/user-interface/widgets/ChillPersonExtension.php b/docs/source/development/user-interface/widgets/ChillPersonExtension.php index b5ed095a0..66b01792a 100644 --- a/docs/source/development/user-interface/widgets/ChillPersonExtension.php +++ b/docs/source/development/user-interface/widgets/ChillPersonExtension.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\PersonBundle\DependencyInjection; use Symfony\Component\DependencyInjection\ContainerBuilder; diff --git a/grumphp.yml b/grumphp.yml index fd2bfea8b..d25cc01ba 100644 --- a/grumphp.yml +++ b/grumphp.yml @@ -9,6 +9,6 @@ parameters: tasks.license.holder: Champs-Libres tasks.license.date_from: 2001 - tasks.phpcsfixer.allow_risky: false + tasks.phpcsfixer.allow_risky: true tasks.phpcsfixer.diff: true tasks.phpstan.level: 1 diff --git a/phpstan-critical.neon b/phpstan-critical.neon index 6147f2022..b214654bf 100644 --- a/phpstan-critical.neon +++ b/phpstan-critical.neon @@ -70,11 +70,6 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php - - - message: "#^Undefined variable\\: \\$value$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php - - message: "#^Undefined variable\\: \\$choiceSlug$#" count: 1 diff --git a/phpstan-deprecations.neon b/phpstan-deprecations.neon index 6f9f19956..1e762ce9e 100644 --- a/phpstan-deprecations.neon +++ b/phpstan-deprecations.neon @@ -1,15 +1,5 @@ parameters: ignoreErrors: - - - message: "#^Call to deprecated method getType\\(\\) of class Chill\\\\ActivityBundle\\\\Entity\\\\Activity\\.$#" - count: 3 - path: src/Bundle/ChillActivityBundle/Controller/ActivityController.php - - - - message: "#^Call to deprecated method setType\\(\\) of class Chill\\\\ActivityBundle\\\\Entity\\\\Activity\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Controller/ActivityController.php - - message: """ diff --git a/phpstan-types.neon b/phpstan-types.neon index a91800d99..98d17b666 100644 --- a/phpstan-types.neon +++ b/phpstan-types.neon @@ -1,15 +1,5 @@ parameters: ignoreErrors: - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivitytACL.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Entity/Activity.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 @@ -20,11 +10,6 @@ parameters: count: 1 path: src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php - - message: "#^Method Chill\\\\ActivityBundle\\\\Export\\\\Export\\\\StatActivityDuration\\:\\:getDescription\\(\\) should return string but return statement is missing\\.$#" count: 1 @@ -35,11 +20,6 @@ parameters: count: 1 path: src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Form/ActivityType.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 @@ -55,36 +35,6 @@ parameters: count: 2 path: src/Bundle/ChillActivityBundle/Form/ActivityType.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Security/Authorization/ActivityStatsVoter.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" count: 3 @@ -95,36 +45,16 @@ parameters: count: 2 path: src/Bundle/ChillBudgetBundle/Form/ResourceType.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillCalendarBundle/Entity/Calendar.php - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" count: 1 path: src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 path: src/Bundle/ChillCustomFieldsBundle/CustomFields/AbstractCustomField.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 3 - path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 4 @@ -190,21 +120,11 @@ parameters: count: 1 path: src/Bundle/ChillDocStoreBundle/Entity/DocumentCategory.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillEventBundle/Entity/Participation.php - - message: "#^Method Chill\\\\EventBundle\\\\Entity\\\\Participation\\:\\:offsetGet\\(\\) should return mixed but return statement is missing\\.$#" count: 1 path: src/Bundle/ChillEventBundle/Entity/Participation.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 @@ -225,11 +145,6 @@ parameters: count: 1 path: src/Bundle/ChillEventBundle/Form/StatusType.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillEventBundle/Form/Type/PickEventType.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 2 @@ -240,16 +155,6 @@ parameters: count: 1 path: src/Bundle/ChillEventBundle/Search/EventSearch.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Bundle/ChillEventBundle/Security/Authorization/EventVoter.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Bundle/ChillEventBundle/Security/Authorization/ParticipationVoter.php - - message: "#^Casting to string something that's already string\\.$#" count: 5 @@ -260,11 +165,6 @@ parameters: count: 2 path: src/Bundle/ChillFamilyMembersBundle/Form/FamilyMemberType.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Bundle/ChillFamilyMembersBundle/Security/Voter/FamilyMemberVoter.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 @@ -285,16 +185,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/CRUD/Resolver/Resolver.php - - - message: "#^Call to function array_search\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php - - message: "#^Method Chill\\\\MainBundle\\\\Command\\\\ChillImportUsersCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#" count: 1 @@ -305,11 +195,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 @@ -320,11 +205,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php - - message: "#^Method Chill\\\\MainBundle\\\\Command\\\\LoadAndUpdateLanguagesCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#" count: 1 @@ -360,36 +240,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Controller/PostalCodeController.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php - - - - message: "#^Call to function array_search\\(\\) requires parameter \\#3 to be set\\.$#" - count: 5 - path: src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/ExportsCompilerPass.php - - - - message: "#^Call to function array_search\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/SearchableServicesCompilerPass.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php - - - - message: "#^Call to function array_search\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 @@ -405,21 +255,11 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Entity/User.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 path: src/Bundle/ChillMainBundle/Entity/User.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 6 - path: src/Bundle/ChillMainBundle/Export/ExportManager.php - - message: "#^Only booleans are allowed in a ternary operator condition, mixed given\\.$#" count: 1 @@ -450,11 +290,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Form/Type/ChillTextareaType.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 3 @@ -465,51 +300,16 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Form/Type/TranslatableStringFormType.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 2 path: src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Bundle/ChillMainBundle/Security/ParentRoleHelper.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 path: src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverVoter.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 @@ -530,21 +330,11 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 path: src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 @@ -570,51 +360,16 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php - - - message: "#^Call to function array_search\\(\\) requires parameter \\#3 to be set\\.$#" - count: 3 - path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 3 - path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 6 path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Controller/PersonController.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/DependencyInjection/CompilerPass/AccompanyingPeriodTimelineCompilerPass.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Entity/Person.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 2 path: src/Bundle/ChillPersonBundle/Entity/PersonPhone.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Bundle/ChillPersonBundle/Export/AbstractAccompanyingPeriodExportElement.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 @@ -625,26 +380,11 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Export/Aggregator/NationalityAggregator.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 3 - path: src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 2 path: src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Export/Filter/GenderFilter.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 @@ -665,26 +405,11 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Form/Type/PickPersonType.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Household/MembersEditor.php - - message: "#^Method Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\AccompanyingPeriodWorkRepository\\:\\:buildQueryBySocialActionWithDescendants\\(\\) has invalid return type Chill\\\\PersonBundle\\\\Repository\\\\AccompanyingPeriod\\\\QueryBuilder\\.$#" count: 1 path: src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 2 - path: src/Bundle/ChillPersonBundle/Repository/PersonRepository.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 3 @@ -695,71 +420,26 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Search/PersonSearch.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Search/SearchPersonApiProvider.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 2 path: src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillPersonBundle/Timeline/AbstractTimelineAccompanyingPeriod.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReportACL.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php - - message: "#^Method Chill\\\\ReportBundle\\\\DataFixtures\\\\ORM\\\\LoadReports\\:\\:getRandomChoice\\(\\) should return array\\\\|string but return statement is missing\\.$#" count: 1 path: src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 4 - path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 2 path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillReportBundle/Security/Authorization/ReportVoter.php - - message: "#^Method Chill\\\\ReportBundle\\\\Security\\\\Authorization\\\\ReportVoter\\:\\:supports\\(\\) should return bool but return statement is missing\\.$#" count: 1 path: src/Bundle/ChillReportBundle/Security/Authorization/ReportVoter.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 4 - path: src/Bundle/ChillReportBundle/Timeline/TimelineReportProvider.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillTaskBundle/DataFixtures/ORM/LoadTaskACL.php - - message: "#^Casting to string something that's already string\\.$#" count: 3 @@ -785,31 +465,11 @@ parameters: count: 1 path: src/Bundle/ChillTaskBundle/Timeline/SingleTaskTaskLifeCycleEventTimelineProvider.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php - - message: "#^Method Chill\\\\TaskBundle\\\\Timeline\\\\TaskLifeCycleEventTimelineProvider\\:\\:getTransitionByName\\(\\) should return Symfony\\\\Component\\\\Workflow\\\\Transition but return statement is missing\\.$#" count: 1 path: src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillThirdPartyBundle/DependencyInjection/CompilerPass/ThirdPartyTypeCompilerPass.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 4 - path: src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php - - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillThirdPartyBundle/Form/ChoiceLoader/ThirdPartyChoiceLoader.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 @@ -820,11 +480,6 @@ parameters: count: 1 path: src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 @@ -835,11 +490,6 @@ parameters: count: 1 path: src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php - - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" - count: 1 - path: src/Bundle/ChillThirdPartyBundle/Security/Voter/ThirdPartyVoter.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 diff --git a/src/Bundle/ChillActivityBundle/ChillActivityBundle.php b/src/Bundle/ChillActivityBundle/ChillActivityBundle.php index f449ac07f..21245504f 100644 --- a/src/Bundle/ChillActivityBundle/ChillActivityBundle.php +++ b/src/Bundle/ChillActivityBundle/ChillActivityBundle.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index f4248b5e8..863190a9f 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -39,6 +39,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Serializer\SerializerInterface; +use function array_key_exists; final class ActivityController extends AbstractController { @@ -105,18 +106,19 @@ final class ActivityController extends AbstractController [$person, $accompanyingPeriod] = $this->getEntity($request); - if ($accompanyingPeriod instanceof AccompanyingPeriod) { - $view = 'ChillActivityBundle:Activity:confirm_deleteAccompanyingCourse.html.twig'; - } elseif ($person instanceof Person) { - $view = 'ChillActivityBundle:Activity:confirm_deletePerson.html.twig'; - } - $activity = $this->activityRepository->find($id); if (!$activity) { throw $this->createNotFoundException('Unable to find Activity entity.'); } + if ($activity->getAccompanyingPeriod() instanceof AccompanyingPeriod) { + $view = 'ChillActivityBundle:Activity:confirm_deleteAccompanyingCourse.html.twig'; + $accompanyingPeriod = $activity->getAccompanyingPeriod(); + } else { + $view = 'ChillActivityBundle:Activity:confirm_deletePerson.html.twig'; + } + // TODO // $this->denyAccessUnlessGranted('CHILL_ACTIVITY_DELETE', $activity); @@ -137,7 +139,7 @@ final class ActivityController extends AbstractController static fn (ActivityReason $ar): int => $ar->getId() ) ->toArray(), - 'type_id' => $activity->getType()->getId(), + 'type_id' => $activity->getActivityType()->getId(), 'duration' => $activity->getDurationTime() ? $activity->getDurationTime()->format('U') : null, 'date' => $activity->getDate()->format('Y-m-d'), 'attendee' => $activity->getAttendee(), @@ -176,25 +178,25 @@ final class ActivityController extends AbstractController [$person, $accompanyingPeriod] = $this->getEntity($request); - if ($accompanyingPeriod instanceof AccompanyingPeriod) { - $view = 'ChillActivityBundle:Activity:editAccompanyingCourse.html.twig'; - } elseif ($person instanceof Person) { - $view = 'ChillActivityBundle:Activity:editPerson.html.twig'; - } - $entity = $this->activityRepository->find($id); if (null === $entity) { throw $this->createNotFoundException('Unable to find Activity entity.'); } + if ($entity->getAccompanyingPeriod() instanceof AccompanyingPeriod) { + $view = 'ChillActivityBundle:Activity:editAccompanyingCourse.html.twig'; + $accompanyingPeriod = $entity->getAccompanyingPeriod(); + } else { + $view = 'ChillActivityBundle:Activity:editPerson.html.twig'; + } // TODO // $this->denyAccessUnlessGranted('CHILL_ACTIVITY_UPDATE', $entity); $form = $this->createForm(ActivityType::class, $entity, [ 'center' => $entity->getCenter(), 'role' => new Role('CHILL_ACTIVITY_UPDATE'), - 'activityType' => $entity->getType(), + 'activityType' => $entity->getActivityType(), 'accompanyingPeriod' => $accompanyingPeriod, ])->handleRequest($request); @@ -327,7 +329,7 @@ final class ActivityController extends AbstractController $entity->setAccompanyingPeriod($accompanyingPeriod); } - $entity->setType($activityType); + $entity->setActivityType($activityType); $entity->setDate(new DateTime('now')); if ($request->query->has('activityData')) { @@ -385,7 +387,7 @@ final class ActivityController extends AbstractController $form = $this->createForm(ActivityType::class, $entity, [ 'center' => $entity->getCenter(), 'role' => new Role('CHILL_ACTIVITY_CREATE'), - 'activityType' => $entity->getType(), + 'activityType' => $entity->getActivityType(), 'accompanyingPeriod' => $accompanyingPeriod, ])->handleRequest($request); @@ -408,7 +410,7 @@ final class ActivityController extends AbstractController $activity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']); - $defaultLocationId = $this->getUser()->getCurrentLocation()->getId(); + $defaultLocation = $this->getUser()->getCurrentLocation(); return $this->render($view, [ 'person' => $person, @@ -416,7 +418,7 @@ final class ActivityController extends AbstractController 'entity' => $entity, 'form' => $form->createView(), 'activity_json' => $activity_array, - 'default_location_id' => $defaultLocationId, + 'default_location' => $defaultLocation, ]); } diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php index a748641a8..7da49a823 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Controller; use Chill\ActivityBundle\Entity\ActivityReasonCategory; diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php index 6c48229de..c656fe7a7 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Controller; use Chill\ActivityBundle\Entity\ActivityReason; diff --git a/src/Bundle/ChillActivityBundle/Controller/AdminActivityPresenceController.php b/src/Bundle/ChillActivityBundle/Controller/AdminActivityPresenceController.php index 4bcdcbed5..790f59be4 100644 --- a/src/Bundle/ChillActivityBundle/Controller/AdminActivityPresenceController.php +++ b/src/Bundle/ChillActivityBundle/Controller/AdminActivityPresenceController.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Controller; use Chill\MainBundle\CRUD\Controller\CRUDController; diff --git a/src/Bundle/ChillActivityBundle/Controller/AdminActivityTypeCategoryController.php b/src/Bundle/ChillActivityBundle/Controller/AdminActivityTypeCategoryController.php index 8af556cb2..48d91aedf 100644 --- a/src/Bundle/ChillActivityBundle/Controller/AdminActivityTypeCategoryController.php +++ b/src/Bundle/ChillActivityBundle/Controller/AdminActivityTypeCategoryController.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Controller; use Chill\MainBundle\CRUD\Controller\CRUDController; diff --git a/src/Bundle/ChillActivityBundle/Controller/AdminActivityTypeController.php b/src/Bundle/ChillActivityBundle/Controller/AdminActivityTypeController.php index 140a0b855..f8b19ec9f 100644 --- a/src/Bundle/ChillActivityBundle/Controller/AdminActivityTypeController.php +++ b/src/Bundle/ChillActivityBundle/Controller/AdminActivityTypeController.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Controller; use Chill\MainBundle\CRUD\Controller\CRUDController; @@ -23,6 +25,7 @@ class AdminActivityTypeController extends CRUDController protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator) { /** @var \Doctrine\ORM\QueryBuilder $query */ - return $query->orderBy('e.ordering', 'ASC'); + return $query->orderBy('e.ordering', 'ASC') + ->addOrderBy('e.id', 'ASC'); } } diff --git a/src/Bundle/ChillActivityBundle/Controller/AdminController.php b/src/Bundle/ChillActivityBundle/Controller/AdminController.php index 16de242fb..5a658c165 100644 --- a/src/Bundle/ChillActivityBundle/Controller/AdminController.php +++ b/src/Bundle/ChillActivityBundle/Controller/AdminController.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; diff --git a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php index 0da266251..72a88a72d 100644 --- a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php +++ b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\DataFixtures\ORM; use Chill\ActivityBundle\Entity\Activity; @@ -48,7 +50,7 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface ->findAll(); foreach ($persons as $person) { - $activityNbr = rand(0, 3); + $activityNbr = mt_rand(0, 3); for ($i = 0; $i < $activityNbr; ++$i) { $activity = $this->newRandomActivity($person); @@ -73,7 +75,7 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface // ->setAttendee($this->faker->boolean()) - for ($i = 0; rand(0, 4) > $i; ++$i) { + for ($i = 0; mt_rand(0, 4) > $i; ++$i) { $reason = $this->getRandomActivityReason(); if (null !== $reason) { diff --git a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityNotifications.php b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityNotifications.php index 38ea21c1f..63eeb965c 100644 --- a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityNotifications.php +++ b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityNotifications.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\DataFixtures\ORM; use Chill\ActivityBundle\Entity\Activity; diff --git a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityReason.php b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityReason.php index f840c988b..1904bbcb4 100644 --- a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityReason.php +++ b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityReason.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\DataFixtures\ORM; use Chill\ActivityBundle\Entity\ActivityReason; diff --git a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityReasonCategory.php b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityReasonCategory.php index 72f93e411..e62080aea 100644 --- a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityReasonCategory.php +++ b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityReasonCategory.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\DataFixtures\ORM; use Chill\ActivityBundle\Entity\ActivityReasonCategory; diff --git a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityType.php b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityType.php index 6c641aceb..c6031b95d 100644 --- a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityType.php +++ b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityType.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\DataFixtures\ORM; use Chill\ActivityBundle\Entity\ActivityType; diff --git a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityTypeCategory.php b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityTypeCategory.php index e98a9bb7d..20035b557 100644 --- a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityTypeCategory.php +++ b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivityTypeCategory.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\DataFixtures\ORM; use Chill\ActivityBundle\Entity\ActivityTypeCategory; diff --git a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivitytACL.php b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivitytACL.php index 4893a87b3..cb2d46d49 100644 --- a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivitytACL.php +++ b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivitytACL.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\DataFixtures\ORM; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; @@ -17,6 +19,7 @@ use Chill\MainBundle\Entity\RoleScope; use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Persistence\ObjectManager; +use function in_array; /** * Add a role CHILL_ACTIVITY_UPDATE & CHILL_ACTIVITY_CREATE for all groups except administrative, @@ -47,7 +50,7 @@ class LoadActivitytACL extends AbstractFixture implements OrderedFixtureInterfac case 'administrative': case 'direction': - if (in_array($scope->getName()['en'], ['administrative', 'social'])) { + if (in_array($scope->getName()['en'], ['administrative', 'social'], true)) { break 2; // we do not want any power on social or administrative } diff --git a/src/Bundle/ChillActivityBundle/DependencyInjection/ChillActivityExtension.php b/src/Bundle/ChillActivityBundle/DependencyInjection/ChillActivityExtension.php index 548d34a09..e1c657947 100644 --- a/src/Bundle/ChillActivityBundle/DependencyInjection/ChillActivityExtension.php +++ b/src/Bundle/ChillActivityBundle/DependencyInjection/ChillActivityExtension.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\DependencyInjection; use Chill\ActivityBundle\Security\Authorization\ActivityVoter; @@ -67,7 +69,7 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf ]); } - /* (non-PHPdoc) + /** (non-PHPdoc). * @see \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface::prepend() */ public function prependRoutes(ContainerBuilder $container) diff --git a/src/Bundle/ChillActivityBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillActivityBundle/DependencyInjection/Configuration.php index dd23a9b8b..f4b9d177c 100644 --- a/src/Bundle/ChillActivityBundle/DependencyInjection/Configuration.php +++ b/src/Bundle/ChillActivityBundle/DependencyInjection/Configuration.php @@ -7,10 +7,13 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\DependencyInjection; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; +use function is_int; /** * This is the class that validates and merges configuration from your app/config files. @@ -55,7 +58,7 @@ class Configuration implements ConfigurationInterface ->info('The number of seconds of this duration. Must be an integer.') ->cannotBeEmpty() ->validate() - ->ifTrue(function ($data) { + ->ifTrue(static function ($data) { return !is_int($data); })->thenInvalid('The value %s is not a valid integer') ->end() diff --git a/src/Bundle/ChillActivityBundle/Entity/Activity.php b/src/Bundle/ChillActivityBundle/Entity/Activity.php index 85abed5e5..183b56225 100644 --- a/src/Bundle/ChillActivityBundle/Entity/Activity.php +++ b/src/Bundle/ChillActivityBundle/Entity/Activity.php @@ -7,8 +7,11 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Entity; +use Chill\ActivityBundle\Validator\Constraints as ActivityValidator; use Chill\DocStoreBundle\Entity\Document; use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; @@ -17,6 +20,7 @@ use Chill\MainBundle\Entity\HasScopeInterface; use Chill\MainBundle\Entity\Location; use Chill\MainBundle\Entity\Scope; use Chill\MainBundle\Entity\User; +use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency; use Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodLinkedWithSocialIssuesEntityInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\Person; @@ -41,17 +45,14 @@ use Symfony\Component\Serializer\Annotation\SerializedName; * @DiscriminatorMap(typeProperty="type", mapping={ * "activity": Activity::class * }) - */ - -/* - * TODO : revoir + * @ActivityValidator\ActivityValidity + * * @UserCircleConsistency( - * "CHILL_ACTIVITY_SEE_DETAILS", - * getUserFunction="getUser", - * path="scope") + * "CHILL_ACTIVITY_SEE_DETAILS", + * getUserFunction="getUser", + * path="scope") */ - -class Activity implements HasCenterInterface, HasScopeInterface, AccompanyingPeriodLinkedWithSocialIssuesEntityInterface +class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, HasCenterInterface, HasScopeInterface { public const SENTRECEIVED_RECEIVED = 'received'; @@ -202,7 +203,9 @@ class Activity implements HasCenterInterface, HasScopeInterface, AccompanyingPer public function addPerson(?Person $person): self { if (null !== $person) { - $this->persons[] = $person; + if (!$this->persons->contains($person)) { + $this->persons[] = $person; + } } return $this; @@ -236,7 +239,9 @@ class Activity implements HasCenterInterface, HasScopeInterface, AccompanyingPer public function addThirdParty(?ThirdParty $thirdParty): self { if (null !== $thirdParty) { - $this->thirdParties[] = $thirdParty; + if (!$this->thirdParties->contains($thirdParty)) { + $this->thirdParties[] = $thirdParty; + } } return $this; @@ -245,7 +250,9 @@ class Activity implements HasCenterInterface, HasScopeInterface, AccompanyingPer public function addUser(?User $user): self { if (null !== $user) { - $this->users[] = $user; + if (!$this->users->contains($user)) { + $this->users[] = $user; + } } return $this; @@ -346,8 +353,9 @@ class Activity implements HasCenterInterface, HasScopeInterface, AccompanyingPer if (null !== $this->accompanyingPeriod) { $personsNotAssociated = []; + // TODO better semantic with: return $this->persons->filter(...); foreach ($this->persons as $person) { - if (!in_array($person, $this->getPersonsAssociated())) { + if ($this->accompanyingPeriod->getOpenParticipationContainsPerson($person) === null) { $personsNotAssociated[] = $person; } } diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php b/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php index 087469692..725b1eb8e 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Entity; use Doctrine\ORM\Mapping as ORM; diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php b/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php index 69adaf843..aed079aca 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Entity; use Doctrine\ORM\Mapping as ORM; diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php b/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php index 722cdaa08..f6d35b520 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Entity; use Doctrine\Common\Collections\ArrayCollection; diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php index 0e9b1150a..f0e412a8c 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php @@ -7,11 +7,14 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Entity; use Doctrine\ORM\Mapping as ORM; use InvalidArgumentException; use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Validator\Constraints as Assert; /** * Class ActivityType. @@ -29,11 +32,13 @@ class ActivityType public const FIELD_REQUIRED = 2; /** + * @deprecated not in use * @ORM\Column(type="string", nullable=false, options={"default": ""}) */ private string $accompanyingPeriodLabel = ''; /** + * @deprecated not in use * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) */ private int $accompanyingPeriodVisible = self::FIELD_INVISIBLE; @@ -195,16 +200,21 @@ class ActivityType /** * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) + * @Assert\EqualTo(propertyPath="socialIssuesVisible", message="This parameter must be equal to social issue parameter") */ private int $socialActionsVisible = self::FIELD_INVISIBLE; /** * @ORM\Column(type="string", nullable=false, options={"default": ""}) + * + * @deprecated not in use */ private string $socialDataLabel = ''; /** * @ORM\Column(type="smallint", nullable=false, options={"default": 1}) + * + * @deprecated not in use */ private int $socialDataVisible = self::FIELD_INVISIBLE; @@ -260,16 +270,6 @@ class ActivityType */ private int $userVisible = self::FIELD_REQUIRED; - public function getAccompanyingPeriodLabel(): string - { - return $this->accompanyingPeriodLabel; - } - - public function getAccompanyingPeriodVisible(): int - { - return $this->accompanyingPeriodVisible; - } - /** * Get active * return true if the type is active. @@ -446,16 +446,6 @@ class ActivityType return $this->socialActionsVisible; } - public function getSocialDataLabel(): string - { - return $this->socialDataLabel; - } - - public function getSocialDataVisible(): int - { - return $this->socialDataVisible; - } - public function getSocialIssuesLabel(): ?string { return $this->socialIssuesLabel; @@ -537,20 +527,6 @@ class ActivityType return self::FIELD_INVISIBLE !== $this->{$property}; } - public function setAccompanyingPeriodLabel(string $accompanyingPeriodLabel): self - { - $this->accompanyingPeriodLabel = $accompanyingPeriodLabel; - - return $this; - } - - public function setAccompanyingPeriodVisible(int $accompanyingPeriodVisible): self - { - $this->accompanyingPeriodVisible = $accompanyingPeriodVisible; - - return $this; - } - /** * Set active * set to true if the type is active. @@ -768,20 +744,6 @@ class ActivityType return $this; } - public function setSocialDataLabel(string $socialDataLabel): self - { - $this->socialDataLabel = $socialDataLabel; - - return $this; - } - - public function setSocialDataVisible(int $socialDataVisible): self - { - $this->socialDataVisible = $socialDataVisible; - - return $this; - } - public function setSocialIssuesLabel(string $socialIssuesLabel): self { $this->socialIssuesLabel = $socialIssuesLabel; diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php index 0a5b4904e..56306d90a 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php @@ -25,6 +25,8 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Validator\Context\ExecutionContextInterface; +use function array_key_exists; +use function count; class ActivityReasonAggregator implements AggregatorInterface, ExportElementValidatedInterface { @@ -72,7 +74,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali array_key_exists('activity', $join) && !$this->checkJoinAlreadyDefined($join['activity'], 'reasons') ) - or (!array_key_exists('activity', $join)) + || (!array_key_exists('activity', $join)) ) { $qb->add( 'join', diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php index 957e3e748..312456104 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Export\Aggregator; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; diff --git a/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php index 3409980e1..8fcb6ec6f 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php @@ -28,6 +28,8 @@ use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Validator\Constraints\Callback; use Symfony\Component\Validator\Context\ExecutionContextInterface; use function array_key_exists; +use function count; +use function in_array; class ListActivity implements ListInterface { @@ -73,7 +75,7 @@ class ListActivity implements ListInterface 'choices' => array_combine($this->fields, $this->fields), 'label' => 'Fields to include in export', 'constraints' => [new Callback([ - 'callback' => function ($selected, ExecutionContextInterface $context) { + 'callback' => static function ($selected, ExecutionContextInterface $context) { if (count($selected) === 0) { $context->buildViolation('You must select at least one element') ->atPath('fields') @@ -187,7 +189,7 @@ class ListActivity implements ListInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - $centers = array_map(function ($el) { return $el['center']; }, $acl); + $centers = array_map(static function ($el) { return $el['center']; }, $acl); // throw an error if any fields are present if (!array_key_exists('fields', $data)) { @@ -204,7 +206,7 @@ class ListActivity implements ListInterface ->setParameter('authorized_centers', $centers); foreach ($this->fields as $f) { - if (in_array($f, $data['fields'])) { + if (in_array($f, $data['fields'], true)) { switch ($f) { case 'id': $qb->addSelect('activity.id AS id'); diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php index fd207b22c..00a9ac382 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php @@ -89,7 +89,7 @@ class ActivityDateFilter implements FilterInterface ); $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { - /* @var $filterForm \Symfony\Component\Form\FormInterface */ + /** @var \Symfony\Component\Form\FormInterface $filterForm */ $filterForm = $event->getForm()->getParent(); $enabled = $filterForm->get(FilterType::ENABLED_FIELD)->getData(); diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php index b16d75837..ff0767116 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php @@ -25,8 +25,10 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Validator\Context\ExecutionContextInterface; +use function array_key_exists; +use function count; -class ActivityReasonFilter implements FilterInterface, ExportElementValidatedInterface +class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInterface { protected ActivityReasonRepository $activityReasonRepository; diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php index 78ebd794a..0b283632a 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php @@ -24,8 +24,9 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Validator\Context\ExecutionContextInterface; +use function count; -class ActivityTypeFilter implements FilterInterface, ExportElementValidatedInterface +class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInterface { protected ActivityTypeRepository $activityTypeRepository; diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/PersonHavingActivityBetweenDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/PersonHavingActivityBetweenDateFilter.php index 5338a0f21..55b1337bf 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/PersonHavingActivityBetweenDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/PersonHavingActivityBetweenDateFilter.php @@ -31,8 +31,9 @@ use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormInterface; use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface; +use function count; -class PersonHavingActivityBetweenDateFilter implements FilterInterface, ExportElementValidatedInterface +class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInterface, FilterInterface { protected ActivityReasonRepository $activityReasonRepository; @@ -134,7 +135,7 @@ class PersonHavingActivityBetweenDateFilter implements FilterInterface, ExportEl ]); $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { - /* @var FormInterface $filterForm */ + /** @var FormInterface $filterForm */ $filterForm = $event->getForm()->getParent(); $enabled = $filterForm->get(FilterType::ENABLED_FIELD)->getData(); diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityPresenceType.php b/src/Bundle/ChillActivityBundle/Form/ActivityPresenceType.php index 105812caa..5c467a575 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityPresenceType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityPresenceType.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Form; use Chill\ActivityBundle\Entity\ActivityPresence; diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityReasonCategoryType.php b/src/Bundle/ChillActivityBundle/Form/ActivityReasonCategoryType.php index 2f3589d7a..09cd5ad6e 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityReasonCategoryType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityReasonCategoryType.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Form; use Chill\MainBundle\Form\Type\TranslatableStringFormType; diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityReasonType.php b/src/Bundle/ChillActivityBundle/Form/ActivityReasonType.php index 38c65bb2a..01543d18c 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityReasonType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityReasonType.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Form; use Chill\ActivityBundle\Form\Type\TranslatableActivityReasonCategory; diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php index 5cba5ad57..d332acdcb 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Form; use Chill\ActivityBundle\Entity\Activity; @@ -46,6 +48,7 @@ use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use function in_array; class ActivityType extends AbstractType { @@ -124,7 +127,7 @@ class ActivityType extends AbstractType $builder->add('socialIssues', HiddenType::class); $builder->get('socialIssues') ->addModelTransformer(new CallbackTransformer( - function (iterable $socialIssuesAsIterable): string { + static function (iterable $socialIssuesAsIterable): string { $socialIssueIds = []; foreach ($socialIssuesAsIterable as $value) { @@ -150,7 +153,7 @@ class ActivityType extends AbstractType $builder->add('socialActions', HiddenType::class); $builder->get('socialActions') ->addModelTransformer(new CallbackTransformer( - function (iterable $socialActionsAsIterable): string { + static function (iterable $socialActionsAsIterable): string { $socialActionIds = []; foreach ($socialActionsAsIterable as $value) { @@ -202,7 +205,7 @@ class ActivityType extends AbstractType 'choice_label' => function (ActivityPresence $activityPresence) { return $this->translatableStringHelper->localize($activityPresence->getName()); }, - 'query_builder' => function (EntityRepository $er) { + 'query_builder' => static function (EntityRepository $er) { return $er->createQueryBuilder('a') ->where('a.active = true'); }, @@ -228,7 +231,7 @@ class ActivityType extends AbstractType return $this->translatableStringHelper->localize($activityReason->getName()); }, 'attr' => ['class' => 'select2 '], - 'query_builder' => function (EntityRepository $er) { + 'query_builder' => static function (EntityRepository $er) { return $er->createQueryBuilder('a') ->where('a.active = true'); }, @@ -247,7 +250,7 @@ class ActivityType extends AbstractType $builder->add('persons', HiddenType::class); $builder->get('persons') ->addModelTransformer(new CallbackTransformer( - function (iterable $personsAsIterable): string { + static function (iterable $personsAsIterable): string { $personIds = []; foreach ($personsAsIterable as $value) { @@ -269,7 +272,7 @@ class ActivityType extends AbstractType $builder->add('thirdParties', HiddenType::class); $builder->get('thirdParties') ->addModelTransformer(new CallbackTransformer( - function (iterable $thirdpartyAsIterable): string { + static function (iterable $thirdpartyAsIterable): string { $thirdpartyIds = []; foreach ($thirdpartyAsIterable as $value) { @@ -302,7 +305,7 @@ class ActivityType extends AbstractType $builder->add('users', HiddenType::class); $builder->get('users') ->addModelTransformer(new CallbackTransformer( - function (iterable $usersAsIterable): string { + static function (iterable $usersAsIterable): string { $userIds = []; foreach ($usersAsIterable as $value) { @@ -324,7 +327,7 @@ class ActivityType extends AbstractType $builder->add('location', HiddenType::class) ->get('location') ->addModelTransformer(new CallbackTransformer( - function (?Location $location): string { + static function (?Location $location): string { if (null === $location) { return ''; } @@ -364,7 +367,7 @@ class ActivityType extends AbstractType ->addModelTransformer($durationTimeTransformer); $builder->get($fieldName) - ->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $formEvent) use ( + ->addEventListener(FormEvents::PRE_SET_DATA, static function (FormEvent $formEvent) use ( $timeChoices, $builder, $durationTimeTransformer, @@ -374,7 +377,7 @@ class ActivityType extends AbstractType // set the timezone to GMT, and fix the difference between current and GMT // the datetimetransformer will then handle timezone as GMT $timezoneUTC = new DateTimeZone('GMT'); - /* @var $data \DateTime */ + /** @var DateTime $data */ $data = $formEvent->getData() === null ? DateTime::createFromFormat('U', 300) : $formEvent->getData(); @@ -384,7 +387,7 @@ class ActivityType extends AbstractType // test if the timestamp is in the choices. // If not, recreate the field with the new timestamp - if (!in_array($data->getTimestamp(), $timeChoices)) { + if (!in_array($data->getTimestamp(), $timeChoices, true)) { // the data are not in the possible values. add them $timeChoices[$data->format('H:i')] = $data->getTimestamp(); $form = $builder->create($fieldName, ChoiceType::class, array_merge( diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityTypeCategoryType.php b/src/Bundle/ChillActivityBundle/Form/ActivityTypeCategoryType.php index 081f8ac99..510d27913 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityTypeCategoryType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityTypeCategoryType.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Form; use Chill\ActivityBundle\Entity\ActivityTypeCategory; diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php b/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php index 300be5c4c..26148c340 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityTypeType.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Form; use Chill\ActivityBundle\Entity\ActivityTypeCategory; @@ -56,7 +58,7 @@ class ActivityTypeType extends AbstractType 'persons', 'user', 'date', 'place', 'persons', 'thirdParties', 'durationTime', 'travelTime', 'attendee', 'reasons', 'comment', 'sentReceived', 'documents', - 'emergency', 'accompanyingPeriod', 'socialData', 'users', + 'emergency', 'socialIssues', 'socialActions', 'users', ]; foreach ($fields as $field) { diff --git a/src/Bundle/ChillActivityBundle/Form/Type/ActivityFieldPresence.php b/src/Bundle/ChillActivityBundle/Form/Type/ActivityFieldPresence.php index 960762d35..5e0bd4561 100644 --- a/src/Bundle/ChillActivityBundle/Form/Type/ActivityFieldPresence.php +++ b/src/Bundle/ChillActivityBundle/Form/Type/ActivityFieldPresence.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Form\Type; use Chill\ActivityBundle\Entity\ActivityType; diff --git a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReason.php b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReason.php index 867c74b10..70b7e9b91 100644 --- a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReason.php +++ b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReason.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Form\Type; use Chill\ActivityBundle\Entity\ActivityReason; @@ -55,7 +57,7 @@ class TranslatableActivityReason extends AbstractType return null; }, - 'query_builder' => function (EntityRepository $er) { + 'query_builder' => static function (EntityRepository $er) { return $er->createQueryBuilder('r') ->where('r.active = true'); }, diff --git a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategory.php b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategory.php index b0b064927..2b501864f 100644 --- a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategory.php +++ b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityReasonCategory.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Form\Type; use Doctrine\ORM\EntityRepository; @@ -37,7 +39,7 @@ class TranslatableActivityReasonCategory extends AbstractType [ 'class' => 'ChillActivityBundle:ActivityReasonCategory', 'choice_label' => 'name[' . $locale . ']', - 'query_builder' => function (EntityRepository $er) { + 'query_builder' => static function (EntityRepository $er) { return $er->createQueryBuilder('c') ->where('c.active = true'); }, diff --git a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityType.php b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityType.php index 6b677ada2..dc6328709 100644 --- a/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/Type/TranslatableActivityType.php @@ -37,7 +37,7 @@ class TranslatableActivityType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { - /* @var QueryBuilder $qb */ + /** @var QueryBuilder $qb */ $qb = $options['query_builder']; if (true === $options['active_only']) { diff --git a/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php index 8c3ed58f3..b0e91a3a5 100644 --- a/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseMenuBuilder.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Menu; use Chill\ActivityBundle\Security\Authorization\ActivityVoter; diff --git a/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php index e4edb97fe..58b0825dc 100644 --- a/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php @@ -14,6 +14,7 @@ namespace Chill\ActivityBundle\Menu; use Chill\MainBundle\Routing\LocalMenuBuilderInterface; use Knp\Menu\MenuItem; use Symfony\Component\Security\Core\Security; +use function in_array; final class AdminMenuBuilder implements LocalMenuBuilderInterface { @@ -30,7 +31,7 @@ final class AdminMenuBuilder implements LocalMenuBuilderInterface return; } - if (in_array($menuId, ['admin_index', 'admin_section'])) { + if (in_array($menuId, ['admin_index', 'admin_section'], true)) { $menu->addChild('Activities', [ 'route' => 'chill_admin_activity_index', ]) diff --git a/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php index d5ae9c528..34b18f078 100644 --- a/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Menu; use Chill\ActivityBundle\Security\Authorization\ActivityVoter; @@ -37,7 +39,7 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface public function buildMenu($menuId, MenuItem $menu, array $parameters) { - /* @var $person \Chill\PersonBundle\Entity\Person */ + /** @var \Chill\PersonBundle\Entity\Person $person */ $person = $parameters['person']; if ($this->authorizationChecker->isGranted(ActivityVoter::SEE, $person)) { diff --git a/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationRenderer.php b/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationRenderer.php index 79290f2aa..f7f19e3f1 100644 --- a/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationRenderer.php +++ b/src/Bundle/ChillActivityBundle/Notification/ActivityNotificationRenderer.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Notification; use Chill\ActivityBundle\Entity\Activity; @@ -26,6 +28,6 @@ final class ActivityNotificationRenderer public function supports(Notification $notification, array $options = []): bool { - return $notification->getRelatedEntityClass() == Activity::class; + return $notification->getRelatedEntityClass() === Activity::class; } } diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php index eb53a6217..e80dc5522 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php @@ -22,6 +22,7 @@ use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Security\Core\Security; +use function count; use function in_array; final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInterface @@ -159,14 +160,14 @@ final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInte foreach ($reachableCenters as $center) { // we pass if not in centers - if (!in_array($center, $args['centers'])) { + if (!in_array($center, $args['centers'], true)) { continue; } // we get all the reachable scopes for this center $reachableScopes = $this->authorizationHelper->getReachableScopes($this->tokenStorage->getToken()->getUser(), $role, $center); // we get the ids for those scopes $reachablesScopesId = array_map( - function (Scope $scope) { return $scope->getId(); }, + static function (Scope $scope) { return $scope->getId(); }, $reachableScopes ); diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepositoryInterface.php b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepositoryInterface.php index b09f62115..56fb112f9 100644 --- a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepositoryInterface.php +++ b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepositoryInterface.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + namespace Chill\ActivityBundle\Repository; use Chill\PersonBundle\Entity\AccompanyingPeriod; diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/App.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/App.vue index 52454c2f7..2fb9d022d 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/App.vue +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/App.vue @@ -1,7 +1,7 @@ diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location/NewLocation.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location/NewLocation.vue index 2920e15b2..35bf9a065 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location/NewLocation.vue +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location/NewLocation.vue @@ -214,11 +214,9 @@ export default { return cond; }, getLocationTypesList() { - getLocationTypes().then(response => new Promise(resolve => { - console.log('getLocationTypes', response); - this.locationTypes = response.results.filter(t => t.availableForUsers === true); - resolve(); - })) + getLocationTypes().then(results => { + this.locationTypes = results.filter(t => t.availableForUsers === true); + }) }, openModal() { this.modal.showModal = true; @@ -247,7 +245,6 @@ export default { postLocation(body) .then( location => new Promise(resolve => { - console.log('postLocation', location); this.locations.push(location); this.$store.dispatch('updateLocation', location); resolve(); diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc.vue index 06e0b197c..92aa7be0e 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc.vue +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc.vue @@ -50,19 +50,26 @@ - - - - + {{ $t('activity.select_first_a_social_issue') }} + + + + {{ $t('activity.social_action_list_empty') }} + + + @@ -85,7 +92,8 @@ export default { data() { return { issueIsLoading: false, - actionIsLoading: false + actionIsLoading: false, + actionAreLoaded: false, } }, computed: { @@ -109,6 +117,7 @@ export default { /* Load others issues in multiselect */ this.issueIsLoading = true; + this.actionAreLoaded = false; getSocialIssues().then(response => new Promise((resolve, reject) => { this.$store.commit('updateIssuesOther', response.results); @@ -141,6 +150,8 @@ export default { this.$store.commit('filterList', 'actions'); this.issueIsLoading = false; + this.actionAreLoaded = true; + this.updateActionsList(); resolve(); })); }, @@ -173,7 +184,6 @@ export default { to get social actions concerned */ updateActionsList() { - //console.log('updateActionsList'); this.resetActionsList(); this.socialIssuesSelected.forEach(item => { @@ -188,6 +198,7 @@ export default { this.$store.commit('filterList', 'actions'); this.actionIsLoading = false; + this.actionAreLoaded = true; resolve(); })); }, this); @@ -196,6 +207,7 @@ export default { */ resetActionsList() { this.$store.commit('resetActionsList'); + this.actionAreLoaded = false; this.socialActionsSelected.forEach(item => { this.$store.commit('addActionInList', item); }, this); diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc/CheckSocialAction.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc/CheckSocialAction.vue index e3727ad43..ac209ac71 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc/CheckSocialAction.vue +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc/CheckSocialAction.vue @@ -1,18 +1,18 @@ @@ -34,3 +34,15 @@ export default { } } + + diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc/CheckSocialIssue.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc/CheckSocialIssue.vue index d88a7c97f..8d902818f 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc/CheckSocialIssue.vue +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc/CheckSocialIssue.vue @@ -1,18 +1,18 @@ @@ -34,3 +34,15 @@ export default { } } + + diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/i18n.js b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/i18n.js index 37b9b356e..fa7da3203 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/i18n.js +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/i18n.js @@ -9,6 +9,7 @@ const activityMessages = { choose_other_social_issue: "Ajouter une autre problématique sociale...", social_actions: "Actions d'accompagnement", select_first_a_social_issue: "Sélectionnez d'abord une problématique sociale", + social_action_list_empty: "Aucune action sociale disponible", // add_persons: "Ajouter des personnes concernées", diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js index 1408afd37..66657df47 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js @@ -7,8 +7,19 @@ import App from './App.vue'; const i18n = _createI18n(activityMessages); +const hasSocialIssues = document.querySelector('#social-issues-acc') !== null; +const hasLocation = document.querySelector('#location') !== null; +const hasPerson = document.querySelector('#add-persons') !== null; + const app = createApp({ - template: ``, + template: ``, + data() { + return { + hasSocialIssues, + hasLocation, + hasPerson, + }; + } }) .use(store) .use(i18n) diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/store.js b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/store.js index ef9cf3b1f..5b6297553 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/store.js +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/store.js @@ -1,5 +1,6 @@ import 'es6-promise/auto'; import { createStore } from 'vuex'; +import { postLocation } from './api'; const debug = process.env.NODE_ENV !== 'production'; //console.log('window.activity', window.activity); @@ -27,7 +28,6 @@ const store = createStore({ }, getters: { suggestedEntities(state) { - console.log(state.activity); if (typeof state.activity.accompanyingPeriod === "undefined") { return []; } @@ -303,7 +303,33 @@ const store = createStore({ let hiddenLocation = document.getElementById( "chill_activitybundle_activity_location" ); - hiddenLocation.value = value.id; + if (value.onthefly) { + const body = { + "type": "location", + "name": value.name === '__AccompanyingCourseLocation__' ? null : value.name, + "locationType": { + "id": value.locationType.id, + "type": "location-type" + } + }; + if (value.address.id) { + Object.assign(body, { + "address": { + "id": value.address.id + }, + }) + } + postLocation(body) + .then( + location => hiddenLocation.value = location.id + ).catch( + err => { + console.log(err.message); + } + ); + } else { + hiddenLocation.value = value.id; + } commit("updateLocation", value); }, }, diff --git a/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/app/AppKernel.php b/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/app/AppKernel.php index ac7b207d0..3ea88daa4 100644 --- a/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/app/AppKernel.php +++ b/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/app/AppKernel.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\HttpKernel\Kernel; diff --git a/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/app/autoload.php b/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/app/autoload.php index a2dfe7f92..ea351fb8a 100644 --- a/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/app/autoload.php +++ b/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/app/autoload.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + use Composer\Autoload\ClassLoader; use Doctrine\Common\Annotations\AnnotationRegistry; diff --git a/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/app/cache/dev/appDevDebugProjectContainer.php b/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/app/cache/dev/appDevDebugProjectContainer.php index 7beb848ce..0e6debadf 100644 --- a/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/app/cache/dev/appDevDebugProjectContainer.php +++ b/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/app/cache/dev/appDevDebugProjectContainer.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Exception\InactiveScopeException; diff --git a/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/web/app_dev.php b/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/web/app_dev.php index 7f60a5a15..914d09ffd 100644 --- a/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/web/app_dev.php +++ b/src/Bundle/ChillActivityBundle/Resources/test/Fixtures/App/web/app_dev.php @@ -7,6 +7,8 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + use Symfony\Component\Debug\Debug; use Symfony\Component\HttpFoundation\Request; @@ -18,7 +20,7 @@ use Symfony\Component\HttpFoundation\Request; // Feel free to remove this, extend it, or make something more sophisticated. if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) - || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server') + || !(in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1'], true) || \PHP_SAPI === 'cli-server') ) { header('HTTP/1.0 403 Forbidden'); diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/activity-badge-title.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/activity-badge-title.html.twig index f4a3d4d29..f51854163 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/activity-badge-title.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/activity-badge-title.html.twig @@ -26,23 +26,45 @@ {{ activity.type.name | localize_translatable_string }} -