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
+
+
+ item
+
+
+```
+Créer une liste de suggestions à enlever (avec une croix rouge cliquable, l'ancre a est vide)
+```html
+
+
+
+ item
+
+
+
+
+```
+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 @@
- {% for bloc in blocs %}
+ {% for bloc in blocks %}
{% if bloc.items|length > 0 %}
{{ bloc.title }}
@@ -118,7 +122,7 @@
{% if (with_display == 'wrap-list') %}
- {% for bloc in blocs %}
+ {% for bloc in blocks %}
{% if bloc.items|length > 0 %}
diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig
index e043b4d53..b3da40e96 100644
--- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig
+++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig
@@ -28,7 +28,9 @@
{{ form_row(edit_form.socialActions) }}
{% endif %}
+{%- if edit_form.socialIssues is defined or edit_form.socialIssues is defined -%}
+{% endif %}
{%- if edit_form.reasons is defined -%}
{{ form_row(edit_form.reasons) }}
@@ -46,9 +48,10 @@
{%- if edit_form.users is defined -%}
{{ form_widget(edit_form.users) }}
{% endif %}
+
+
{% endif %}
-
{{ 'Activity data'|trans }}
diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list_recent.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list_recent.html.twig
index 567c0b132..2829d8153 100644
--- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list_recent.html.twig
+++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list_recent.html.twig
@@ -2,9 +2,11 @@
{% for activity in activities | slice(0,5) %}
{% set t = activity.type %}
-
+
- {% include '@ChillActivity/Activity/activity-badge-title.html.twig' %}
+ {% include '@ChillActivity/Activity/activity-badge-title.html.twig' %}
+
{% endfor %}
diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig
index 10afd77a2..2fc8be3e6 100644
--- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig
+++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig
@@ -29,25 +29,31 @@
{{ form_row(form.socialActions) }}
{% endif %}
-
+{%- if form.socialIssues is defined or form.socialIssues is defined -%}
+
+{% endif %}
{%- if form.reasons is defined -%}
{{ form_row(form.reasons) }}
{% endif %}
-
{{ 'Concerned groups'|trans }}
+{%- if form.persons is defined or form.thirdParties is defined or form.users is defined -%}
-{%- if form.persons is defined -%}
- {{ form_widget(form.persons) }}
-{% endif %}
-{%- if form.thirdParties is defined -%}
- {{ form_widget(form.thirdParties) }}
-{% endif %}
-{%- if form.users is defined -%}
- {{ form_widget(form.users) }}
-{% endif %}
+
{{ 'Concerned groups'|trans }}
-
+ {%- if form.persons is defined -%}
+ {{ form_widget(form.persons) }}
+ {% endif %}
+ {%- if form.thirdParties is defined -%}
+ {{ form_widget(form.thirdParties) }}
+ {% endif %}
+ {%- if form.users is defined -%}
+ {{ form_widget(form.users) }}
+ {% endif %}
+
+
+
+{% endif %}
{{ 'Activity data'|trans }}
diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig
index d8f02a37d..505d8c6cb 100644
--- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig
+++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig
@@ -22,7 +22,7 @@
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
});
window.activity = {{ activity_json|json_encode|raw }};
- window.default_location_id = {{ default_location_id }};
+ {% if default_location is not null %}window.default_location_id = {{ default_location.id }}{% endif %};
{{ encore_entry_script_tags('vue_activity') }}
{% endblock %}
diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig
index a30034257..a1fc44196 100644
--- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig
+++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig
@@ -27,7 +27,7 @@
{{ 'Social issues'|trans }}
{% if entity.socialIssues|length == 0 %}
-
{{ 'Any social issues'|trans }}
+
{{ 'No social issues associated'|trans }}
{% else %}
{% for si in entity.socialIssues %}{{ si|chill_entity_render_box }}{% endfor %}
{% endif %}
@@ -38,7 +38,7 @@
{{ 'Social actions'|trans }}
{% if entity.socialActions|length == 0 %}
-
{{ 'Any social actions'|trans }}
+
{{ 'No social actions associated'|trans }}
{% else %}
{% for sa in entity.socialActions %}{{ sa|chill_entity_render_box }}{% endfor %}
{% endif %}
@@ -67,8 +67,8 @@
- {% include 'ChillActivityBundle:Activity:show.html.twig' with {'context': 'accompanyingCourse'} %}
+ {% include 'ChillActivityBundle:Activity:show.html.twig' with {'context': 'accompanyingCourse'} %}
{% endblock content %}
diff --git a/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityStatsVoter.php b/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityStatsVoter.php
index 7c850c67d..39b0deef9 100644
--- a/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityStatsVoter.php
+++ b/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityStatsVoter.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Security\Authorization;
use Chill\MainBundle\Entity\Center;
@@ -63,7 +65,7 @@ class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierar
protected function supports($attribute, $subject)
{
if ($subject instanceof Center
- && in_array($attribute, $this->getAttributes())) {
+ && in_array($attribute, $this->getAttributes(), true)) {
return true;
}
diff --git a/src/Bundle/ChillActivityBundle/Templating/Entity/ActivityReasonRender.php b/src/Bundle/ChillActivityBundle/Templating/Entity/ActivityReasonRender.php
index f095e13e5..23aae25c8 100644
--- a/src/Bundle/ChillActivityBundle/Templating/Entity/ActivityReasonRender.php
+++ b/src/Bundle/ChillActivityBundle/Templating/Entity/ActivityReasonRender.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Templating\Entity;
use Chill\ActivityBundle\Entity\ActivityReason;
diff --git a/src/Bundle/ChillActivityBundle/Test/PrepareActivityTrait.php b/src/Bundle/ChillActivityBundle/Test/PrepareActivityTrait.php
index 2942b7948..91f96dad8 100644
--- a/src/Bundle/ChillActivityBundle/Test/PrepareActivityTrait.php
+++ b/src/Bundle/ChillActivityBundle/Test/PrepareActivityTrait.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Test;
use Chill\ActivityBundle\Entity\Activity;
diff --git a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php
index 493fac584..febf3b820 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php
@@ -7,21 +7,25 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Tests\Controller;
use RuntimeException;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\Security\Core\Role\Role;
+use function count;
+use function in_array;
/**
* @internal
* @coversNothing
*/
-class ActivityControllerTest extends WebTestCase
+final class ActivityControllerTest extends WebTestCase
{
public function getSecuredPagesAuthenticated()
{
- static::bootKernel();
+ self::bootKernel();
$person = $this->getPersonFromFixtures();
$activities = $this->getActivitiesForPerson($person);
@@ -57,7 +61,7 @@ class ActivityControllerTest extends WebTestCase
*/
public function getSecuredPagesUnauthenticated()
{
- static::bootKernel();
+ self::bootKernel();
$person = $this->getPersonFromFixtures();
$activities = $this->getActivitiesForPerson($person);
@@ -200,7 +204,7 @@ class ActivityControllerTest extends WebTestCase
*/
private function createFakeUser()
{
- $container = static::$kernel->getContainer();
+ $container = self::$kernel->getContainer();
$em = $container->get('doctrine.orm.entity_manager');
//get the social PermissionGroup, and remove CHILL_ACTIVITY_*
@@ -242,7 +246,7 @@ class ActivityControllerTest extends WebTestCase
private function getActivitiesForPerson(\Chill\PersonBundle\Entity\Person $person)
{
- $em = static::$kernel->getContainer()
+ $em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
$activities = $em->getRepository('ChillActivityBundle:Activity')
@@ -263,7 +267,7 @@ class ActivityControllerTest extends WebTestCase
*/
private function getAuthenticatedClient($username = 'center a_social')
{
- return static::createClient([], [
+ return self::createClient([], [
'PHP_AUTH_USER' => $username,
'PHP_AUTH_PW' => 'password',
]);
@@ -274,7 +278,7 @@ class ActivityControllerTest extends WebTestCase
*/
private function getPersonFromFixtures()
{
- $em = static::$kernel->getContainer()
+ $em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
$person = $em->getRepository('ChillPersonBundle:Person')
@@ -298,14 +302,14 @@ class ActivityControllerTest extends WebTestCase
*/
private function getRandomActivityReason(array $excludeIds = [])
{
- $reasons = static::$kernel->getContainer()
+ $reasons = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('ChillActivityBundle:ActivityReason')
->findAll();
$reason = $reasons[array_rand($reasons)];
- if (in_array($reason->getId(), $excludeIds)) {
+ if (in_array($reason->getId(), $excludeIds, true)) {
return $this->getRandomActivityReason($excludeIds);
}
@@ -317,7 +321,7 @@ class ActivityControllerTest extends WebTestCase
*/
private function getRandomActivityType()
{
- $types = static::$kernel->getContainer()
+ $types = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('ChillActivityBundle:ActivityType')
->findAll();
@@ -333,7 +337,7 @@ class ActivityControllerTest extends WebTestCase
*/
private function getRandomScope($username, $centerName)
{
- $user = static::$kernel->getContainer()
+ $user = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('ChillMainBundle:User')
->findOneByUsername($username);
@@ -343,20 +347,20 @@ class ActivityControllerTest extends WebTestCase
. 'does not exists in database. Did you add fixtures ?');
}
- $center = static::$kernel->getContainer()
+ $center = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('ChillMainBundle:Center')
->findOneByName($centerName);
// get scope reachable by both role UPDATE and DELETE
- $reachableScopesUpdate = static::$kernel->getContainer()
+ $reachableScopesUpdate = self::$kernel->getContainer()
->get('chill.main.security.authorization.helper')
->getReachableScopes(
$user,
new Role('CHILL_ACTIVITY_UPDATE'),
$center
);
- $reachableScopesDelete = static::$kernel->getContainer()
+ $reachableScopesDelete = self::$kernel->getContainer()
->get('chill.main.security.authorization.helper')
->getReachableScopes(
$user,
@@ -364,8 +368,8 @@ class ActivityControllerTest extends WebTestCase
$center
);
$reachableScopesId = array_intersect(
- array_map(function ($s) { return $s->getId(); }, $reachableScopesDelete),
- array_map(function ($s) { return $s->getId(); }, $reachableScopesUpdate)
+ array_map(static function ($s) { return $s->getId(); }, $reachableScopesDelete),
+ array_map(static function ($s) { return $s->getId(); }, $reachableScopesUpdate)
);
if (count($reachableScopesId) === 0) {
@@ -374,7 +378,7 @@ class ActivityControllerTest extends WebTestCase
}
foreach ($reachableScopesUpdate as $scope) {
- if (in_array($scope->getId(), $reachableScopesId)) {
+ if (in_array($scope->getId(), $reachableScopesId, true)) {
$reachableScopes[] = $scope;
}
}
diff --git a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonCategoryControllerTest.php b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonCategoryControllerTest.php
index dde5ed304..a6277608f 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonCategoryControllerTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonCategoryControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -15,7 +17,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class ActivityReasonCategoryControllerTest extends WebTestCase
+final class ActivityReasonCategoryControllerTest extends WebTestCase
{
public function testToWrite()
{
diff --git a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonControllerTest.php b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonControllerTest.php
index 88a41206b..a2ae8c13f 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonControllerTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityReasonControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -15,7 +17,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class ActivityReasonControllerTest extends WebTestCase
+final class ActivityReasonControllerTest extends WebTestCase
{
public function testToWrite()
{
diff --git a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityTypeControllerTest.php b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityTypeControllerTest.php
index 42b2106a1..a07f03770 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityTypeControllerTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityTypeControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -15,7 +17,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class ActivityTypeControllerTest extends WebTestCase
+final class ActivityTypeControllerTest extends WebTestCase
{
public function testToWrite()
{
diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php
index d0a164cd2..cded1edeb 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Tests\Aggregator;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
@@ -17,7 +19,7 @@ use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
* @internal
* @coversNothing
*/
-class ActivityReasonAggregatorTest extends AbstractAggregatorTest
+final class ActivityReasonAggregatorTest extends AbstractAggregatorTest
{
/**
* @var \Chill\ActivityBundle\Export\Aggregator\ActivityReasonAggregator
@@ -26,9 +28,9 @@ class ActivityReasonAggregatorTest extends AbstractAggregatorTest
public function setUp()
{
- static::bootKernel();
+ self::bootKernel();
- $container = static::$kernel->getContainer();
+ $container = self::$kernel->getContainer();
$this->aggregator = $container->get('chill.activity.export.reason_aggregator');
@@ -57,11 +59,11 @@ class ActivityReasonAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders()
{
- if (null === static::$kernel) {
- static::bootKernel();
+ if (null === self::$kernel) {
+ self::bootKernel();
}
- $em = static::$kernel->getContainer()
+ $em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
return [
diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityTypeAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityTypeAggregatorTest.php
index a1803809d..0b0c6500a 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityTypeAggregatorTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityTypeAggregatorTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Tests\Aggregator;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
@@ -17,7 +19,7 @@ use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
* @internal
* @coversNothing
*/
-class ActivityTypeAggregatorTest extends AbstractAggregatorTest
+final class ActivityTypeAggregatorTest extends AbstractAggregatorTest
{
/**
* @var \Chill\ActivityBundle\Export\Aggregator\ActivityReasonAggregator
@@ -26,9 +28,9 @@ class ActivityTypeAggregatorTest extends AbstractAggregatorTest
public function setUp()
{
- static::bootKernel();
+ self::bootKernel();
- $container = static::$kernel->getContainer();
+ $container = self::$kernel->getContainer();
$this->aggregator = $container->get('chill.activity.export.type_aggregator');
@@ -56,11 +58,11 @@ class ActivityTypeAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders()
{
- if (null === static::$kernel) {
- static::bootKernel();
+ if (null === self::$kernel) {
+ self::bootKernel();
}
- $em = static::$kernel->getContainer()
+ $em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
return [
diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityUserAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityUserAggregatorTest.php
index c47df37a9..426de911d 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityUserAggregatorTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityUserAggregatorTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Tests\Aggregator;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
@@ -17,7 +19,7 @@ use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
* @internal
* @coversNothing
*/
-class ActivityUserAggregatorTest extends AbstractAggregatorTest
+final class ActivityUserAggregatorTest extends AbstractAggregatorTest
{
/**
* @var \Chill\ActivityBundle\Export\Aggregator\ActivityUserAggregator
@@ -26,9 +28,9 @@ class ActivityUserAggregatorTest extends AbstractAggregatorTest
public function setUp()
{
- static::bootKernel();
+ self::bootKernel();
- $container = static::$kernel->getContainer();
+ $container = self::$kernel->getContainer();
$this->aggregator = $container->get('chill.activity.export.user_aggregator');
@@ -56,11 +58,11 @@ class ActivityUserAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders()
{
- if (null === static::$kernel) {
- static::bootKernel();
+ if (null === self::$kernel) {
+ self::bootKernel();
}
- $em = static::$kernel->getContainer()
+ $em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
return [
diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Export/CountActivityTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Export/CountActivityTest.php
index 00bb1b945..3981c1948 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Export/Export/CountActivityTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Export/Export/CountActivityTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Tests\Export\Export;
use Chill\MainBundle\Test\Export\AbstractExportTest;
@@ -15,7 +17,7 @@ use Chill\MainBundle\Test\Export\AbstractExportTest;
* @internal
* @coversNothing
*/
-class CountActivityTest extends AbstractExportTest
+final class CountActivityTest extends AbstractExportTest
{
/**
* @var
@@ -24,9 +26,9 @@ class CountActivityTest extends AbstractExportTest
public function setUp()
{
- static::bootKernel();
+ self::bootKernel();
- /* @var $container \Symfony\Component\DependencyInjection\ContainerInterface */
+ /** @var \Symfony\Component\DependencyInjection\ContainerInterface $container */
$container = self::$kernel->getContainer();
$this->export = $container->get('chill.activity.export.count_activity');
diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Export/ListActivityTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Export/ListActivityTest.php
index bcc9fb034..df1e64fd7 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Export/Export/ListActivityTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Export/Export/ListActivityTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Tests\Export\Export;
use Chill\MainBundle\Test\Export\AbstractExportTest;
@@ -15,7 +17,7 @@ use Chill\MainBundle\Test\Export\AbstractExportTest;
* @internal
* @coversNothing
*/
-class ListActivityTest extends AbstractExportTest
+final class ListActivityTest extends AbstractExportTest
{
/**
* @var \Chill\ActivityBundle\Export\Export\ListActivity
@@ -24,9 +26,9 @@ class ListActivityTest extends AbstractExportTest
public function setUp()
{
- static::bootKernel();
+ self::bootKernel();
- /* @var $container \Symfony\Component\DependencyInjection\ContainerInterface */
+ /** @var \Symfony\Component\DependencyInjection\ContainerInterface $container */
$container = self::$kernel->getContainer();
$this->export = $container->get('chill.activity.export.list_activity');
diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Export/StatActivityDurationSumTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Export/StatActivityDurationSumTest.php
index 963ecbaaa..12587e5a3 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Export/Export/StatActivityDurationSumTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Export/Export/StatActivityDurationSumTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Tests\Export\Export;
use Chill\MainBundle\Test\Export\AbstractExportTest;
@@ -17,7 +19,7 @@ use Chill\MainBundle\Test\Export\AbstractExportTest;
* @internal
* @coversNothing
*/
-class StatActivityDurationSumTest extends AbstractExportTest
+final class StatActivityDurationSumTest extends AbstractExportTest
{
/**
* @var \Chill\ActivityBundle\Export\Export\StatActivityDuration
@@ -26,9 +28,9 @@ class StatActivityDurationSumTest extends AbstractExportTest
public function setUp()
{
- static::bootKernel();
+ self::bootKernel();
- /* @var $container \Symfony\Component\DependencyInjection\ContainerInterface */
+ /** @var \Symfony\Component\DependencyInjection\ContainerInterface $container */
$container = self::$kernel->getContainer();
$this->export = $container->get('chill.activity.export.sum_activity_duration');
diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityReasonFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityReasonFilterTest.php
index 13f2ae2c4..46c1e0ef6 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityReasonFilterTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityReasonFilterTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Tests\Filter;
use Chill\MainBundle\Test\Export\AbstractFilterTest;
@@ -16,7 +18,7 @@ use Doctrine\Common\Collections\ArrayCollection;
* @internal
* @coversNothing
*/
-class ActivityReasonFilterTest extends AbstractFilterTest
+final class ActivityReasonFilterTest extends AbstractFilterTest
{
/**
* @var \Chill\PersonBundle\Export\Filter\GenderFilter
@@ -25,9 +27,9 @@ class ActivityReasonFilterTest extends AbstractFilterTest
public function setUp()
{
- static::bootKernel();
+ self::bootKernel();
- $container = static::$kernel->getContainer();
+ $container = self::$kernel->getContainer();
$this->filter = $container->get('chill.activity.export.reason_filter');
@@ -48,11 +50,11 @@ class ActivityReasonFilterTest extends AbstractFilterTest
public function getFormData()
{
- if (null === static::$kernel) {
- static::bootKernel();
+ if (null === self::$kernel) {
+ self::bootKernel();
}
- $em = static::$kernel->getContainer()
+ $em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
$reasons = $em->createQuery('SELECT reason '
@@ -69,11 +71,11 @@ class ActivityReasonFilterTest extends AbstractFilterTest
public function getQueryBuilders()
{
- if (null === static::$kernel) {
- static::bootKernel();
+ if (null === self::$kernel) {
+ self::bootKernel();
}
- $em = static::$kernel->getContainer()
+ $em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
return [
diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php
index a20b5d3e1..b69e4d8b2 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php
@@ -7,16 +7,19 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Tests\Filter;
use Chill\MainBundle\Test\Export\AbstractFilterTest;
use DateTime;
+use function array_slice;
/**
* @internal
* @coversNothing
*/
-class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest
+final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest
{
/**
* @var \Chill\PersonBundle\Export\Filter\PersonHavingActivityBetweenDateFilter
@@ -25,9 +28,9 @@ class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest
public function setUp()
{
- static::bootKernel();
+ self::bootKernel();
- $container = static::$kernel->getContainer();
+ $container = self::$kernel->getContainer();
$this->filter = $container->get('chill.activity.export.'
. 'person_having_an_activity_between_date_filter');
@@ -68,11 +71,11 @@ class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest
public function getQueryBuilders()
{
- if (null === static::$kernel) {
- static::bootKernel();
+ if (null === self::$kernel) {
+ self::bootKernel();
}
- $em = static::$kernel->getContainer()
+ $em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
return [
@@ -97,11 +100,11 @@ class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest
*/
private function getActivityReasons()
{
- if (null === static::$kernel) {
- static::bootKernel();
+ if (null === self::$kernel) {
+ self::bootKernel();
}
- return static::$kernel->getContainer()
+ return self::$kernel->getContainer()
->get('chill_activity.repository.reason')
->findAll();
}
diff --git a/src/Bundle/ChillActivityBundle/Tests/Form/ActivityTypeTest.php b/src/Bundle/ChillActivityBundle/Tests/Form/ActivityTypeTest.php
index a00ccdbf7..3ba204d9a 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Form/ActivityTypeTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Form/ActivityTypeTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Tests\Form;
use Chill\ActivityBundle\Entity\Activity;
@@ -21,7 +23,7 @@ use Symfony\Component\Security\Core\Role\Role;
* @internal
* @coversNothing
*/
-class ActivityTypeTest extends KernelTestCase
+final class ActivityTypeTest extends KernelTestCase
{
/**
* @var \Chill\MainBundle\Entity\Center
@@ -119,7 +121,7 @@ class ActivityTypeTest extends KernelTestCase
$this->assertInstanceOf(Activity::class, $form->getData()['activity']);
// test the activity
- /* @var $activity Activity */
+ /** @var Activity $activity */
$activity = $form->getData()['activity'];
$this->assertEquals(
@@ -170,7 +172,7 @@ class ActivityTypeTest extends KernelTestCase
$this->assertTrue($form->isValid());
// test the activity
- /* @var $activity Activity */
+ /** @var Activity $activity */
$activity = $form->getData()['activity'];
$this->assertEquals(
@@ -186,7 +188,7 @@ class ActivityTypeTest extends KernelTestCase
// map all the values in an array
$values = array_map(
- function ($choice) { return $choice->value; },
+ static function ($choice) { return $choice->value; },
$view['activity']['durationTime']->vars['choices']
);
diff --git a/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityReasonTest.php b/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityReasonTest.php
index 5c7ace286..7d186192e 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityReasonTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityReasonTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Tests\Form\Type;
use Chill\ActivityBundle\Form\Type\TranslatableActivityReason;
@@ -20,7 +22,7 @@ use Symfony\Component\Form\Test\TypeTestCase;
* @internal
* @coversNothing
*/
-class TranslatableActivityReasonTest extends TypeTestCase
+final class TranslatableActivityReasonTest extends TypeTestCase
{
/**
* @var Prophecy\Prophet
@@ -81,7 +83,7 @@ class TranslatableActivityReasonTest extends TypeTestCase
$request->getLocale()->willReturn($fallbackLocale);
$requestStack->willExtend('Symfony\Component\HttpFoundation\RequestStack');
- $requestStack->getCurrentRequest()->will(function () use ($request) {
+ $requestStack->getCurrentRequest()->will(static function () use ($request) {
return $request;
});
diff --git a/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityTypeTest.php b/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityTypeTest.php
index 1e5a6714b..5c1dcd958 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityTypeTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityTypeTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Tests\Form\Type;
use Chill\ActivityBundle\Form\Type\TranslatableActivityType;
@@ -17,7 +19,7 @@ use Symfony\Component\Form\Extension\Core\Type\FormType;
* @internal
* @coversNothing
*/
-class TranslatableActivityTypeTest extends KernelTestCase
+final class TranslatableActivityTypeTest extends KernelTestCase
{
/**
* @var \Symfony\Component\Form\FormBuilderInterface
diff --git a/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php b/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php
index 3c16197a8..46351a052 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Tests\Security\Authorization;
use Chill\ActivityBundle\Test\PrepareActivityTrait;
@@ -24,7 +26,7 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
* @internal
* @coversNothing
*/
-class ActivityVoterTest extends KernelTestCase
+final class ActivityVoterTest extends KernelTestCase
{
use PrepareActivityTrait;
use PrepareCenterTrait;
@@ -44,8 +46,8 @@ class ActivityVoterTest extends KernelTestCase
public function setUp()
{
- static::bootKernel();
- $this->voter = static::$kernel->getContainer()
+ self::bootKernel();
+ $this->voter = self::$kernel->getContainer()
->get('chill.activity.security.authorization.activity_voter');
$this->prophet = new \Prophecy\Prophet();
}
diff --git a/src/Bundle/ChillActivityBundle/Tests/Timeline/TimelineProviderTest.php b/src/Bundle/ChillActivityBundle/Tests/Timeline/TimelineProviderTest.php
index 2179c5361..d069c05f4 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Timeline/TimelineProviderTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Timeline/TimelineProviderTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\ActivityBundle\Tests\Timeline;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -15,7 +17,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class TimelineProviderTest extends WebTestCase
+final class TimelineProviderTest extends WebTestCase
{
public function testAnActivityIsShownOnTimeline()
{
diff --git a/src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php b/src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php
index c0dab8abd..072ba39d9 100644
--- a/src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php
+++ b/src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php
@@ -119,7 +119,7 @@ class TimelineActivityProvider implements TimelineProviderInterface
*/
private function checkContext(string $context)
{
- if (false === in_array($context, self::SUPPORTED_CONTEXTS)) {
+ if (false === in_array($context, self::SUPPORTED_CONTEXTS, true)) {
throw new LogicException(
sprintf(
"The context '%s' is not supported. Currently only 'person' is supported",
@@ -152,7 +152,7 @@ class TimelineActivityProvider implements TimelineProviderInterface
$associationMapping = $metadataActivity->getAssociationMapping('person');
$role = new Role('CHILL_ACTIVITY_SEE');
$reachableScopes = $this->helper->getReachableScopes($this->user, $role->getRole(), $person->getCenter());
- $whereClause = sprintf(' {activity.person_id} = ? AND {activity.scope_id} IN ({scopes_ids}) ');
+ $whereClause = ' {activity.person_id} = ? AND {activity.scope_id} IN ({scopes_ids}) ';
$scopes_ids = [];
// first parameter: activity.person_id
@@ -160,7 +160,7 @@ class TimelineActivityProvider implements TimelineProviderInterface
// loop on reachable scopes
foreach ($reachableScopes as $scope) {
- if (in_array($scope->getId(), $scopes_ids)) {
+ if (in_array($scope->getId(), $scopes_ids, true)) {
continue;
}
$scopes_ids[] = '?';
diff --git a/src/Bundle/ChillActivityBundle/Validator/Constraints/ActivityValidity.php b/src/Bundle/ChillActivityBundle/Validator/Constraints/ActivityValidity.php
new file mode 100644
index 000000000..e6ed66d4a
--- /dev/null
+++ b/src/Bundle/ChillActivityBundle/Validator/Constraints/ActivityValidity.php
@@ -0,0 +1,44 @@
+getActivityType()->getPersonsVisible() === 2 && count($activity->getPersons()) === 0) {
+ $this->context
+ ->buildViolation($constraint->noPersonsMessage)
+ ->addViolation();
+ }
+
+ if ($activity->getActivityType()->getUsersVisible() === 2 && count($activity->getUsers()) === 0) {
+ $this->context
+ ->buildViolation($constraint->noUsersMessage)
+ ->addViolation();
+ }
+
+ if ($activity->getActivityType()->getThirdPartiesVisible() === 2 && count($activity->getThirdParties()) === 0) {
+ $this->context
+ ->buildViolation($constraint->noThirdPartiesMessage)
+ ->addViolation();
+ }
+
+ if ($activity->getActivityType()->getUserVisible() === 2 && null === $activity->getUser()) {
+ $this->context
+ ->buildViolation($constraint->makeIsRequiredMessage('user'))
+ ->addViolation();
+ }
+
+ if ($activity->getActivityType()->getDateVisible() === 2 && null === $activity->getDate()) {
+ $this->context
+ ->buildViolation($constraint->makeIsRequiredMessage('date'))
+ ->addViolation();
+ }
+
+ if ($activity->getActivityType()->getLocationVisible() === 2 && null === $activity->getLocation()) {
+ $this->context
+ ->buildViolation($constraint->makeIsRequiredMessage('location'))
+ ->addViolation();
+ }
+
+ if ($activity->getActivityType()->getDurationTimeVisible() === 2 && null === $activity->getDurationTime()) {
+ $this->context
+ ->buildViolation($constraint->makeIsRequiredMessage('duration time'))
+ ->addViolation();
+ }
+
+ if ($activity->getActivityType()->getTravelTimeVisible() === 2 && null === $activity->getTravelTime()) {
+ $this->context
+ ->buildViolation($constraint->makeIsRequiredMessage('travel time'))
+ ->addViolation();
+ }
+
+ if ($activity->getActivityType()->getAttendeeVisible() === 2 && null === $activity->getAttendee()) {
+ $this->context
+ ->buildViolation($constraint->makeIsRequiredMessage('attendee'))
+ ->addViolation();
+ }
+
+ if ($activity->getActivityType()->getReasonsVisible() === 2 && null === $activity->getReasons()) {
+ $this->context
+ ->buildViolation($constraint->makeIsRequiredMessage('reasons'))
+ ->addViolation();
+ }
+
+ if ($activity->getActivityType()->getCommentVisible() === 2 && null === $activity->getComment()) {
+ $this->context
+ ->buildViolation($constraint->makeIsRequiredMessage('comment'))
+ ->addViolation();
+ }
+
+ if ($activity->getActivityType()->getSentReceivedVisible() === 2 && null === $activity->getSentReceived()) {
+ $this->context
+ ->buildViolation($constraint->makeIsRequiredMessage('sent/received'))
+ ->addViolation();
+ }
+
+ if ($activity->getActivityType()->getDocumentsVisible() === 2 && null === $activity->getDocuments()) {
+ $this->context
+ ->buildViolation($constraint->makeIsRequiredMessage('document'))
+ ->addViolation();
+ }
+
+ if ($activity->getActivityType()->getEmergencyVisible() === 2 && null === $activity->getEmergency()) {
+ $this->context
+ ->buildViolation($constraint->makeIsRequiredMessage('emergency'))
+ ->addViolation();
+ }
+
+ if ($activity->getActivityType()->getSocialIssuesVisible() === 2 && $activity->getSocialIssues()->count() === 0) {
+ $this->context
+ ->buildViolation($constraint->socialIssuesMessage)
+ ->addViolation();
+ }
+
+ if ($activity->getActivityType()->getSocialActionsVisible() === 2 && $activity->getSocialActions()->count() === 0) {
+ // check if a social action may be added
+ $actions = [];
+
+ foreach ($activity->getSocialIssues() as $socialIssue) {
+ /** @var SocialIssue $socialIssue */
+ $actions = array_merge($actions, $socialIssue->getRecursiveSocialActions()->toArray());
+ }
+
+ if (0 < count($actions)) {
+ $this->context
+ ->buildViolation($constraint->socialActionsMessage)
+ ->addViolation();
+ }
+ }
+ }
+}
diff --git a/src/Bundle/ChillActivityBundle/config/services.yaml b/src/Bundle/ChillActivityBundle/config/services.yaml
index 4e93e38be..1ca413f0e 100644
--- a/src/Bundle/ChillActivityBundle/config/services.yaml
+++ b/src/Bundle/ChillActivityBundle/config/services.yaml
@@ -27,3 +27,8 @@ services:
Chill\ActivityBundle\Repository\:
resource: '../Repository/'
+
+ Chill\ActivityBundle\Validator\Constraints\:
+ autowire: true
+ autoconfigure: true
+ resource: '../Validator/Constraints/'
diff --git a/src/Bundle/ChillActivityBundle/migrations/Version20150701091248.php b/src/Bundle/ChillActivityBundle/migrations/Version20150701091248.php
index 1a7d66c86..c84d3af52 100644
--- a/src/Bundle/ChillActivityBundle/migrations/Version20150701091248.php
+++ b/src/Bundle/ChillActivityBundle/migrations/Version20150701091248.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\Migrations\Activity;
use Doctrine\DBAL\Schema\Schema;
@@ -20,7 +22,7 @@ class Version20150701091248 extends AbstractMigration
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
- $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
+ $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE Activity DROP CONSTRAINT FK_55026B0C59BB1592');
$this->addSql('ALTER TABLE ActivityReason DROP CONSTRAINT FK_654A2FCD12469DE2');
@@ -38,7 +40,7 @@ class Version20150701091248 extends AbstractMigration
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
- $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
+ $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE SEQUENCE Activity_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE ActivityReason_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
diff --git a/src/Bundle/ChillActivityBundle/migrations/Version20150702093317.php b/src/Bundle/ChillActivityBundle/migrations/Version20150702093317.php
index 0dd9798ad..efcd68c7e 100644
--- a/src/Bundle/ChillActivityBundle/migrations/Version20150702093317.php
+++ b/src/Bundle/ChillActivityBundle/migrations/Version20150702093317.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\Migrations\Activity;
use Doctrine\DBAL\Schema\Schema;
@@ -20,7 +22,7 @@ class Version20150702093317 extends AbstractMigration
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
- $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
+ $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE ActivityReasonCategory DROP COLUMN name;');
$this->addSql('ALTER TABLE ActivityReasonCategory ADD COLUMN label VARCHAR(255) NOT NULL;');
@@ -33,7 +35,7 @@ class Version20150702093317 extends AbstractMigration
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
- $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
+ $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE ActivityReasonCategory DROP COLUMN label;');
$this->addSql('ALTER TABLE ActivityReasonCategory ADD COLUMN name JSON;');
diff --git a/src/Bundle/ChillActivityBundle/migrations/Version20150704091347.php b/src/Bundle/ChillActivityBundle/migrations/Version20150704091347.php
index 5dea48f5a..a4bb82319 100644
--- a/src/Bundle/ChillActivityBundle/migrations/Version20150704091347.php
+++ b/src/Bundle/ChillActivityBundle/migrations/Version20150704091347.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\Migrations\Activity;
use Doctrine\DBAL\Schema\Schema;
@@ -20,7 +22,7 @@ class Version20150704091347 extends AbstractMigration
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
- $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
+ $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE Activity ALTER COLUMN remark SET NOT NULL;');
$this->addSql('ALTER TABLE Activity ALTER COLUMN attendee DROP NOT NULL;');
@@ -29,7 +31,7 @@ class Version20150704091347 extends AbstractMigration
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
- $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
+ $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE Activity ALTER COLUMN remark DROP NOT NULL;');
$this->addSql('ALTER TABLE Activity ALTER COLUMN attendee DROP NOT NULL;');
diff --git a/src/Bundle/ChillActivityBundle/migrations/Version20160222103457.php b/src/Bundle/ChillActivityBundle/migrations/Version20160222103457.php
index 6aa355cae..80afac045 100644
--- a/src/Bundle/ChillActivityBundle/migrations/Version20160222103457.php
+++ b/src/Bundle/ChillActivityBundle/migrations/Version20160222103457.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\Migrations\Activity;
use Doctrine\DBAL\Schema\Schema;
@@ -23,7 +25,7 @@ class Version20160222103457 extends AbstractMigration
public function down(Schema $schema): void
{
$this->abortIf(
- $this->connection->getDatabasePlatform()->getName() != 'postgresql',
+ $this->connection->getDatabasePlatform()->getName() !== 'postgresql',
'Migration can only be executed safely on \'postgresql\'.'
);
@@ -35,7 +37,7 @@ class Version20160222103457 extends AbstractMigration
// try to keep at least on activity reason...
$this->addSql(
- 'UPDATE activity
+ 'UPDATE activity
SET reason_id=rid
FROM (
SELECT activity_id AS aid, MIN(activityreason_id) AS rid
@@ -50,7 +52,7 @@ class Version20160222103457 extends AbstractMigration
public function up(Schema $schema): void
{
$this->abortIf(
- $this->connection->getDatabasePlatform()->getName() != 'postgresql',
+ $this->connection->getDatabasePlatform()->getName() !== 'postgresql',
'Migration can only be executed safely on \'postgresql\'.'
);
diff --git a/src/Bundle/ChillActivityBundle/migrations/Version20161114085659.php b/src/Bundle/ChillActivityBundle/migrations/Version20161114085659.php
index 3f2710cfc..73ec11a9e 100644
--- a/src/Bundle/ChillActivityBundle/migrations/Version20161114085659.php
+++ b/src/Bundle/ChillActivityBundle/migrations/Version20161114085659.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\Migrations\Activity;
use Doctrine\DBAL\Schema\Schema;
diff --git a/src/Bundle/ChillActivityBundle/migrations/Version20210422073711.php b/src/Bundle/ChillActivityBundle/migrations/Version20210422073711.php
index dfb3a9cc7..8501767b2 100644
--- a/src/Bundle/ChillActivityBundle/migrations/Version20210422073711.php
+++ b/src/Bundle/ChillActivityBundle/migrations/Version20210422073711.php
@@ -13,6 +13,7 @@ namespace Chill\Migrations\Activity;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
+use function count;
/**
* Auto-generated Migration: Please modify to your needs!
diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml
index d0c3ddc6d..098a6f6df 100644
--- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml
+++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml
@@ -43,6 +43,7 @@ Sent: Envoyer
Received: Recevoir
by: 'Par '
location: Lieu
+Reasons: Sujets
#forms
@@ -139,34 +140,40 @@ ActivityReasonCategory is inactive and won't be proposed: La catégorie est inac
# activity type type admin
ActivityType list: Types d'activités
Create a new activity type: Créer un nouveau type d'activité
-Persons visible: Visibilté du champ Personnes
+Persons visible: Visibilité du champ Personnes
Persons label: Libellé du champ Personnes
-User visible: Visibilté du champ Utilisateur
+User visible: Visibilité du champ Utilisateur
User label: Libellé du champ Utilisateur
-Date visible: Visibilté du champ Date
+Date visible: Visibilité du champ Date
Date label: Libellé du champ Date
-Place visible: Visibilté du champ Lieu
+Place visible: Visibilité du champ Lieu
Place label: Libellé du champ Lieu
-Third parties visible: Visibilté du champ Tiers
+Third parties visible: Visibilité du champ Tiers
Third parties label: Libellé du champ Tiers
-Duration time visible: Visibilté du champ Durée
+Duration time visible: Visibilité du champ Durée
Duration time label: Libellé du champ Durée
-Travel time visible: Visibilté du champ Durée de déplacement
+Travel time visible: Visibilité du champ Durée de déplacement
Travel time label: Libellé du champ Durée de déplacement
-Attendee visible: Visibilté du champ Présence de l'usager
+Attendee visible: Visibilité du champ Présence de l'usager
Attendee label: Libellé du champ Présence de l'usager
-Reasons visible: Visibilté du champ Sujet
+Reasons visible: Visibilité du champ Sujet
Reasons label: Libellé du champ Sujet
-Comment visible: Visibilté du champ Commentaire
+Comment visible: Visibilité du champ Commentaire
Comment label: Libellé du champ Commentaire
-Emergency visible: Visibilté du champ Urgent
+Emergency visible: Visibilité du champ Urgent
Emergency label: Libellé du champ Urgent
-Accompanying period visible: Visibilté du champ Période d'accompagnement
+Accompanying period visible: Visibilité du champ Période d'accompagnement
Accompanying period label: Libellé du champ Période d'accompagnement
-Social data visible: Visibilté du champ Données sociales
-Social data label: Libellé du champ Données sociales
-Users visible: Visibilté du champ Utilisateurs
+Social issues visible: Visibilité du champ Problématiques sociales
+Social issues label: Libellé du champ Problématiques sociales
+Social actions visible: Visibilité du champ Action sociale
+Social actions label: Libellé du champ Action sociale
+Users visible: Visibilité du champ Utilisateurs
Users label: Libellé du champ Utilisateurs
+Sent received visible: Visibilité du champ Entrant / Sortant
+Sent received label: Libellé du champ Entrant / Sortant
+Documents visible: Visibilité du champ Documents
+Documents label: Libellé du champ Documents
# activity type category admin
ActivityTypeCategory list: Liste des catégories des types d'activité
diff --git a/src/Bundle/ChillActivityBundle/translations/validators.fr.yml b/src/Bundle/ChillActivityBundle/translations/validators.fr.yml
index edda0b67b..072ac55d2 100644
--- a/src/Bundle/ChillActivityBundle/translations/validators.fr.yml
+++ b/src/Bundle/ChillActivityBundle/translations/validators.fr.yml
@@ -1,2 +1,22 @@
The reasons's level should not be empty: Le niveau du sujet ne peut pas être vide
At least one reason must be choosen: Au moins un sujet doit être choisi
+For this type of activity, you must add at least one person: Pour ce type d'activité, vous devez ajouter au moins un usager
+For this type of activity, you must add at least one user: Pour ce type d'activité, vous devez ajouter au moins un utilisateur
+For this type of activity, you must add at least one third party: Pour ce type d'activité, vous devez ajouter au moins un tiers
+For this type of activity, user is required: Pour ce type d'activité, l'utilisateur est requis
+For this type of activity, date is required: Pour ce type d'activité, la date est requise
+For this type of activity, location is required: Pour ce type d'activité, la localisation est requise
+For this type of activity, attendee is required: Pour ce type d'activité, le champ "Présence de la personne" est requis
+For this type of activity, duration time is required: Pour ce type d'activité, la durée est requise
+For this type of activity, travel time is required: Pour ce type d'activité, la durée du trajet est requise
+For this type of activity, reasons is required: Pour ce type d'activité, le champ "sujet" est requis
+For this type of activity, comment is required: Pour ce type d'activité, un commentaire est requis
+For this type of activity, sent/received is required: Pour ce type d'activité, le champ Entrant/Sortant est requis
+For this type of activity, document is required: Pour ce type d'activité, un document est requis
+For this type of activity, emergency is required: Pour ce type d'activité, le champ "Urgent" est requis
+For this type of activity, accompanying period is required: Pour ce type d'activité, le parcours d'accompagnement est requis
+For this type of activity, you must add at least one social issue: Pour ce type d'activité, vous devez ajouter au moins une problématique sociale
+For this type of activity, you must add at least one social action: Pour ce type d'activité, vous devez indiquez au moins une action sociale
+
+# admin
+This parameter must be equal to social issue parameter: Ce paramètre doit être égal au paramètre "Visibilité du champs Problématiques sociales"
diff --git a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityCategoryController.php b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityCategoryController.php
index 90029bb20..43b2d2362 100644
--- a/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityCategoryController.php
+++ b/src/Bundle/ChillAsideActivityBundle/src/Controller/AsideActivityCategoryController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AsideActivityBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
diff --git a/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php
index 05a498c46..e6fdbb5fe 100644
--- a/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php
+++ b/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivity.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AsideActivityBundle\DataFixtures\ORM;
use Chill\AsideActivityBundle\Entity\AsideActivity;
diff --git a/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivityCategory.php b/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivityCategory.php
index d09652640..da5cb721b 100644
--- a/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivityCategory.php
+++ b/src/Bundle/ChillAsideActivityBundle/src/DataFixtures/ORM/LoadAsideActivityCategory.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AsideActivityBundle\DataFixtures\ORM;
use Chill\AsideActivityBundle\Entity\AsideActivityCategory;
diff --git a/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/Configuration.php b/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/Configuration.php
index bcfc0b9a4..3032e1b2c 100644
--- a/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/Configuration.php
@@ -7,10 +7,13 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AsideActivityBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
+use function is_int;
class Configuration implements ConfigurationInterface
{
@@ -124,7 +127,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/ChillAsideActivityBundle/src/Entity/AsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php
index fc0eca9cd..2f4efe580 100644
--- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php
+++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php
@@ -22,7 +22,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\Entity
* @ORM\Table(schema="chill_asideactivity")
*/
-class AsideActivity implements TrackUpdateInterface, TrackCreationInterface
+class AsideActivity implements TrackCreationInterface, TrackUpdateInterface
{
/**
* @ORM\ManyToOne(targetEntity=User::class)
diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php
index efc368ecc..73f937ff1 100644
--- a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php
+++ b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AsideActivityBundle\Form;
use Chill\AsideActivityBundle\Entity\AsideActivity;
@@ -17,6 +19,7 @@ use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\ChillTextareaType;
use DateInterval;
use DateTime;
+use DateTimeImmutable;
use DateTimeZone;
use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
@@ -29,6 +32,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;
final class AsideActivityFormType extends AbstractType
{
@@ -71,7 +75,7 @@ final class AsideActivityFormType extends AbstractType
'required' => true,
'class' => User::class,
'data' => $this->storage->getToken()->getUser(),
- 'query_builder' => function (EntityRepository $er) {
+ 'query_builder' => static function (EntityRepository $er) {
return $er->createQueryBuilder('u')->where('u.enabled = true');
},
'attr' => ['class' => 'select2 '],
@@ -96,7 +100,7 @@ final class AsideActivityFormType extends AbstractType
'required' => true,
'class' => AsideActivityCategory::class,
'placeholder' => 'Choose the activity category',
- 'query_builder' => function (EntityRepository $er) {
+ 'query_builder' => static function (EntityRepository $er) {
$qb = $er->createQueryBuilder('ac');
$qb->where($qb->expr()->eq('ac.isActive', 'TRUE'))
->addOrderBy('ac.ordering', 'ASC');
@@ -121,7 +125,7 @@ final class AsideActivityFormType 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,
@@ -131,7 +135,7 @@ final class AsideActivityFormType 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 \DateTimeImmutable */
+ /** @var DateTimeImmutable $data */
$data = $formEvent->getData() === null ?
DateTime::createFromFormat('U', 300) :
$formEvent->getData();
@@ -141,7 +145,7 @@ final class AsideActivityFormType 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/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php b/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php
index 3ca65be28..2d5968e48 100644
--- a/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php
+++ b/src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php
@@ -7,10 +7,13 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AsideActivityBundle\Menu;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Security;
+use function in_array;
final class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
{
@@ -28,7 +31,7 @@ final class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuild
return;
}
- if (in_array($menuId, ['admin_index', 'admin_section'])) {
+ if (in_array($menuId, ['admin_index', 'admin_section'], true)) {
$menu->addChild('Aside activities', [
'route' => 'chill_crud_aside_activity_category_index',
])
diff --git a/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php b/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php
index 078ae8a76..700ee58f1 100644
--- a/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php
+++ b/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AsideActivityBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
diff --git a/src/Bundle/ChillAsideActivityBundle/src/Menu/UserMenuBuilder.php b/src/Bundle/ChillAsideActivityBundle/src/Menu/UserMenuBuilder.php
index e7d6f5e67..943aeed4c 100644
--- a/src/Bundle/ChillAsideActivityBundle/src/Menu/UserMenuBuilder.php
+++ b/src/Bundle/ChillAsideActivityBundle/src/Menu/UserMenuBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AsideActivityBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
@@ -28,7 +30,7 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
*/
public $counter;
- /*
+ /**
* @var TokenStorageInterface
*/
public $tokenStorage;
diff --git a/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php b/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php
index 7d0b69bd1..8b49098e4 100644
--- a/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php
+++ b/src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AsideActivityBundle\Templating\Entity;
use Chill\AsideActivityBundle\Entity\AsideActivityCategory;
diff --git a/src/Bundle/ChillAsideActivityBundle/src/Tests/Controller/AsideActivityControllerTest.php b/src/Bundle/ChillAsideActivityBundle/src/Tests/Controller/AsideActivityControllerTest.php
index a0ad9828f..3f8a514d2 100644
--- a/src/Bundle/ChillAsideActivityBundle/src/Tests/Controller/AsideActivityControllerTest.php
+++ b/src/Bundle/ChillAsideActivityBundle/src/Tests/Controller/AsideActivityControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AsideActivityBundle\Tests\Controller;
use Chill\AsideActivityBundle\Entity\AsideActivity;
@@ -20,7 +22,7 @@ use function shuffle;
* @internal
* @coversNothing
*/
-class AccompanyingCourseControllerTest extends WebTestCase
+final class AsideActivityControllerTest extends WebTestCase
{
use PrepareClientTrait;
diff --git a/src/Bundle/ChillBudgetBundle/Calculator/CalculatorInterface.php b/src/Bundle/ChillBudgetBundle/Calculator/CalculatorInterface.php
index 3a9290c56..707ae0221 100644
--- a/src/Bundle/ChillBudgetBundle/Calculator/CalculatorInterface.php
+++ b/src/Bundle/ChillBudgetBundle/Calculator/CalculatorInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\Calculator;
use Chill\AMLI\BudgetBundle\Entity\AbstractElement;
diff --git a/src/Bundle/ChillBudgetBundle/Calculator/CalculatorManager.php b/src/Bundle/ChillBudgetBundle/Calculator/CalculatorManager.php
index 2057aadde..2a9a89b13 100644
--- a/src/Bundle/ChillBudgetBundle/Calculator/CalculatorManager.php
+++ b/src/Bundle/ChillBudgetBundle/Calculator/CalculatorManager.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\Calculator;
use Chill\AMLI\BudgetBundle\Entity\AbstractElement;
diff --git a/src/Bundle/ChillBudgetBundle/Calculator/CalculatorResult.php b/src/Bundle/ChillBudgetBundle/Calculator/CalculatorResult.php
index e99edab6d..7de147ffb 100644
--- a/src/Bundle/ChillBudgetBundle/Calculator/CalculatorResult.php
+++ b/src/Bundle/ChillBudgetBundle/Calculator/CalculatorResult.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\Calculator;
class CalculatorResult
diff --git a/src/Bundle/ChillBudgetBundle/ChillAMLIBudgetBundle.php b/src/Bundle/ChillBudgetBundle/ChillAMLIBudgetBundle.php
index 60f848056..add60c5df 100644
--- a/src/Bundle/ChillBudgetBundle/ChillAMLIBudgetBundle.php
+++ b/src/Bundle/ChillBudgetBundle/ChillAMLIBudgetBundle.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle;
use Chill\AMLI\BudgetBundle\DependencyInjection\Compiler\CalculatorCompilerPass;
diff --git a/src/Bundle/ChillBudgetBundle/Config/ConfigRepository.php b/src/Bundle/ChillBudgetBundle/Config/ConfigRepository.php
index 1302b8414..dc3ffe20d 100644
--- a/src/Bundle/ChillBudgetBundle/Config/ConfigRepository.php
+++ b/src/Bundle/ChillBudgetBundle/Config/ConfigRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\Config;
class ConfigRepository
diff --git a/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php b/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php
index fd4f77f93..fd596cc3a 100644
--- a/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php
+++ b/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\Controller;
use Chill\AMLI\BudgetBundle\Entity\AbstractElement;
@@ -19,6 +21,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Translation\TranslatorInterface;
+use function get_class;
abstract class AbstractElementController extends Controller
{
@@ -111,7 +114,7 @@ abstract class AbstractElementController extends Controller
$form->handleRequest($request);
- if ($form->isSubmitted() and $form->isValid()) {
+ if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->flush();
@@ -135,7 +138,7 @@ abstract class AbstractElementController extends Controller
*/
protected function _new(Person $person, Request $request, $template, $flashMessageOnSuccess)
{
- /* @var $element \Chill\AMLI\BudgetBundle\Entity\AbstractElement */
+ /** @var \Chill\AMLI\BudgetBundle\Entity\AbstractElement $element */
$element = $this->createNewElement()
->setPerson($person);
@@ -146,7 +149,7 @@ abstract class AbstractElementController extends Controller
$form->handleRequest($request);
- if ($form->isSubmitted() and $form->isValid()) {
+ if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($element);
$em->flush();
diff --git a/src/Bundle/ChillBudgetBundle/Controller/ChargeController.php b/src/Bundle/ChillBudgetBundle/Controller/ChargeController.php
index 50e7bacd1..b06773609 100644
--- a/src/Bundle/ChillBudgetBundle/Controller/ChargeController.php
+++ b/src/Bundle/ChillBudgetBundle/Controller/ChargeController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\Controller;
use Chill\AMLI\BudgetBundle\Entity\Charge;
diff --git a/src/Bundle/ChillBudgetBundle/Controller/ElementController.php b/src/Bundle/ChillBudgetBundle/Controller/ElementController.php
index ee0fc30d0..b0c01732b 100644
--- a/src/Bundle/ChillBudgetBundle/Controller/ElementController.php
+++ b/src/Bundle/ChillBudgetBundle/Controller/ElementController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\Controller;
use Chill\AMLI\BudgetBundle\Calculator\CalculatorManager;
@@ -21,6 +23,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Translation\TranslatorInterface;
use function array_merge;
+use function count;
class ElementController extends Controller
{
diff --git a/src/Bundle/ChillBudgetBundle/Controller/ResourceController.php b/src/Bundle/ChillBudgetBundle/Controller/ResourceController.php
index 7ab00a798..4ee8bd082 100644
--- a/src/Bundle/ChillBudgetBundle/Controller/ResourceController.php
+++ b/src/Bundle/ChillBudgetBundle/Controller/ResourceController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\Controller;
use Chill\AMLI\BudgetBundle\Entity\Resource;
diff --git a/src/Bundle/ChillBudgetBundle/DependencyInjection/ChillAMLIBudgetExtension.php b/src/Bundle/ChillBudgetBundle/DependencyInjection/ChillAMLIBudgetExtension.php
index 9ef18763f..bea107131 100644
--- a/src/Bundle/ChillBudgetBundle/DependencyInjection/ChillAMLIBudgetExtension.php
+++ b/src/Bundle/ChillBudgetBundle/DependencyInjection/ChillAMLIBudgetExtension.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\DependencyInjection;
use Chill\AMLI\BudgetBundle\Security\Authorization\BudgetElementVoter;
@@ -47,7 +49,7 @@ class ChillAMLIBudgetExtension extends Extension implements PrependExtensionInte
$this->prependRoutes($container);
}
- /* (non-PHPdoc)
+ /** (non-PHPdoc).
* @see \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface::prepend()
*/
public function prependRoutes(ContainerBuilder $container)
diff --git a/src/Bundle/ChillBudgetBundle/DependencyInjection/Compiler/CalculatorCompilerPass.php b/src/Bundle/ChillBudgetBundle/DependencyInjection/Compiler/CalculatorCompilerPass.php
index 7e750868f..0a53e5160 100644
--- a/src/Bundle/ChillBudgetBundle/DependencyInjection/Compiler/CalculatorCompilerPass.php
+++ b/src/Bundle/ChillBudgetBundle/DependencyInjection/Compiler/CalculatorCompilerPass.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
diff --git a/src/Bundle/ChillBudgetBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillBudgetBundle/DependencyInjection/Configuration.php
index bfc4c4705..407be6bff 100644
--- a/src/Bundle/ChillBudgetBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillBudgetBundle/DependencyInjection/Configuration.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
diff --git a/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php b/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php
index 72fa2b88d..5f43c4262 100644
--- a/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php
+++ b/src/Bundle/ChillBudgetBundle/Entity/AbstractElement.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\Entity;
use Chill\PersonBundle\Entity\Person;
@@ -136,7 +138,7 @@ abstract class AbstractElement
public function isEmpty()
{
- return 0 == $this->amount;
+ return 0 === $this->amount;
}
abstract public function isResource(): bool;
diff --git a/src/Bundle/ChillBudgetBundle/Entity/Charge.php b/src/Bundle/ChillBudgetBundle/Entity/Charge.php
index 455bb9043..e893f99af 100644
--- a/src/Bundle/ChillBudgetBundle/Entity/Charge.php
+++ b/src/Bundle/ChillBudgetBundle/Entity/Charge.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\Entity;
use Chill\MainBundle\Entity\HasCenterInterface;
diff --git a/src/Bundle/ChillBudgetBundle/Entity/Resource.php b/src/Bundle/ChillBudgetBundle/Entity/Resource.php
index 9963de94c..bd13e0dd0 100644
--- a/src/Bundle/ChillBudgetBundle/Entity/Resource.php
+++ b/src/Bundle/ChillBudgetBundle/Entity/Resource.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\Entity;
use Chill\MainBundle\Entity\HasCenterInterface;
diff --git a/src/Bundle/ChillBudgetBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillBudgetBundle/Menu/UserMenuBuilder.php
index 7b8705511..d97080d11 100644
--- a/src/Bundle/ChillBudgetBundle/Menu/UserMenuBuilder.php
+++ b/src/Bundle/ChillBudgetBundle/Menu/UserMenuBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\Menu;
use Chill\AMLI\BudgetBundle\Security\Authorization\BudgetElementVoter;
@@ -37,7 +39,7 @@ class UserMenuBuilder 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(BudgetElementVoter::SHOW, $person)) {
diff --git a/src/Bundle/ChillBudgetBundle/Repository/ChargeRepository.php b/src/Bundle/ChillBudgetBundle/Repository/ChargeRepository.php
index c8cb7cab0..56f21b6fb 100644
--- a/src/Bundle/ChillBudgetBundle/Repository/ChargeRepository.php
+++ b/src/Bundle/ChillBudgetBundle/Repository/ChargeRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\Repository;
use Chill\PersonBundle\Entity\Person;
diff --git a/src/Bundle/ChillBudgetBundle/Repository/ResourceRepository.php b/src/Bundle/ChillBudgetBundle/Repository/ResourceRepository.php
index 91bd7f258..f7440a281 100644
--- a/src/Bundle/ChillBudgetBundle/Repository/ResourceRepository.php
+++ b/src/Bundle/ChillBudgetBundle/Repository/ResourceRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\Repository;
use Chill\PersonBundle\Entity\Person;
diff --git a/src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php b/src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php
index 3c2a41226..71a5f2523 100644
--- a/src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php
+++ b/src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\Security\Authorization;
use Chill\AMLI\BudgetBundle\Entity\AbstractElement;
@@ -62,8 +64,8 @@ class BudgetElementVoter extends AbstractChillVoter implements ProvideRoleHierar
protected function supports($attribute, $subject)
{
- return (in_array($attribute, self::ROLES) && $subject instanceof AbstractElement)
- or ($subject instanceof Person && in_array($attribute, [self::SHOW, self::CREATE]));
+ return (in_array($attribute, self::ROLES, true) && $subject instanceof AbstractElement)
+ || ($subject instanceof Person && in_array($attribute, [self::SHOW, self::CREATE], true));
}
protected function voteOnAttribute($attribute, $subject, \Symfony\Component\Security\Core\Authentication\Token\TokenInterface $token)
diff --git a/src/Bundle/ChillBudgetBundle/Templating/Twig.php b/src/Bundle/ChillBudgetBundle/Templating/Twig.php
index aba53f3c4..b477e9a14 100644
--- a/src/Bundle/ChillBudgetBundle/Templating/Twig.php
+++ b/src/Bundle/ChillBudgetBundle/Templating/Twig.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\Templating;
use Chill\AMLI\BudgetBundle\Config\ConfigRepository;
diff --git a/src/Bundle/ChillBudgetBundle/Tests/Controller/ElementControllerTest.php b/src/Bundle/ChillBudgetBundle/Tests/Controller/ElementControllerTest.php
index c25e2cc36..b82539150 100644
--- a/src/Bundle/ChillBudgetBundle/Tests/Controller/ElementControllerTest.php
+++ b/src/Bundle/ChillBudgetBundle/Tests/Controller/ElementControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\BudgetBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -15,18 +17,18 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class ElementControllerTest extends WebTestCase
+final class ElementControllerTest extends WebTestCase
{
public function testIndex()
{
- $client = static::createClient();
+ $client = self::createClient();
$crawler = $client->request('GET', '/index');
}
public function testList()
{
- $client = static::createClient();
+ $client = self::createClient();
$crawler = $client->request('GET', '/list');
}
diff --git a/src/Bundle/ChillCalendarBundle/ChillCalendarBundle.php b/src/Bundle/ChillCalendarBundle/ChillCalendarBundle.php
index a42c0eca1..11b985224 100644
--- a/src/Bundle/ChillCalendarBundle/ChillCalendarBundle.php
+++ b/src/Bundle/ChillCalendarBundle/ChillCalendarBundle.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php
index 2eb4c5ade..70cf34cd4 100644
--- a/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php
+++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarAPIController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php
index 0165142f7..68640f3f4 100644
--- a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php
+++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php
@@ -80,7 +80,7 @@ class CalendarController extends AbstractController
$view = '@ChillCalendar/Calendar/confirm_deleteByUser.html.twig';
}
- /* @var $entity Calendar */
+ /** @var Calendar $entity */
$entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id);
if (!$entity) {
@@ -160,7 +160,7 @@ class CalendarController extends AbstractController
return $this->redirectToRoute('chill_calendar_calendar_list', $params);
}
- if ($form->isSubmitted() and !$form->isValid()) {
+ if ($form->isSubmitted() && !$form->isValid()) {
$this->addFlash('error', $this->get('translator')->trans('This form contains errors'));
}
@@ -272,7 +272,7 @@ class CalendarController extends AbstractController
return $this->redirectToRoute('chill_calendar_calendar_list', $params);
}
- if ($form->isSubmitted() and !$form->isValid()) {
+ if ($form->isSubmitted() && !$form->isValid()) {
$this->addFlash('error', $this->get('translator')->trans('This form contains errors'));
}
@@ -332,12 +332,12 @@ class CalendarController extends AbstractController
$personsId = array_map(
static fn (Person $p): int => $p->getId(),
- $entity->getPersons()
+ $entity->getPersons()->toArray()
);
$professionalsId = array_map(
static fn (ThirdParty $thirdParty): ?int => $thirdParty->getId(),
- $entity->getProfessionals()
+ $entity->getProfessionals()->toArray()
);
$durationTime = $entity->getEndDate()->diff($entity->getStartDate());
diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php
index 4334667dd..f62323a29 100644
--- a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php
+++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
@@ -14,6 +16,7 @@ use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
+use function count;
class CalendarRangeAPIController extends ApiController
{
@@ -24,7 +27,7 @@ class CalendarRangeAPIController extends ApiController
{
$em = $this->getDoctrine()->getManager();
- $sql = 'SELECT c FROM ChillCalendarBundle:CalendarRange c
+ $sql = 'SELECT c FROM ChillCalendarBundle:CalendarRange c
WHERE NOT EXISTS (SELECT cal.id FROM ChillCalendarBundle:Calendar cal WHERE cal.calendarRange = c.id)';
if ($request->query->has('user')) {
diff --git a/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCancelReason.php b/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCancelReason.php
index 508195081..fca57288e 100644
--- a/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCancelReason.php
+++ b/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadCancelReason.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle\DataFixtures\ORM;
use Chill\CalendarBundle\Entity\CancelReason;
diff --git a/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadInvite.php b/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadInvite.php
index 926797899..77519d773 100644
--- a/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadInvite.php
+++ b/src/Bundle/ChillCalendarBundle/DataFixtures/ORM/LoadInvite.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle\DataFixtures\ORM;
use Chill\CalendarBundle\Entity\Invite;
diff --git a/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php b/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php
index 3ac0b54ad..d0a5c3d94 100644
--- a/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php
+++ b/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle\DependencyInjection;
use Symfony\Component\Config\FileLocator;
diff --git a/src/Bundle/ChillCalendarBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillCalendarBundle/DependencyInjection/Configuration.php
index 0d1c32d3f..f1e744cb8 100644
--- a/src/Bundle/ChillCalendarBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillCalendarBundle/DependencyInjection/Configuration.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
diff --git a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php
index ff6259c62..d026b399c 100644
--- a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php
+++ b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle\Entity;
use Chill\ActivityBundle\Entity\Activity;
@@ -26,6 +28,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Range;
use Symfony\Component\Validator\Mapping\ClassMetadata;
+use function in_array;
/**
* @ORM\Table(name="chill_calendar.calendar")
@@ -263,7 +266,7 @@ class Calendar
$personsNotAssociated = [];
foreach ($this->persons as $person) {
- if (!in_array($person, $this->getPersonsAssociated())) {
+ if (!in_array($person, $this->getPersonsAssociated(), true)) {
$personsNotAssociated[] = $person;
}
}
diff --git a/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php b/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php
index 0a749c0ba..b29a9db08 100644
--- a/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php
+++ b/src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle\Entity;
use Chill\CalendarBundle\Repository\CalendarRangeRepository;
diff --git a/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php b/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php
index 4d8236c9a..635508671 100644
--- a/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php
+++ b/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle\Entity;
use Chill\CalendarBundle\Repository\CancelReasonRepository;
diff --git a/src/Bundle/ChillCalendarBundle/Entity/Invite.php b/src/Bundle/ChillCalendarBundle/Entity/Invite.php
index 7204f8067..464c5485a 100644
--- a/src/Bundle/ChillCalendarBundle/Entity/Invite.php
+++ b/src/Bundle/ChillCalendarBundle/Entity/Invite.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle\Entity;
use Chill\CalendarBundle\Repository\InviteRepository;
diff --git a/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php b/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php
index ab06ac71f..c79cccbf5 100644
--- a/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php
+++ b/src/Bundle/ChillCalendarBundle/Event/ListenToActivityCreate.php
@@ -7,11 +7,14 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle\Event;
use Chill\ActivityBundle\Entity\Activity;
use Doctrine\Persistence\Event\LifecycleEventArgs;
use Symfony\Component\HttpFoundation\RequestStack;
+use function array_key_exists;
class ListenToActivityCreate
{
diff --git a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php
index 1ed91894e..f36c7f07b 100644
--- a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php
+++ b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle\Form;
use Chill\CalendarBundle\Entity\Calendar;
@@ -69,7 +71,7 @@ class CalendarType extends AbstractType
$builder->add('mainUser', HiddenType::class);
$builder->get('mainUser')
->addModelTransformer(new CallbackTransformer(
- function (?User $user): int {
+ static function (?User $user): int {
if (null !== $user) {
$res = $user->getId();
} else {
@@ -86,7 +88,7 @@ class CalendarType extends AbstractType
$builder->add('startDate', HiddenType::class);
$builder->get('startDate')
->addModelTransformer(new CallbackTransformer(
- function (?DateTimeImmutable $dateTimeImmutable): string {
+ static function (?DateTimeImmutable $dateTimeImmutable): string {
if (null !== $dateTimeImmutable) {
$res = date_format($dateTimeImmutable, 'Y-m-d H:i:s');
} else {
@@ -95,7 +97,7 @@ class CalendarType extends AbstractType
return $res;
},
- function (?string $dateAsString): DateTimeImmutable {
+ static function (?string $dateAsString): DateTimeImmutable {
dump($dateAsString);
return new DateTimeImmutable($dateAsString);
@@ -105,7 +107,7 @@ class CalendarType extends AbstractType
$builder->add('endDate', HiddenType::class);
$builder->get('endDate')
->addModelTransformer(new CallbackTransformer(
- function (?DateTimeImmutable $dateTimeImmutable): string {
+ static function (?DateTimeImmutable $dateTimeImmutable): string {
if (null !== $dateTimeImmutable) {
$res = date_format($dateTimeImmutable, 'Y-m-d H:i:s');
} else {
@@ -114,7 +116,7 @@ class CalendarType extends AbstractType
return $res;
},
- function (?string $dateAsString): DateTimeImmutable {
+ static function (?string $dateAsString): DateTimeImmutable {
return new DateTimeImmutable($dateAsString);
}
));
@@ -122,7 +124,7 @@ class CalendarType 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) {
@@ -142,7 +144,7 @@ class CalendarType extends AbstractType
$builder->add('professionals', HiddenType::class);
$builder->get('professionals')
->addModelTransformer(new CallbackTransformer(
- function (iterable $thirdpartyAsIterable): string {
+ static function (iterable $thirdpartyAsIterable): string {
$thirdpartyIds = [];
foreach ($thirdpartyAsIterable as $value) {
@@ -162,7 +164,7 @@ class CalendarType extends AbstractType
$builder->add('calendarRange', HiddenType::class);
$builder->get('calendarRange')
->addModelTransformer(new CallbackTransformer(
- function (?CalendarRange $calendarRange): ?int {
+ static function (?CalendarRange $calendarRange): ?int {
if (null !== $calendarRange) {
$res = $calendarRange->getId();
} else {
@@ -185,7 +187,7 @@ class CalendarType 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 '';
}
@@ -200,7 +202,7 @@ class CalendarType extends AbstractType
$builder->add('invites', HiddenType::class);
$builder->get('invites')
->addModelTransformer(new CallbackTransformer(
- function (iterable $usersAsIterable): string {
+ static function (iterable $usersAsIterable): string {
$userIds = [];
foreach ($usersAsIterable as $value) {
diff --git a/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php b/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php
index 451dee836..eca770fe0 100644
--- a/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php
+++ b/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
diff --git a/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php
index 6561808fc..37526c25e 100644
--- a/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php
+++ b/src/Bundle/ChillCalendarBundle/Menu/UserMenuBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
@@ -28,7 +30,7 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
*/
public $counter;
- /*
+ /**
* @var TokenStorageInterface
*/
public $tokenStorage;
diff --git a/src/Bundle/ChillCalendarBundle/Repository/CalendarRangeRepository.php b/src/Bundle/ChillCalendarBundle/Repository/CalendarRangeRepository.php
index aaa5a2a23..5286c5515 100644
--- a/src/Bundle/ChillCalendarBundle/Repository/CalendarRangeRepository.php
+++ b/src/Bundle/ChillCalendarBundle/Repository/CalendarRangeRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle\Repository;
use Chill\CalendarBundle\Entity\CalendarRange;
diff --git a/src/Bundle/ChillCalendarBundle/Repository/CalendarRepository.php b/src/Bundle/ChillCalendarBundle/Repository/CalendarRepository.php
index 2789d83b9..55fba5f80 100644
--- a/src/Bundle/ChillCalendarBundle/Repository/CalendarRepository.php
+++ b/src/Bundle/ChillCalendarBundle/Repository/CalendarRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle\Repository;
use Chill\CalendarBundle\Entity\Calendar;
diff --git a/src/Bundle/ChillCalendarBundle/Repository/CancelReasonRepository.php b/src/Bundle/ChillCalendarBundle/Repository/CancelReasonRepository.php
index 20e01304a..47e0bfa44 100644
--- a/src/Bundle/ChillCalendarBundle/Repository/CancelReasonRepository.php
+++ b/src/Bundle/ChillCalendarBundle/Repository/CancelReasonRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle\Repository;
use Chill\CalendarBundle\Entity\CancelReason;
diff --git a/src/Bundle/ChillCalendarBundle/Repository/InviteRepository.php b/src/Bundle/ChillCalendarBundle/Repository/InviteRepository.php
index 73f7c1299..53aa8b2a1 100644
--- a/src/Bundle/ChillCalendarBundle/Repository/InviteRepository.php
+++ b/src/Bundle/ChillCalendarBundle/Repository/InviteRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle\Repository;
use Chill\CalendarBundle\Entity\Invite;
diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store.js
index 457d31799..edfb7f236 100644
--- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store.js
+++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/store.js
@@ -1,5 +1,6 @@
import 'es6-promise/auto';
import { createStore } from 'vuex';
+import { postLocation } from 'ChillActivityAssets/vuejs/Activity/api';
const debug = process.env.NODE_ENV !== 'production';
@@ -33,7 +34,6 @@ const store = createStore({
},
getters: {
suggestedEntities(state) {
- console.log(state.activity)
if (typeof(state.activity.accompanyingPeriod) === 'undefined') {
return [];
}
@@ -189,8 +189,35 @@ const store = createStore({
updateLocation({ commit }, value) {
console.log('### action: updateLocation', value);
let hiddenLocation = document.getElementById("chill_calendarbundle_calendar_location");
- hiddenLocation.value = value.id;
- commit('updateLocation', value);
+ 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/ChillCalendarBundle/Resources/views/Calendar/show.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/show.html.twig
index 5dfde6fc3..7c59996d2 100644
--- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/show.html.twig
+++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/show.html.twig
@@ -41,8 +41,8 @@
{{ entity.location.address|chill_entity_render_box }}
{% else %}
diff --git a/src/Bundle/ChillCalendarBundle/Tests/Controller/CalendarControllerTest.php b/src/Bundle/ChillCalendarBundle/Tests/Controller/CalendarControllerTest.php
index 2ec95df65..06e0cd5a9 100644
--- a/src/Bundle/ChillCalendarBundle/Tests/Controller/CalendarControllerTest.php
+++ b/src/Bundle/ChillCalendarBundle/Tests/Controller/CalendarControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CalendarBundle\Tests\Controller;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
@@ -19,15 +21,15 @@ use function random_int;
* @internal
* @coversNothing
*/
-class CalendarControllerTest extends WebTestCase
+final class CalendarControllerTest extends WebTestCase
{
/**
* Setup before each test method (see phpunit doc).
*/
public function setUp()
{
- static::bootKernel();
- $this->client = static::createClient([], [
+ self::bootKernel();
+ $this->client = self::createClient([], [
'PHP_AUTH_USER' => 'center a_social',
'PHP_AUTH_PW' => 'password',
]);
@@ -35,8 +37,8 @@ class CalendarControllerTest extends WebTestCase
public function provideAccompanyingPeriod(): iterable
{
- static::bootKernel();
- $em = static::$container->get(EntityManagerInterface::class);
+ self::bootKernel();
+ $em = self::$container->get(EntityManagerInterface::class);
$nb = $em->createQueryBuilder()
->from(AccompanyingPeriod::class, 'ac')
diff --git a/src/Bundle/ChillCustomFieldsBundle/ChillCustomFieldsBundle.php b/src/Bundle/ChillCustomFieldsBundle/ChillCustomFieldsBundle.php
index 7bfa8572b..65cded145 100644
--- a/src/Bundle/ChillCustomFieldsBundle/ChillCustomFieldsBundle.php
+++ b/src/Bundle/ChillCustomFieldsBundle/ChillCustomFieldsBundle.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle;
use Chill\CustomFieldsBundle\DependencyInjection\CustomFieldCompilerPass;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php
index bf2772b8d..633f70f05 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Command;
use Chill\CustomFieldsBundle\Entity\CustomField;
@@ -23,6 +25,7 @@ use Symfony\Component\Console\Question\Question;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Parser;
+use function count;
/**
* Class for the command 'chill:custom_fields:populate_group' that
@@ -136,9 +139,9 @@ class CreateFieldsOnGroupCommand extends Command
"Enter the customfieldGroup's id on which the custom fields should be added: "
);
$question->setNormalizer(
- function ($answer) use ($customFieldsGroups) {
+ static function ($answer) use ($customFieldsGroups) {
foreach ($customFieldsGroups as $customFieldsGroup) {
- if ($customFieldsGroup->getId() == $answer) {
+ if ($customFieldsGroup->getId() === $answer) {
return $customFieldsGroup;
}
}
@@ -197,7 +200,7 @@ class CreateFieldsOnGroupCommand extends Command
$em->persist($cf);
$output->writeln('Adding Custom Field of type '
. $cf->getType() . "\t with slug " . $cf->getSlug() .
- "\t and names : " . implode($names, ', ') . '');
+ "\t and names : " . implode(', ', $names) . '');
} else {
throw new RuntimeException('Error in field ' . $slug);
}
@@ -236,7 +239,7 @@ class CreateFieldsOnGroupCommand extends Command
array_walk(
$customFieldsGroups,
- function (CustomFieldsGroup $customFieldGroup, $key) use ($languages, &$rows, $customizableEntities) {
+ static function (CustomFieldsGroup $customFieldGroup, $key) use ($languages, &$rows, $customizableEntities) {
//set id and entity
$row = [
$customFieldGroup->getId(),
diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/AdminController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/AdminController.php
index 4103dc96c..26a252cf5 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Controller/AdminController.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Controller/AdminController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php
index dff603613..4ec9a8c67 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Controller;
use Chill\CustomFieldsBundle\Entity\CustomField;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php
index 7c356f76d..5398c5f38 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Controller/CustomFieldsGroupController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Controller;
use Chill\CustomFieldsBundle\Entity\CustomField;
@@ -24,6 +26,7 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Contracts\Translation\TranslatorInterface;
+use function in_array;
/**
* Class CustomFieldsGroupController.
@@ -116,7 +119,7 @@ class CustomFieldsGroupController extends AbstractController
$makeDefaultFormViews = [];
foreach ($cfGroups as $group) {
- if (!in_array($group->getId(), $defaultGroups)) {
+ if (!in_array($group->getId(), $defaultGroups, true)) {
$makeDefaultFormViews[$group->getId()] = $this->createMakeDefaultForm($group)->createView();
}
}
@@ -418,7 +421,7 @@ class CustomFieldsGroupController extends AbstractController
. 'customizables_entities');
foreach ($options as $key => $definition) {
- if ($definition['class'] == $entity) {
+ if ($definition['class'] === $entity) {
foreach ($definition['options'] as $key => $value) {
yield $key;
}
diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/AbstractCustomField.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/AbstractCustomField.php
index 3d551cde5..d821ff591 100644
--- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/AbstractCustomField.php
+++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/AbstractCustomField.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\CustomFields;
use Chill\CustomFieldsBundle\Entity\CustomField;
@@ -15,6 +17,6 @@ abstract class AbstractCustomField implements CustomFieldInterface
{
public function isEmptyValue($value, CustomField $customField)
{
- return empty($value) and false !== $value;
+ return empty($value) && false !== $value;
}
}
diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php
index 856ac8ae9..718f5dbb7 100644
--- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php
+++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\CustomFields;
use Chill\CustomFieldsBundle\Entity\CustomField;
@@ -21,6 +23,10 @@ use Symfony\Bridge\Twig\TwigEngine;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
+use function array_key_exists;
+use function count;
+use function in_array;
+use function is_array;
use function LogicException;
class CustomFieldChoice extends AbstractCustomField
@@ -86,7 +92,7 @@ class CustomFieldChoice extends AbstractCustomField
];
//if allow_other = true
- if (true == $customFieldOptions[self::ALLOW_OTHER]) {
+ if (true === $customFieldOptions[self::ALLOW_OTHER]) {
$otherValueLabel = null;
if (array_key_exists(self::OTHER_VALUE_LABEL, $customFieldOptions)) {
@@ -191,7 +197,7 @@ class CustomFieldChoice extends AbstractCustomField
if ($this->allowOtherChoice($cf)) {
$labels = $cf->getOptions()[self::OTHER_VALUE_LABEL];
- if (!is_array($labels) or count($labels) === 0) {
+ if (!is_array($labels) || count($labels) === 0) {
$labels['back'] = 'other value';
}
$choices['_other'] = $this->translatableStringHelper
@@ -229,10 +235,10 @@ class CustomFieldChoice extends AbstractCustomField
if ($cf->getOptions()[self::MULTIPLE]) {
if ($cf->getOptions()[self::ALLOW_OTHER]) {
- return \in_array($choiceSlug, $this->deserialize($data, $cf)['_choices']);
+ return in_array($choiceSlug, $this->deserialize($data, $cf)['_choices'], true);
}
- return \in_array($choiceSlug, $this->deserialize($data, $cf));
+ return in_array($choiceSlug, $this->deserialize($data, $cf), true);
}
if ($cf->getOptions()[self::ALLOW_OTHER]) {
@@ -291,13 +297,13 @@ class CustomFieldChoice extends AbstractCustomField
$selected = (is_array($data)) ? $data : [$data];
$choices = $customField->getOptions()[self::CHOICES];
- if (in_array('_other', $selected)) {
+ if (in_array('_other', $selected, true)) {
$choices[] = ['name' => $value['_other'], 'slug' => '_other'];
}
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:choice.html.twig';
- if ('csv' == $documentType) {
+ if ('csv' === $documentType) {
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:choice.csv.twig';
}
diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php
index 10842c43b..1afa9982a 100644
--- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php
+++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldDate.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\CustomFields;
use Chill\CustomFieldsBundle\Entity\CustomField;
@@ -77,7 +79,7 @@ class CustomFieldDate extends AbstractCustomField
public function buildOptionsForm(FormBuilderInterface $builder)
{
- $validatorFunction = function ($value, ExecutionContextInterface $context) {
+ $validatorFunction = static function ($value, ExecutionContextInterface $context) {
try {
$date = new DateTime($value);
} catch (Exception $e) {
@@ -179,7 +181,7 @@ class CustomFieldDate extends AbstractCustomField
// add constraints if required
if (null !== $options[self::MIN]) {
$fieldOptions['constraints'][] = new Callback(
- function ($timestamp, ExecutionContextInterface $context) use ($options) {
+ static function ($timestamp, ExecutionContextInterface $context) use ($options) {
if (null === $timestamp) {
return;
}
@@ -200,7 +202,7 @@ class CustomFieldDate extends AbstractCustomField
if (null !== $options[self::MAX]) {
$fieldOptions['constraints'][] = new Callback(
- function ($timestamp, ExecutionContextInterface $context) use ($options) {
+ static function ($timestamp, ExecutionContextInterface $context) use ($options) {
if (null === $timestamp) {
return;
}
diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldInterface.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldInterface.php
index 1c94d439b..fe0ffb8b9 100644
--- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldInterface.php
+++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\CustomFields;
use Chill\CustomFieldsBundle\Entity\CustomField;
diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php
index 233b11ed0..311df8fad 100644
--- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php
+++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldLongChoice.php
@@ -21,6 +21,9 @@ use LogicException;
use Symfony\Bridge\Twig\TwigEngine;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
+use function get_class;
+use function gettype;
+use function is_object;
class CustomFieldLongChoice extends AbstractCustomField
{
@@ -54,7 +57,7 @@ class CustomFieldLongChoice extends AbstractCustomField
$translatableStringHelper = $this->translatableStringHelper;
$builder->add($customField->getSlug(), Select2ChoiceType::class, [
'choices' => $entries,
- 'choice_label' => function (Option $option) use ($translatableStringHelper) {
+ 'choice_label' => static function (Option $option) use ($translatableStringHelper) {
return $translatableStringHelper->localize($option->getText());
},
'choice_value' => static fn (Option $key): ?int => null === $key ? null : $key->getId(),
@@ -62,7 +65,7 @@ class CustomFieldLongChoice extends AbstractCustomField
'expanded' => false,
'required' => $customField->isRequired(),
'placeholder' => 'Choose a value',
- 'group_by' => function (Option $option) use ($translatableStringHelper) {
+ 'group_by' => static function (Option $option) use ($translatableStringHelper) {
if ($option->hasParent()) {
return $translatableStringHelper->localize($option->getParent()->getText());
}
diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php
index e66a512d9..c7ec62ba2 100644
--- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php
+++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\CustomFields;
use Chill\CustomFieldsBundle\Entity\CustomField;
@@ -59,7 +61,7 @@ class CustomFieldNumber extends AbstractCustomField
$options = $customField->getOptions();
//select the type depending to the SCALE
- $type = (0 === $options[self::SCALE] or null === $options[self::SCALE]) ?
+ $type = (0 === $options[self::SCALE] || null === $options[self::SCALE]) ?
IntegerType::class : NumberType::class;
//'integer' : 'number';
diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php
index 8e2e9a80f..62325b797 100644
--- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php
+++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\CustomFields;
use Chill\CustomFieldsBundle\Entity\CustomField;
@@ -18,6 +20,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\RequestStack;
+use function array_key_exists;
class CustomFieldText extends AbstractCustomField
{
@@ -63,7 +66,7 @@ class CustomFieldText extends AbstractCustomField
$attrArray = [];
if (array_key_exists(self::MULTIPLE_CF_INLINE, $options)
- and $options[self::MULTIPLE_CF_INLINE]) {
+ && $options[self::MULTIPLE_CF_INLINE]) {
$attrArray['class'] = 'multiple-cf-inline';
}
@@ -102,7 +105,7 @@ class CustomFieldText extends AbstractCustomField
{
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:text.html.twig';
- if ('csv' == $documentType) {
+ if ('csv' === $documentType) {
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:text.csv.twig';
}
diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php
index 1c59c7d2e..4b1350499 100644
--- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php
+++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\CustomFields;
use Chill\CustomFieldsBundle\Entity\CustomField;
diff --git a/src/Bundle/ChillCustomFieldsBundle/DataFixtures/ORM/LoadOption.php b/src/Bundle/ChillCustomFieldsBundle/DataFixtures/ORM/LoadOption.php
index 8d1ba01ba..2777a0da5 100644
--- a/src/Bundle/ChillCustomFieldsBundle/DataFixtures/ORM/LoadOption.php
+++ b/src/Bundle/ChillCustomFieldsBundle/DataFixtures/ORM/LoadOption.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\DataFixtures\ORM;
use Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option;
@@ -102,7 +104,7 @@ class LoadOption extends AbstractFixture implements OrderedFixtureInterface
$manager->persist($parent);
//Load children
- $expected_nb_children = rand(10, 50);
+ $expected_nb_children = mt_rand(10, 50);
for ($i = 0; $i < $expected_nb_children; ++$i) {
$companyName = $this->fakerFr->company;
@@ -142,7 +144,7 @@ class LoadOption extends AbstractFixture implements OrderedFixtureInterface
$manager->persist($parent);
//Load children
- $expected_nb_children = rand(10, 50);
+ $expected_nb_children = mt_rand(10, 50);
for ($i = 0; $i < $expected_nb_children; ++$i) {
$manager->persist($this->createChildOption($parent, [
diff --git a/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/ChillCustomFieldsExtension.php b/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/ChillCustomFieldsExtension.php
index f8cf11e8e..98e22d1ef 100644
--- a/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/ChillCustomFieldsExtension.php
+++ b/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/ChillCustomFieldsExtension.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\DependencyInjection;
use Symfony\Component\Config\FileLocator;
@@ -48,7 +50,7 @@ class ChillCustomFieldsExtension extends Extension implements PrependExtensionIn
);
}
- /* (non-PHPdoc)
+ /** (non-PHPdoc).
* @see \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface::prepend()
*/
public function prepend(ContainerBuilder $container)
diff --git a/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/Configuration.php
index dcbd219b1..453254c4e 100644
--- a/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/Configuration.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
diff --git a/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/CustomFieldCompilerPass.php b/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/CustomFieldCompilerPass.php
index ddd91b0ef..198028360 100644
--- a/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/CustomFieldCompilerPass.php
+++ b/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/CustomFieldCompilerPass.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\DependencyInjection;
use LogicException;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php
index 74d8270cd..368bf92da 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php
index fbcfb644a..fe4f40149 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice;
use Doctrine\Common\Collections\Collection;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsDefaultGroup.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsDefaultGroup.php
index e219fa3e8..841a71306 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsDefaultGroup.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsDefaultGroup.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php
index 3c61a70f1..e5aa5fbbe 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
@@ -104,7 +106,7 @@ class CustomFieldsGroup
foreach ($this->customFields as $cf) {
if ($cf->isActive()) {
- array_push($this->activeCustomFields, $cf);
+ $this->activeCustomFields[] = $cf;
}
}
}
diff --git a/src/Bundle/ChillCustomFieldsBundle/EntityRepository/CustomFieldLongChoice/OptionRepository.php b/src/Bundle/ChillCustomFieldsBundle/EntityRepository/CustomFieldLongChoice/OptionRepository.php
index 134417df6..50a4a2c87 100644
--- a/src/Bundle/ChillCustomFieldsBundle/EntityRepository/CustomFieldLongChoice/OptionRepository.php
+++ b/src/Bundle/ChillCustomFieldsBundle/EntityRepository/CustomFieldLongChoice/OptionRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\EntityRepository\CustomFieldLongChoice;
use Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option;
@@ -55,7 +57,7 @@ class OptionRepository extends EntityRepository
->getQuery()
->getScalarResult();
- return array_map(function ($r) {
+ return array_map(static function ($r) {
return $r['key'];
}, $keys);
}
diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php
index 6e35b33fe..e45cc7837 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Form;
use Chill\CustomFieldsBundle\Form\DataTransformer\CustomFieldsGroupToIdTransformer;
@@ -88,7 +90,7 @@ class CustomFieldType extends AbstractType
'label' => 'Required field',
])
->add('type', HiddenType::class, ['data' => $options['type']])
- ->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
+ ->addEventListener(FormEvents::PRE_SET_DATA, static function (FormEvent $event) {
$customField = $event->getData();
$form = $event->getForm();
diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php
index 3055e64d2..f9d773f72 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldsGroupType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Form;
use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup;
@@ -18,6 +20,7 @@ use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Translation\TranslatorInterface;
+use function count;
class CustomFieldsGroupType extends AbstractType
{
@@ -54,7 +57,7 @@ class CustomFieldsGroupType extends AbstractType
$builder->addEventListener(
FormEvents::POST_SET_DATA,
- function (FormEvent $event) use ($customizableEntities, $builder) {
+ static function (FormEvent $event) use ($customizableEntities, $builder) {
$form = $event->getForm();
$group = $event->getData();
diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php
index 3efc2fa82..a82fe52d7 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldDataTransformer.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Form\DataTransformer;
use Chill\CustomFieldsBundle\CustomFields\CustomFieldInterface;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php
index 0600264f5..937aaaa9b 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php
@@ -7,12 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Form\DataTransformer;
use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
+use function gettype;
class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
{
@@ -43,12 +46,10 @@ class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
if ($id instanceof CustomFieldsGroup) {
throw new TransformationFailedException(
- sprintf(
- 'The transformation failed: the expected argument on '
+ 'The transformation failed: the expected argument on '
. 'reverseTransform is an object of type int,'
. 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup, '
. 'given'
- )
);
}
diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php
index b41586c99..095c6f463 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php
@@ -14,6 +14,8 @@ namespace Chill\CustomFieldsBundle\Form\DataTransformer;
use Chill\CustomFieldsBundle\Entity\CustomField;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\Form\DataTransformerInterface;
+use function array_key_exists;
+use const JSON_THROW_ON_ERROR;
class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
{
@@ -31,7 +33,7 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
// @TODO: in the array_map callback, CustomField::getLabel() does not exist. What do we do here?
$customFieldsLablels = array_map(
- function ($e) { return $e->getLabel(); },
+ static function ($e) { return $e->getLabel(); },
$customFields
);
diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Extension/PostTextExtension.php b/src/Bundle/ChillCustomFieldsBundle/Form/Extension/PostTextExtension.php
index ce6c9b65f..6c35097e5 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Form/Extension/PostTextExtension.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Form/Extension/PostTextExtension.php
@@ -7,12 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Form\Extension;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
+use function array_key_exists;
/**
* This extension create the possibility to add some text
diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Extension/PostTextIntegerExtension.php b/src/Bundle/ChillCustomFieldsBundle/Form/Extension/PostTextIntegerExtension.php
index 107fefd05..9208720d8 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Form/Extension/PostTextIntegerExtension.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Form/Extension/PostTextIntegerExtension.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Form\Extension;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Extension/PostTextNumberExtension.php b/src/Bundle/ChillCustomFieldsBundle/Form/Extension/PostTextNumberExtension.php
index 356c293ac..02a42ae67 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Form/Extension/PostTextNumberExtension.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Form/Extension/PostTextNumberExtension.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Form\Extension;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoiceWithOtherType.php b/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoiceWithOtherType.php
index debc3cdf5..92ef86c4a 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoiceWithOtherType.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoiceWithOtherType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
@@ -22,7 +24,7 @@ class ChoiceWithOtherType extends AbstractType
{
private $otherValueLabel = 'Other value';
- /* (non-PHPdoc)
+ /** (non-PHPdoc).
* @see \Symfony\Component\Form\AbstractType::buildForm()
*/
public function buildForm(FormBuilderInterface $builder, array $options)
@@ -39,7 +41,7 @@ class ChoiceWithOtherType extends AbstractType
->add('_choices', ChoiceType::class, $options);
}
- /* (non-PHPdoc)
+ /** (non-PHPdoc).
* @see \Symfony\Component\Form\AbstractType::configureOptions()
*/
public function configureOptions(OptionsResolver $resolver)
diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoicesListType.php b/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoicesListType.php
index a005af73c..b2d50b422 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoicesListType.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoicesListType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Form\Type;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
@@ -20,7 +22,7 @@ use Symfony\Component\Form\FormEvents;
class ChoicesListType extends AbstractType
{
- /* (non-PHPdoc)
+ /** (non-PHPdoc).
* @see \Symfony\Component\Form\AbstractType::buildForm()
*/
public function buildForm(FormBuilderInterface $builder, array $options)
@@ -30,14 +32,14 @@ class ChoicesListType extends AbstractType
'required' => false,
])
->add('slug', HiddenType::class)
- ->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) {
+ ->addEventListener(FormEvents::SUBMIT, static function (FormEvent $event) {
$form = $event->getForm();
$data = $event->getData();
$formData = $form->getData();
if (null === $formData['slug']) {
- $slug = uniqid(rand(), true);
+ $slug = uniqid(mt_rand(), true);
$data['slug'] = $slug;
$event->setData($data);
@@ -48,8 +50,7 @@ class ChoicesListType extends AbstractType
});
}
- /*
- *
+ /**
* @see \Symfony\Component\Form\FormTypeInterface::getName()
*/
public function getBlockPrefix()
diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoicesType.php b/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoicesType.php
index c6685caa7..ed7b52fca 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoicesType.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoicesType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldType.php b/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldType.php
index c3ea7bc52..e3ef7c694 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldType.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Form\Type;
use Chill\CustomFieldsBundle\Service\CustomFieldProvider;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldsTitleType.php b/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldsTitleType.php
index 7d65b115c..95d5a649f 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldsTitleType.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldsTitleType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php b/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php
index c705c3224..35a7cd305 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Form/Type/LinkedCustomFieldsType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Form\Type;
use Chill\MainBundle\Templating\TranslatableStringHelper;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Resources/test/Fixtures/App/app/AppKernel.php b/src/Bundle/ChillCustomFieldsBundle/Resources/test/Fixtures/App/app/AppKernel.php
index 554ed89e7..901806f8c 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Resources/test/Fixtures/App/app/AppKernel.php
+++ b/src/Bundle/ChillCustomFieldsBundle/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/ChillCustomFieldsBundle/Resources/test/Fixtures/App/app/autoload.php b/src/Bundle/ChillCustomFieldsBundle/Resources/test/Fixtures/App/app/autoload.php
index a2dfe7f92..ea351fb8a 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Resources/test/Fixtures/App/app/autoload.php
+++ b/src/Bundle/ChillCustomFieldsBundle/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/ChillCustomFieldsBundle/Resources/test/Fixtures/App/web/app_dev.php b/src/Bundle/ChillCustomFieldsBundle/Resources/test/Fixtures/App/web/app_dev.php
index 7f60a5a15..914d09ffd 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Resources/test/Fixtures/App/web/app_dev.php
+++ b/src/Bundle/ChillCustomFieldsBundle/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/ChillCustomFieldsBundle/Service/CustomFieldProvider.php b/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldProvider.php
index 25e021f3c..6c90f3951 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldProvider.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldProvider.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Service;
use LogicException;
@@ -79,8 +81,9 @@ class CustomFieldProvider implements ContainerAwareInterface
. 'is not found');
}
- /*
- * (non-PHPdoc)
+ /**
+ * (non-PHPdoc).
+ *
* @see \Symfony\Component\DependencyInjection\ContainerAwareInterface::setContainer()
*/
public function setContainer(?ContainerInterface $container = null)
diff --git a/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php b/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php
index e32a35cee..f89854a14 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Service;
use Chill\CustomFieldsBundle\Entity\CustomField;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelperException.php b/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelperException.php
index 88a40b58b..90c31612f 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelperException.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelperException.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Service;
use Exception;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php b/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php
index 9f0e94940..2bfe41917 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldRenderingTwig.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Templating\Twig;
use Chill\CustomFieldsBundle\Entity\CustomField;
@@ -46,8 +48,9 @@ class CustomFieldRenderingTwig extends AbstractExtension implements ContainerAwa
$this->customFieldsHelper = $customFieldsHelper;
}
- /*
- * (non-PHPdoc)
+ /**
+ * (non-PHPdoc).
+ *
* @see Twig_Extension::getFunctions()
*/
public function getFunctions()
@@ -76,7 +79,7 @@ class CustomFieldRenderingTwig extends AbstractExtension implements ContainerAwa
];
}
- /* (non-PHPdoc)
+ /** (non-PHPdoc).
* @see Twig_ExtensionInterface::getName()
*/
public function getName()
@@ -123,8 +126,9 @@ class CustomFieldRenderingTwig extends AbstractExtension implements ContainerAwa
->renderCustomField($fields, $customField, $documentType);
}
- /*
- * (non-PHPdoc)
+ /**
+ * (non-PHPdoc).
+ *
* @see \Symfony\Component\DependencyInjection\ContainerAwareInterface::setContainer()
*/
public function setContainer(?ContainerInterface $container = null)
diff --git a/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldsGroupRenderingTwig.php b/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldsGroupRenderingTwig.php
index 1de69e15a..a32d2190d 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldsGroupRenderingTwig.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Templating/Twig/CustomFieldsGroupRenderingTwig.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Templating\Twig;
use Symfony\Component\DependencyInjection\Container;
@@ -43,8 +45,9 @@ class CustomFieldsGroupRenderingTwig extends AbstractExtension implements Contai
$this->defaultParams['show_empty'] = $showEmptyValues;
}
- /*
- * (non-PHPdoc)
+ /**
+ * (non-PHPdoc).
+ *
* @see Twig_Extension::getFunctions()
*/
public function getFunctions()
@@ -61,7 +64,7 @@ class CustomFieldsGroupRenderingTwig extends AbstractExtension implements Contai
];
}
- /* (non-PHPdoc)
+ /** (non-PHPdoc).
* @see Twig_ExtensionInterface::getName()
*/
public function getName()
@@ -96,8 +99,9 @@ class CustomFieldsGroupRenderingTwig extends AbstractExtension implements Contai
'show_empty' => $resolvedParams['show_empty'], ]);
}
- /*
- * (non-PHPdoc)
+ /**
+ * (non-PHPdoc).
+ *
* @see \Symfony\Component\DependencyInjection\ContainerAwareInterface::setContainer()
*/
public function setContainer(?ContainerInterface $container = null)
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Config/ConfigCustomizablesEntitiesTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Config/ConfigCustomizablesEntitiesTest.php
index cee8dfd50..6a2809071 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/Config/ConfigCustomizablesEntitiesTest.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Config/ConfigCustomizablesEntitiesTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Tests\Config;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
@@ -17,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
* @internal
* @coversNothing
*/
-class ConfigCustomizablesEntitiesTest extends KernelTestCase
+final class ConfigCustomizablesEntitiesTest extends KernelTestCase
{
/**
* Test that the 'chill_custom_fields.customizables_entities' is filled
@@ -28,7 +30,7 @@ class ConfigCustomizablesEntitiesTest extends KernelTestCase
public function testNotEmptyConfig()
{
self::bootKernel(['environment' => 'test_customizable_entities_test_not_empty_config']);
- $customizableEntities = static::$kernel->getContainer()
+ $customizableEntities = self::$kernel->getContainer()
->getParameter('chill_custom_fields.customizables_entities');
$this->assertInternalType('array', $customizableEntities);
@@ -51,7 +53,7 @@ class ConfigCustomizablesEntitiesTest extends KernelTestCase
public function testNotPresentInConfig()
{
self::bootKernel(['environment' => 'test']);
- $customizableEntities = static::$kernel->getContainer()
+ $customizableEntities = self::$kernel->getContainer()
->getParameter('chill_custom_fields.customizables_entities');
$this->assertInternalType('array', $customizableEntities);
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldControllerTest_TODO.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldControllerTest_TODO.php
index b88f0b6a5..32513a837 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldControllerTest_TODO.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldControllerTest_TODO.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -15,7 +17,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class CustomFieldControllerTest extends WebTestCase
+final class CustomFieldControllerTest_TODO extends WebTestCase
{
/*
public function testCompleteScenario()
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldsGroupControllerTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldsGroupControllerTest.php
index b9bb5c785..4c3447030 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldsGroupControllerTest.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldsGroupControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Client;
@@ -16,13 +18,13 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class CustomFieldsGroupControllerTest extends WebTestCase
+final class CustomFieldsGroupControllerTest extends WebTestCase
{
public function testCompleteScenario()
{
self::bootKernel(['environment' => 'test_customizable_entities_test_not_empty_config']);
// Create a new client to browse the application
- $client = static::createClient([], [
+ $client = self::createClient([], [
'PHP_AUTH_USER' => 'admin',
'PHP_AUTH_PW' => 'olala',
]);
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFieldTestHelper.php b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFieldTestHelper.php
index c608b7a65..065b32898 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFieldTestHelper.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFieldTestHelper.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Tests;
use Chill\CustomFieldsBundle\Entity\CustomField;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php
index 815e529bb..58b15f0c3 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Tests;
use Chill\CustomFieldsBundle\CustomFields\CustomFieldChoice;
@@ -23,7 +25,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
* @internal
* @coversNothing
*/
-class CustomFieldsChoiceTest extends KernelTestCase
+final class CustomFieldsChoiceTest extends KernelTestCase
{
/**
* @var \Chill\CustomFieldsBundle\CustomFields\CustomFieldChoice
@@ -37,9 +39,9 @@ class CustomFieldsChoiceTest extends KernelTestCase
public function setUp()
{
- static::bootKernel();
+ self::bootKernel();
- $this->cfProvider = static::$kernel->getContainer()
+ $this->cfProvider = self::$kernel->getContainer()
->get('chill.custom_field.provider');
$this->cfChoice = $this->cfProvider->getCustomFieldByType('choice');
}
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsNumberTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsNumberTest.php
index d7fc89859..d65577d91 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsNumberTest.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsNumberTest.php
@@ -7,11 +7,14 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Tests;
use Chill\CustomFieldsBundle\CustomFields\CustomFieldNumber;
use Chill\CustomFieldsBundle\Entity\CustomField;
use Symfony\Component\Form\FormBuilderInterface;
+use function count;
/**
* Test CustomFieldsNumber.
@@ -19,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface;
* @internal
* @coversNothing
*/
-class CustomFieldsNumberTest extends \Symfony\Bundle\FrameworkBundle\Test\WebTestCase
+final class CustomFieldsNumberTest extends \Symfony\Bundle\FrameworkBundle\Test\WebTestCase
{
/**
* @var CustomFieldNumber
@@ -125,7 +128,7 @@ class CustomFieldsNumberTest extends \Symfony\Bundle\FrameworkBundle\Test\WebTes
$cfGroup = (new \Chill\CustomFieldsBundle\Entity\CustomFieldsGroup())
->addCustomField($cf);
- $form = static::$kernel->getContainer()->get('form.factory')
+ $form = self::$kernel->getContainer()->get('form.factory')
->createBuilder(\Chill\CustomFieldsBundle\Form\Type\CustomFieldType::class, [], [
'group' => $cfGroup,
])
@@ -150,7 +153,7 @@ class CustomFieldsNumberTest extends \Symfony\Bundle\FrameworkBundle\Test\WebTes
$cfGroup = (new \Chill\CustomFieldsBundle\Entity\CustomFieldsGroup())
->addCustomField($cf);
- $form = static::$kernel->getContainer()->get('form.factory')
+ $form = self::$kernel->getContainer()->get('form.factory')
->createBuilder(\Chill\CustomFieldsBundle\Form\Type\CustomFieldType::class, [], [
'group' => $cfGroup,
])
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php
index a685bc426..8d84f072e 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Tests;
use Chill\CustomFieldsBundle\CustomFields\CustomFieldText;
@@ -17,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class CustomFieldsTextTest extends WebTestCase
+final class CustomFieldsTextTest extends WebTestCase
{
use CustomFieldTestHelper;
@@ -28,8 +30,8 @@ class CustomFieldsTextTest extends WebTestCase
public function setUp()
{
- static::bootKernel();
- $this->customFieldProvider = static::$kernel->getContainer()
+ self::bootKernel();
+ $this->customFieldProvider = self::$kernel->getContainer()
->get('chill.custom_field.provider');
}
@@ -49,7 +51,7 @@ class CustomFieldsTextTest extends WebTestCase
public function testFormTextNew()
{
- $client = static::createClient();
+ $client = self::createClient();
$crawler = $client->request('GET', '/fr/admin/customfield/new?type=text');
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Form/Extension/PostTextIntegerExtensionTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Form/Extension/PostTextIntegerExtensionTest.php
index 5bcb621d8..8ce7b0cef 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/Form/Extension/PostTextIntegerExtensionTest.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Form/Extension/PostTextIntegerExtensionTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFields\Tests\Form\Extension;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
@@ -18,7 +20,7 @@ use Symfony\Component\Form\Extension\Core\Type\IntegerType;
* @internal
* @coversNothing
*/
-class PostTextIntegerExtensionTest extends KernelTestCase
+final class PostTextIntegerExtensionTest extends KernelTestCase
{
/**
* @var \Symfony\Component\Form\FormBuilderInterface
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Form/Extension/PostTextNumberExtensionTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Form/Extension/PostTextNumberExtensionTest.php
index c5c7ea9c3..a16980be0 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/Form/Extension/PostTextNumberExtensionTest.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Form/Extension/PostTextNumberExtensionTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFields\Tests\Form\Extension;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
@@ -18,7 +20,7 @@ use Symfony\Component\Form\Extension\Core\Type\NumberType;
* @internal
* @coversNothing
*/
-class PostTextNumberExtensionTest extends KernelTestCase
+final class PostTextNumberExtensionTest extends KernelTestCase
{
/**
* @var \Symfony\Component\Form\FormBuilderInterface
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Routing/RoutingLoaderTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Routing/RoutingLoaderTest.php
index 748a79851..3cde3890a 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/Routing/RoutingLoaderTest.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Routing/RoutingLoaderTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFieldsBundle\Tests;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -18,11 +20,11 @@ use Symfony\Component\HttpFoundation\Response;
* @internal
* @coversNothing
*/
-class RoutingLoaderTest extends WebTestCase
+final class RoutingLoaderTest extends WebTestCase
{
public function testRoutesAreLoaded()
{
- $client = static::createClient();
+ $client = self::createClient();
$client->request('GET', '/fr/admin/customfield/');
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Service/CustomFieldsHelperTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Service/CustomFieldsHelperTest.php
index 7b11b8c62..594e55e34 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/Service/CustomFieldsHelperTest.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Service/CustomFieldsHelperTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFields\Tests\Service;
use Chill\CustomFieldsBundle\Entity\CustomField;
@@ -19,7 +21,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
* @internal
* @coversNothing
*/
-class CustomFieldsHelperTest extends KernelTestCase
+final class CustomFieldsHelperTest extends KernelTestCase
{
/**
* @var CustomFieldsHelper
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldRenderingTwigTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldRenderingTwigTest.php
index 90a024414..425e79537 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldRenderingTwigTest.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldRenderingTwigTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFields\Tests\Templating\Twig;
use Chill\CustomFieldsBundle\Entity\CustomField;
@@ -20,7 +22,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
* @internal
* @coversNothing
*/
-class CustomFieldRenderingTwigTest extends KernelTestCase
+final class CustomFieldRenderingTwigTest extends KernelTestCase
{
/**
* @var CustomFieldProvider
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldsGroupRenderingTwigTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldsGroupRenderingTwigTest.php
index 5636439b5..aa52e3efd 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldsGroupRenderingTwigTest.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldsGroupRenderingTwigTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\CustomFields\Tests\Templating\Twig;
use Chill\CustomFieldsBundle\Entity\CustomField;
@@ -22,7 +24,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
* @internal
* @coversNothing
*/
-class CustomFieldsGroupRenderingTwigTest extends KernelTestCase
+final class CustomFieldsGroupRenderingTwigTest extends KernelTestCase
{
/**
* @var CustomFieldProvider
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/bootstrap.php b/src/Bundle/ChillCustomFieldsBundle/Tests/bootstrap.php
index 0eb126c4f..d4e1e46fa 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/bootstrap.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/bootstrap.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
if (!is_file($autoloadFile = __DIR__ . '/../vendor/autoload.php')) {
throw new \LogicException('Could not find autoload.php in vendor/. Did you run "composer install --dev"?');
}
diff --git a/src/Bundle/ChillCustomFieldsBundle/migrations/Version20141128195430.php b/src/Bundle/ChillCustomFieldsBundle/migrations/Version20141128195430.php
index 945f57deb..5a93f65d9 100644
--- a/src/Bundle/ChillCustomFieldsBundle/migrations/Version20141128195430.php
+++ b/src/Bundle/ChillCustomFieldsBundle/migrations/Version20141128195430.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\Migrations\CustomFields;
use Doctrine\DBAL\Schema\Schema;
diff --git a/src/Bundle/ChillCustomFieldsBundle/migrations/Version20150224164531.php b/src/Bundle/ChillCustomFieldsBundle/migrations/Version20150224164531.php
index 15c597a77..41b0dc0e0 100644
--- a/src/Bundle/ChillCustomFieldsBundle/migrations/Version20150224164531.php
+++ b/src/Bundle/ChillCustomFieldsBundle/migrations/Version20150224164531.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\Migrations\CustomFields;
use Doctrine\DBAL\Schema\Schema;
diff --git a/src/Bundle/ChillCustomFieldsBundle/migrations/Version20151210155904.php b/src/Bundle/ChillCustomFieldsBundle/migrations/Version20151210155904.php
index 4e49b5f61..ba1ce6e1c 100644
--- a/src/Bundle/ChillCustomFieldsBundle/migrations/Version20151210155904.php
+++ b/src/Bundle/ChillCustomFieldsBundle/migrations/Version20151210155904.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\Migrations\CustomFields;
use Doctrine\DBAL\Schema\Schema;
@@ -20,7 +22,7 @@ class Version20151210155904 extends AbstractMigration
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
- $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
+ $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE CustomField DROP required');
}
@@ -28,7 +30,7 @@ class Version20151210155904 extends AbstractMigration
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
- $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
+ $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE customfield ADD required BOOLEAN DEFAULT FALSE');
}
diff --git a/src/Bundle/ChillCustomFieldsBundle/migrations/Version20151210205610.php b/src/Bundle/ChillCustomFieldsBundle/migrations/Version20151210205610.php
index 52ddda8bc..69a6e9032 100644
--- a/src/Bundle/ChillCustomFieldsBundle/migrations/Version20151210205610.php
+++ b/src/Bundle/ChillCustomFieldsBundle/migrations/Version20151210205610.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\Migrations\CustomFields;
use Doctrine\DBAL\Schema\Schema;
@@ -20,7 +22,7 @@ class Version20151210205610 extends AbstractMigration
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
- $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
+ $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE custom_field_long_choice_options DROP CONSTRAINT cf_long_choice_self_referencing');
$this->addSql('DROP SEQUENCE custom_field_long_choice_options_id_seq CASCADE');
@@ -29,7 +31,7 @@ class Version20151210205610 extends AbstractMigration
public function up(Schema $schema): void
{
- $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
+ $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE SEQUENCE custom_field_long_choice_options_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE custom_field_long_choice_options (id INT NOT NULL, '
diff --git a/src/Bundle/ChillDocGeneratorBundle/ChillDocGeneratorBundle.php b/src/Bundle/ChillDocGeneratorBundle/ChillDocGeneratorBundle.php
index 9e3570708..d52f0f4b1 100644
--- a/src/Bundle/ChillDocGeneratorBundle/ChillDocGeneratorBundle.php
+++ b/src/Bundle/ChillDocGeneratorBundle/ChillDocGeneratorBundle.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocGeneratorBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
diff --git a/src/Bundle/ChillDocGeneratorBundle/Context/DocGeneratorContextInterface.php b/src/Bundle/ChillDocGeneratorBundle/Context/DocGeneratorContextInterface.php
index 0167abb96..7493f7000 100644
--- a/src/Bundle/ChillDocGeneratorBundle/Context/DocGeneratorContextInterface.php
+++ b/src/Bundle/ChillDocGeneratorBundle/Context/DocGeneratorContextInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocGeneratorBundle\Context;
/**
diff --git a/src/Bundle/ChillDocGeneratorBundle/Context/HouseholdMemberSelectionContext.php b/src/Bundle/ChillDocGeneratorBundle/Context/HouseholdMemberSelectionContext.php
index e5752c5ca..5e5b12cce 100644
--- a/src/Bundle/ChillDocGeneratorBundle/Context/HouseholdMemberSelectionContext.php
+++ b/src/Bundle/ChillDocGeneratorBundle/Context/HouseholdMemberSelectionContext.php
@@ -7,12 +7,16 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocGeneratorBundle\Context;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation;
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Exception;
+use function count;
+use function get_class;
/**
* Context that display a form to select a member of a houseHold.
@@ -33,7 +37,7 @@ class HouseholdMemberSelectionContext implements DocGeneratorContextInterface
$persons = $entity->getAccompanyingPeriodWork()->getPersons();
- if (sizeof($persons) > 0) {
+ if (count($persons) > 0) {
$firstPerson = $persons[0];
$datas['setValues'][] = [
@@ -41,7 +45,7 @@ class HouseholdMemberSelectionContext implements DocGeneratorContextInterface
'firstPersonLastName' => $firstPerson->getLastName(), ];
}
- if (get_class($entity) == AccompanyingPeriodWorkEvaluation::class) {
+ if (get_class($entity) === AccompanyingPeriodWorkEvaluation::class) {
$values = [];
foreach ($entity->getAccompanyingPeriodWork()->getPersons() as $person) {
@@ -70,7 +74,7 @@ class HouseholdMemberSelectionContext implements DocGeneratorContextInterface
throw new Exception('No implemented yet', 1);
$choices = [];
- if (get_class($entity) == AccompanyingPeriodWorkEvaluation::class) {
+ if (get_class($entity) === AccompanyingPeriodWorkEvaluation::class) {
foreach ($entity->getAccompanyingPeriodWork()->getPersons() as $person) {
$choices[$person->getId()] = $person->getName();
}
@@ -99,7 +103,7 @@ class HouseholdMemberSelectionContext implements DocGeneratorContextInterface
public function supports(string $entityClass): bool
{
return
- (AccompanyingPeriod::class == $entityClass)
- || (SocialAction::class == $entityClass);
+ (AccompanyingPeriod::class === $entityClass)
+ || (SocialAction::class === $entityClass);
}
}
diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php
index c7ac94744..a7d24f127 100644
--- a/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php
+++ b/src/Bundle/ChillDocGeneratorBundle/Controller/AdminDocGeneratorTemplateController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocGeneratorBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorController.php
index 9899e90ea..50201f6b0 100644
--- a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorController.php
+++ b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocGeneratorBundle\Controller;
use ChampsLibres\AsyncUploaderBundle\TempUrl\TempUrlOpenstackGenerator;
@@ -47,7 +49,7 @@ class DocGeneratorController extends AbstractController
unlink($tmpfname);
- $fileContent = fopen($tmpfname2, 'r'); // the generated file content
+ $fileContent = fopen($tmpfname2, 'rb'); // the generated file content
$response = new Response(fread($fileContent, filesize($tmpfname2)));
$disposition = HeaderUtils::makeDisposition(
diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php
index fd153fab2..c45ccfbad 100644
--- a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php
+++ b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocGeneratorBundle\Controller;
use ChampsLibres\AsyncUploaderBundle\TempUrl\TempUrlGeneratorInterface;
@@ -66,7 +68,7 @@ class DocGeneratorTemplateController extends AbstractController
$entity = $this->getDoctrine()->getRepository($entityClassName)->find($entityId);
- if ($template->getContext() == HouseholdMemberSelectionContext::class) {
+ if ($template->getContext() === HouseholdMemberSelectionContext::class) {
$context = new HouseholdMemberSelectionContext();
$datas = $context->getData($entity);
} else {
@@ -88,9 +90,9 @@ class DocGeneratorTemplateController extends AbstractController
unlink($tmpfname);
- $fileContent = fopen($tmpfname2, 'r'); // the generated file content
+ $fileContent = fopen($tmpfname2, 'rb'); // the generated file content
- $genDocName = 'doc_' . sprintf('%010d', rand()) . '.docx';
+ $genDocName = 'doc_' . sprintf('%010d', mt_rand()) . '.docx';
$getUrlGen = $tempUrlGenerator->generate(
'PUT',
@@ -106,7 +108,7 @@ class DocGeneratorTemplateController extends AbstractController
'body' => $fileContent,
]);
- if ($putResponse->getStatusCode() == 201) {
+ if ($putResponse->getStatusCode() === 201) {
$em = $this->getDoctrine()->getManager();
$storedObject = new StoredObject();
$storedObject
diff --git a/src/Bundle/ChillDocGeneratorBundle/DataFixtures/ORM/LoadDocGeneratorTemplate.php b/src/Bundle/ChillDocGeneratorBundle/DataFixtures/ORM/LoadDocGeneratorTemplate.php
index 32ba194b3..082605fd7 100644
--- a/src/Bundle/ChillDocGeneratorBundle/DataFixtures/ORM/LoadDocGeneratorTemplate.php
+++ b/src/Bundle/ChillDocGeneratorBundle/DataFixtures/ORM/LoadDocGeneratorTemplate.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocGeneratorBundle\DataFixtures\ORM;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
diff --git a/src/Bundle/ChillDocGeneratorBundle/DependencyInjection/ChillDocGeneratorExtension.php b/src/Bundle/ChillDocGeneratorBundle/DependencyInjection/ChillDocGeneratorExtension.php
index 70640b73d..15fd49140 100644
--- a/src/Bundle/ChillDocGeneratorBundle/DependencyInjection/ChillDocGeneratorExtension.php
+++ b/src/Bundle/ChillDocGeneratorBundle/DependencyInjection/ChillDocGeneratorExtension.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocGeneratorBundle\DependencyInjection;
use Symfony\Component\Config\FileLocator;
diff --git a/src/Bundle/ChillDocGeneratorBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillDocGeneratorBundle/DependencyInjection/Configuration.php
index 4d8e46464..161886d87 100644
--- a/src/Bundle/ChillDocGeneratorBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillDocGeneratorBundle/DependencyInjection/Configuration.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocGeneratorBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
diff --git a/src/Bundle/ChillDocGeneratorBundle/Entity/DocGeneratorTemplate.php b/src/Bundle/ChillDocGeneratorBundle/Entity/DocGeneratorTemplate.php
index 43d72a64f..e5e3e41a1 100644
--- a/src/Bundle/ChillDocGeneratorBundle/Entity/DocGeneratorTemplate.php
+++ b/src/Bundle/ChillDocGeneratorBundle/Entity/DocGeneratorTemplate.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocGeneratorBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
diff --git a/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php b/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php
index 4735dbe3c..75d33d0e5 100644
--- a/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php
+++ b/src/Bundle/ChillDocGeneratorBundle/Form/DocGeneratorTemplateType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocGeneratorBundle\Form;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
diff --git a/src/Bundle/ChillDocGeneratorBundle/Serializer/Encoder/DocGenEncoder.php b/src/Bundle/ChillDocGeneratorBundle/Serializer/Encoder/DocGenEncoder.php
index c30155955..2de46228a 100644
--- a/src/Bundle/ChillDocGeneratorBundle/Serializer/Encoder/DocGenEncoder.php
+++ b/src/Bundle/ChillDocGeneratorBundle/Serializer/Encoder/DocGenEncoder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocGeneratorBundle\Serializer\Encoder;
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
diff --git a/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php b/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php
index a55ee4b06..594ae8376 100644
--- a/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php
+++ b/src/Bundle/ChillDocGeneratorBundle/Serializer/Helper/NormalizeNullValueHelper.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocGeneratorBundle\Serializer\Helper;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
diff --git a/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php b/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php
index 81ddd97ca..040738571 100644
--- a/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php
+++ b/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocGeneratorBundle\Serializer\Normalizer;
use Chill\DocGeneratorBundle\Serializer\Helper\NormalizeNullValueHelper;
@@ -25,11 +27,13 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use function array_filter;
use function array_key_exists;
use function array_merge;
+use function get_class;
use function implode;
use function in_array;
use function is_array;
+use function is_object;
-class DocGenObjectNormalizer implements NormalizerInterface, NormalizerAwareInterface
+class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInterface
{
use NormalizerAwareTrait;
@@ -57,7 +61,7 @@ class DocGenObjectNormalizer implements NormalizerInterface, NormalizerAwareInte
: [];
$attributes = array_filter(
$metadata->getAttributesMetadata(),
- function (AttributeMetadata $a) use ($expectedGroups) {
+ static function (AttributeMetadata $a) use ($expectedGroups) {
foreach ($a->getGroups() as $g) {
if (in_array($g, $expectedGroups, true)) {
return true;
diff --git a/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Encoder/DocGenEncoderTest.php b/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Encoder/DocGenEncoderTest.php
index 9ccf2a002..35768a28c 100644
--- a/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Encoder/DocGenEncoderTest.php
+++ b/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Encoder/DocGenEncoderTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocGeneratorBundle\Tests\Serializer\Encoder;
use Chill\DocGeneratorBundle\Serializer\Encoder\DocGenEncoder;
@@ -17,7 +19,7 @@ use Symfony\Component\Serializer\Exception\UnexpectedValueException;
* @internal
* @coversNothing
*/
-class DocGenEncoderTest extends TestCase
+final class DocGenEncoderTest extends TestCase
{
private DocGenEncoder $encoder;
diff --git a/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Normalizer/DocGenObjectNormalizerTest.php b/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Normalizer/DocGenObjectNormalizerTest.php
index b54e67c89..04a241d26 100644
--- a/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Normalizer/DocGenObjectNormalizerTest.php
+++ b/src/Bundle/ChillDocGeneratorBundle/tests/Serializer/Normalizer/DocGenObjectNormalizerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocGeneratorBundle\tests\Serializer\Normalizer;
use Chill\MainBundle\Entity\Center;
@@ -19,7 +21,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
* @internal
* @coversNothing
*/
-class DocGenObjectNormalizerTest extends KernelTestCase
+final class DocGenObjectNormalizerTest extends KernelTestCase
{
private NormalizerInterface $normalizer;
diff --git a/src/Bundle/ChillDocStoreBundle/ChillDocStoreBundle.php b/src/Bundle/ChillDocStoreBundle/ChillDocStoreBundle.php
index 339fb15ee..c5536d0f1 100644
--- a/src/Bundle/ChillDocStoreBundle/ChillDocStoreBundle.php
+++ b/src/Bundle/ChillDocStoreBundle/ChillDocStoreBundle.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
diff --git a/src/Bundle/ChillDocStoreBundle/Controller/AdminController.php b/src/Bundle/ChillDocStoreBundle/Controller/AdminController.php
index c1e38dc85..784fed6c9 100644
--- a/src/Bundle/ChillDocStoreBundle/Controller/AdminController.php
+++ b/src/Bundle/ChillDocStoreBundle/Controller/AdminController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php
index c355c9e97..a5ad5cfa1 100644
--- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php
+++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\Controller;
use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument;
@@ -101,7 +103,7 @@ class DocumentAccompanyingCourseController extends AbstractController
);
}
- if ($form->isSubmitted() and !$form->isValid()) {
+ if ($form->isSubmitted() && !$form->isValid()) {
$this->addFlash('error', $this->translator->trans('This form contains errors'));
}
@@ -179,7 +181,7 @@ class DocumentAccompanyingCourseController extends AbstractController
return $this->redirectToRoute('accompanying_course_document_index', ['course' => $course->getId()]);
}
- if ($form->isSubmitted() and !$form->isValid()) {
+ if ($form->isSubmitted() && !$form->isValid()) {
$this->addFlash('error', $this->translator->trans('This form contains errors'));
}
diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php
index c0ceed681..25ac9f1bd 100644
--- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php
+++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\Controller;
use Chill\DocStoreBundle\Entity\PersonDocument;
@@ -121,7 +123,7 @@ class DocumentPersonController extends AbstractController
);
}
- if ($form->isSubmitted() and !$form->isValid()) {
+ if ($form->isSubmitted() && !$form->isValid()) {
$this->addFlash('error', $this->translator->trans('This form contains errors'));
}
@@ -222,7 +224,7 @@ class DocumentPersonController extends AbstractController
return $this->redirectToRoute('person_document_index', ['person' => $person->getId()]);
}
- if ($form->isSubmitted() and !$form->isValid()) {
+ if ($form->isSubmitted() && !$form->isValid()) {
$this->addFlash('error', $this->translator->trans('This form contains errors'));
}
diff --git a/src/Bundle/ChillDocStoreBundle/DataFixtures/ORM/LoadDocumentACL.php b/src/Bundle/ChillDocStoreBundle/DataFixtures/ORM/LoadDocumentACL.php
index cda071963..28a35dfb4 100644
--- a/src/Bundle/ChillDocStoreBundle/DataFixtures/ORM/LoadDocumentACL.php
+++ b/src/Bundle/ChillDocStoreBundle/DataFixtures/ORM/LoadDocumentACL.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\DataFixtures\ORM;
use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter;
@@ -16,6 +18,7 @@ use Chill\MainBundle\Entity\RoleScope;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
+use function in_array;
/**
* Adding acl for person document.
diff --git a/src/Bundle/ChillDocStoreBundle/DataFixtures/ORM/LoadDocumentCategory.php b/src/Bundle/ChillDocStoreBundle/DataFixtures/ORM/LoadDocumentCategory.php
index 6b0d30e37..3369994bd 100644
--- a/src/Bundle/ChillDocStoreBundle/DataFixtures/ORM/LoadDocumentCategory.php
+++ b/src/Bundle/ChillDocStoreBundle/DataFixtures/ORM/LoadDocumentCategory.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\DataFixtures\ORM;
use Chill\DocStoreBundle\Entity\DocumentCategory;
diff --git a/src/Bundle/ChillDocStoreBundle/DependencyInjection/ChillDocStoreExtension.php b/src/Bundle/ChillDocStoreBundle/DependencyInjection/ChillDocStoreExtension.php
index 51cd60636..a3fd04ca3 100644
--- a/src/Bundle/ChillDocStoreBundle/DependencyInjection/ChillDocStoreExtension.php
+++ b/src/Bundle/ChillDocStoreBundle/DependencyInjection/ChillDocStoreExtension.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\DependencyInjection;
use Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter;
diff --git a/src/Bundle/ChillDocStoreBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillDocStoreBundle/DependencyInjection/Configuration.php
index 936b41be5..a0761c074 100644
--- a/src/Bundle/ChillDocStoreBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillDocStoreBundle/DependencyInjection/Configuration.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
diff --git a/src/Bundle/ChillDocStoreBundle/Entity/AccompanyingCourseDocument.php b/src/Bundle/ChillDocStoreBundle/Entity/AccompanyingCourseDocument.php
index 2f86744b8..b013f1a44 100644
--- a/src/Bundle/ChillDocStoreBundle/Entity/AccompanyingCourseDocument.php
+++ b/src/Bundle/ChillDocStoreBundle/Entity/AccompanyingCourseDocument.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\Entity;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
diff --git a/src/Bundle/ChillDocStoreBundle/Entity/Document.php b/src/Bundle/ChillDocStoreBundle/Entity/Document.php
index ca60b9468..874a60f0b 100644
--- a/src/Bundle/ChillDocStoreBundle/Entity/Document.php
+++ b/src/Bundle/ChillDocStoreBundle/Entity/Document.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\Entity;
use Chill\MainBundle\Entity\HasScopeInterface;
diff --git a/src/Bundle/ChillDocStoreBundle/Entity/DocumentCategory.php b/src/Bundle/ChillDocStoreBundle/Entity/DocumentCategory.php
index ffd08d80a..1ded5ccb2 100644
--- a/src/Bundle/ChillDocStoreBundle/Entity/DocumentCategory.php
+++ b/src/Bundle/ChillDocStoreBundle/Entity/DocumentCategory.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
diff --git a/src/Bundle/ChillDocStoreBundle/Entity/PersonDocument.php b/src/Bundle/ChillDocStoreBundle/Entity/PersonDocument.php
index ab026a43b..8d59384d8 100644
--- a/src/Bundle/ChillDocStoreBundle/Entity/PersonDocument.php
+++ b/src/Bundle/ChillDocStoreBundle/Entity/PersonDocument.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\Entity;
use Chill\MainBundle\Entity\HasCenterInterface;
diff --git a/src/Bundle/ChillDocStoreBundle/EntityRepository/DocumentCategoryRepository.php b/src/Bundle/ChillDocStoreBundle/EntityRepository/DocumentCategoryRepository.php
index 18370b470..fbf4acb15 100644
--- a/src/Bundle/ChillDocStoreBundle/EntityRepository/DocumentCategoryRepository.php
+++ b/src/Bundle/ChillDocStoreBundle/EntityRepository/DocumentCategoryRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\EntityRepository;
use Doctrine\ORM\EntityRepository;
diff --git a/src/Bundle/ChillDocStoreBundle/Form/AccompanyingCourseDocumentType.php b/src/Bundle/ChillDocStoreBundle/Form/AccompanyingCourseDocumentType.php
index aae7c5435..12797da79 100644
--- a/src/Bundle/ChillDocStoreBundle/Form/AccompanyingCourseDocumentType.php
+++ b/src/Bundle/ChillDocStoreBundle/Form/AccompanyingCourseDocumentType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\Form;
use Chill\DocStoreBundle\Entity\Document;
@@ -69,7 +71,7 @@ class AccompanyingCourseDocumentType extends AbstractType
->add('category', EntityType::class, [
'placeholder' => 'Choose a document category',
'class' => 'ChillDocStoreBundle:DocumentCategory',
- 'query_builder' => function (EntityRepository $er) {
+ 'query_builder' => static function (EntityRepository $er) {
return $er->createQueryBuilder('c')
->where('c.documentClass = :docClass')
->setParameter('docClass', PersonDocument::class);
diff --git a/src/Bundle/ChillDocStoreBundle/Form/DocumentCategoryType.php b/src/Bundle/ChillDocStoreBundle/Form/DocumentCategoryType.php
index aa481160e..97265f2dc 100644
--- a/src/Bundle/ChillDocStoreBundle/Form/DocumentCategoryType.php
+++ b/src/Bundle/ChillDocStoreBundle/Form/DocumentCategoryType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\Form;
use Chill\DocStoreBundle\Entity\DocumentCategory;
diff --git a/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php b/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php
index fbd87402c..474d9d132 100644
--- a/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php
+++ b/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\Form;
use Chill\DocStoreBundle\Entity\Document;
@@ -73,7 +75,7 @@ class PersonDocumentType extends AbstractType
->add('category', EntityType::class, [
'placeholder' => 'Choose a document category',
'class' => 'ChillDocStoreBundle:DocumentCategory',
- 'query_builder' => function (EntityRepository $er) {
+ 'query_builder' => static function (EntityRepository $er) {
return $er->createQueryBuilder('c')
->where('c.documentClass = :docClass')
->setParameter('docClass', PersonDocument::class);
diff --git a/src/Bundle/ChillDocStoreBundle/Form/StoredObjectType.php b/src/Bundle/ChillDocStoreBundle/Form/StoredObjectType.php
index 03d83c181..4de5cf48c 100644
--- a/src/Bundle/ChillDocStoreBundle/Form/StoredObjectType.php
+++ b/src/Bundle/ChillDocStoreBundle/Form/StoredObjectType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\Form;
use ChampsLibres\AsyncUploaderBundle\Form\Type\AsyncUploaderType;
diff --git a/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php b/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php
index a26e1467f..d579dc162 100644
--- a/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php
+++ b/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\Menu;
use Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter;
@@ -73,7 +75,7 @@ final class MenuBuilder implements LocalMenuBuilderInterface
private function buildMenuPerson(MenuItem $menu, array $parameters)
{
- /* @var $person \Chill\PersonBundle\Entity\Person */
+ /** @var \Chill\PersonBundle\Entity\Person $person */
$person = $parameters['person'];
if ($this->security->isGranted(PersonDocumentVoter::SEE, $person)) {
diff --git a/src/Bundle/ChillDocStoreBundle/Object/ObjectToAsyncFileTransformer.php b/src/Bundle/ChillDocStoreBundle/Object/ObjectToAsyncFileTransformer.php
index bdc2ec6f6..7c9054010 100644
--- a/src/Bundle/ChillDocStoreBundle/Object/ObjectToAsyncFileTransformer.php
+++ b/src/Bundle/ChillDocStoreBundle/Object/ObjectToAsyncFileTransformer.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\Object;
use ChampsLibres\AsyncUploaderBundle\Form\AsyncFileTransformer\AsyncFileTransformerInterface;
diff --git a/src/Bundle/ChillDocStoreBundle/Object/PersistenceChecker.php b/src/Bundle/ChillDocStoreBundle/Object/PersistenceChecker.php
index f5fa006b2..c0e4f7509 100644
--- a/src/Bundle/ChillDocStoreBundle/Object/PersistenceChecker.php
+++ b/src/Bundle/ChillDocStoreBundle/Object/PersistenceChecker.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\Object;
use ChampsLibres\AsyncUploaderBundle\Persistence\PersistenceCheckerInterface;
diff --git a/src/Bundle/ChillDocStoreBundle/Security/Authorization/PersonDocumentVoter.php b/src/Bundle/ChillDocStoreBundle/Security/Authorization/PersonDocumentVoter.php
index c1f945990..43d17e420 100644
--- a/src/Bundle/ChillDocStoreBundle/Security/Authorization/PersonDocumentVoter.php
+++ b/src/Bundle/ChillDocStoreBundle/Security/Authorization/PersonDocumentVoter.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\DocStoreBundle\Security\Authorization;
use Chill\DocStoreBundle\Entity\PersonDocument;
diff --git a/src/Bundle/ChillEventBundle/ChillEventBundle.php b/src/Bundle/ChillEventBundle/ChillEventBundle.php
index 37dcdbeac..66438716e 100644
--- a/src/Bundle/ChillEventBundle/ChillEventBundle.php
+++ b/src/Bundle/ChillEventBundle/ChillEventBundle.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
diff --git a/src/Bundle/ChillEventBundle/Controller/AdminController.php b/src/Bundle/ChillEventBundle/Controller/AdminController.php
index 5ed9e16c7..aca3b5a04 100644
--- a/src/Bundle/ChillEventBundle/Controller/AdminController.php
+++ b/src/Bundle/ChillEventBundle/Controller/AdminController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
diff --git a/src/Bundle/ChillEventBundle/Controller/EventController.php b/src/Bundle/ChillEventBundle/Controller/EventController.php
index 06307706b..c7d98baaa 100644
--- a/src/Bundle/ChillEventBundle/Controller/EventController.php
+++ b/src/Bundle/ChillEventBundle/Controller/EventController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Controller;
use Chill\EventBundle\Entity\Event;
@@ -37,6 +39,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Translation\TranslatorInterface;
+use function count;
/**
* Class EventController.
@@ -229,7 +232,7 @@ class EventController extends AbstractController
*
* @return \Symfony\Component\HttpFoundation\Response
*/
- public function newAction(?Center $center = null, Request $request)
+ public function newAction(?Center $center, Request $request)
{
if (null === $center) {
$center_id = $request->query->get('center_id');
@@ -379,7 +382,7 @@ class EventController extends AbstractController
*/
protected function createAddEventParticipationByPersonForm(Person $person)
{
- /* @var $builder \Symfony\Component\Form\FormBuilderInterface */
+ /** @var \Symfony\Component\Form\FormBuilderInterface $builder */
$builder = $this
->get('form.factory')
->createNamedBuilder(
@@ -426,7 +429,7 @@ class EventController extends AbstractController
*/
protected function createAddParticipationByPersonForm(Event $event)
{
- /* @var $builder \Symfony\Component\Form\FormBuilderInterface */
+ /** @var \Symfony\Component\Form\FormBuilderInterface $builder */
$builder = $this
->get('form.factory')
->createNamedBuilder(
@@ -598,7 +601,7 @@ class EventController extends AbstractController
$response->setPrivate();
$response->headers->addCacheControlDirective('no-cache', true);
$response->headers->addCacheControlDirective('must-revalidate', true);
- $response->setCallback(function () use ($writer) {
+ $response->setCallback(static function () use ($writer) {
$writer->save('php://output');
});
diff --git a/src/Bundle/ChillEventBundle/Controller/EventTypeController.php b/src/Bundle/ChillEventBundle/Controller/EventTypeController.php
index f9af30d8f..b4e19efc7 100644
--- a/src/Bundle/ChillEventBundle/Controller/EventTypeController.php
+++ b/src/Bundle/ChillEventBundle/Controller/EventTypeController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Controller;
use Chill\EventBundle\Entity\EventType;
diff --git a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php
index fc0abada1..b3294cfc6 100644
--- a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php
+++ b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Controller;
use ArrayIterator;
@@ -23,6 +25,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
+use function count;
/**
* Class ParticipationController.
@@ -109,7 +112,7 @@ class ParticipationController extends AbstractController
[
'event_id' => current($participations)->getEvent()->getId(),
'persons_ids' => implode(',', array_map(
- function (Participation $p) { return $p->getPerson()->getId(); },
+ static function (Participation $p) { return $p->getPerson()->getId(); },
$participations
)),
]
@@ -298,7 +301,7 @@ class ParticipationController extends AbstractController
*/
public function editAction(int $participation_id): Response
{
- /* @var $participation Participation */
+ /** @var Participation $participation */
$participation = $this->getDoctrine()->getManager()
->getRepository(Participation::class)
->find($participation_id);
@@ -419,7 +422,7 @@ class ParticipationController extends AbstractController
public function updateAction(int $participation_id, Request $request): Response
{
- /* @var $participation Participation */
+ /** @var Participation $participation */
$participation = $this->getDoctrine()->getManager()
->getRepository(Participation::class)
->find($participation_id);
@@ -460,7 +463,7 @@ class ParticipationController extends AbstractController
public function updateMultipleAction($event_id, Request $request)
{
- /* @var $event \Chill\EventBundle\Entity\Event */
+ /** @var \Chill\EventBundle\Entity\Event $event */
$event = $this->getDoctrine()->getRepository('ChillEventBundle:Event')
->find($event_id);
@@ -642,16 +645,16 @@ class ParticipationController extends AbstractController
);
// create a collection of person's id participating to the event
- /* @var $peopleParticipating \Doctrine\Common\Collections\ArrayCollection */
+ /** @var \Doctrine\Common\Collections\ArrayCollection $peopleParticipating */
$peopleParticipating = $peopleParticipating ??
$participation->getEvent()->getParticipations()->map(
- function (Participation $p) { return $p->getPerson()->getId(); }
+ static function (Participation $p) { return $p->getPerson()->getId(); }
);
// check that the user is not already in the event
if ($peopleParticipating->contains($participation->getPerson()->getId())) {
$ignoredParticipations[] = $participation
->getEvent()->getParticipations()->filter(
- function (Participation $p) use ($participation) {
+ static function (Participation $p) use ($participation) {
return $p->getPerson()->getId() === $participation->getPerson()->getId();
}
)->first();
@@ -742,7 +745,7 @@ class ParticipationController extends AbstractController
$single = $request->query->has('person_id');
$multiple = $request->query->has('persons_ids');
- if (true === $single and true === $multiple) {
+ if (true === $single && true === $multiple) {
// we are not allowed to have both person_id and persons_ids
throw new RuntimeException("You are not allow to provide both 'person_id' and "
. "'persons_ids' simulaneously");
diff --git a/src/Bundle/ChillEventBundle/Controller/RoleController.php b/src/Bundle/ChillEventBundle/Controller/RoleController.php
index 3df68ff1f..a12a775da 100644
--- a/src/Bundle/ChillEventBundle/Controller/RoleController.php
+++ b/src/Bundle/ChillEventBundle/Controller/RoleController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Controller;
use Chill\EventBundle\Entity\Role;
diff --git a/src/Bundle/ChillEventBundle/Controller/StatusController.php b/src/Bundle/ChillEventBundle/Controller/StatusController.php
index 63ff27dbb..7da8b989f 100644
--- a/src/Bundle/ChillEventBundle/Controller/StatusController.php
+++ b/src/Bundle/ChillEventBundle/Controller/StatusController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Controller;
use Chill\EventBundle\Entity\Status;
diff --git a/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadEventTypes.php b/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadEventTypes.php
index 5caacd188..c106d777c 100644
--- a/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadEventTypes.php
+++ b/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadEventTypes.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\DataFixtures\ORM;
use Chill\EventBundle\Entity\EventType;
diff --git a/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadParticipation.php b/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadParticipation.php
index bd0234740..104a12dbb 100644
--- a/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadParticipation.php
+++ b/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadParticipation.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\DataFixtures\ORM;
use Chill\EventBundle\Entity\Event;
@@ -40,7 +42,7 @@ class LoadParticipation extends AbstractFixture implements OrderedFixtureInterfa
for ($i = 0; $i < $expectedNumber; ++$i) {
$event = (new Event())
->setDate($this->faker->dateTimeBetween('-2 years', '+6 months'))
- ->setName($this->faker->words(rand(2, 4), true))
+ ->setName($this->faker->words(mt_rand(2, 4), true))
->setType($this->getReference(LoadEventTypes::$refs[array_rand(LoadEventTypes::$refs)]))
->setCenter($center)
->setCircle(
@@ -70,9 +72,9 @@ class LoadParticipation extends AbstractFixture implements OrderedFixtureInterfa
->findBy(['center' => $center]);
$events = $this->createEvents($center, $manager);
- /* @var $person \Chill\PersonBundle\Entity\Person */
+ /** @var \Chill\PersonBundle\Entity\Person $person */
foreach ($people as $person) {
- $nb = rand(0, 3);
+ $nb = mt_rand(0, 3);
for ($i = 0; $i < $nb; ++$i) {
$event = $events[array_rand($events)];
diff --git a/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadRolesACL.php b/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadRolesACL.php
index a9b437cba..ddcef3422 100644
--- a/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadRolesACL.php
+++ b/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadRolesACL.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\DataFixtures\ORM;
use Chill\MainBundle\DataFixtures\ORM\LoadPermissionsGroup;
@@ -15,6 +17,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 roles to existing groups.
diff --git a/src/Bundle/ChillEventBundle/DependencyInjection/ChillEventExtension.php b/src/Bundle/ChillEventBundle/DependencyInjection/ChillEventExtension.php
index dc20a27a5..a793469b6 100644
--- a/src/Bundle/ChillEventBundle/DependencyInjection/ChillEventExtension.php
+++ b/src/Bundle/ChillEventBundle/DependencyInjection/ChillEventExtension.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\DependencyInjection;
use Chill\EventBundle\Security\Authorization\EventVoter;
@@ -40,7 +42,7 @@ class ChillEventExtension extends Extension implements PrependExtensionInterface
$loader->load('services/timeline.yaml');
}
- /* (non-PHPdoc)
+ /** (non-PHPdoc).
* @see \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface::prepend()
*/
public function prepend(ContainerBuilder $container)
diff --git a/src/Bundle/ChillEventBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillEventBundle/DependencyInjection/Configuration.php
index 2d90f006b..181ae43db 100644
--- a/src/Bundle/ChillEventBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillEventBundle/DependencyInjection/Configuration.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
diff --git a/src/Bundle/ChillEventBundle/Entity/Event.php b/src/Bundle/ChillEventBundle/Entity/Event.php
index 639d4f99e..3c90967f5 100644
--- a/src/Bundle/ChillEventBundle/Entity/Event.php
+++ b/src/Bundle/ChillEventBundle/Entity/Event.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Entity;
use ArrayIterator;
@@ -174,7 +176,7 @@ class Event implements HasCenterInterface, HasScopeInterface
{
$iterator = $this->participations->getIterator();
- $iterator->uasort(function ($first, $second) {
+ $iterator->uasort(static function ($first, $second) {
return strnatcasecmp($first->getPerson()->getFirstName(), $second->getPerson()->getFirstName());
});
diff --git a/src/Bundle/ChillEventBundle/Entity/EventType.php b/src/Bundle/ChillEventBundle/Entity/EventType.php
index d028c6c55..2a2c932d9 100644
--- a/src/Bundle/ChillEventBundle/Entity/EventType.php
+++ b/src/Bundle/ChillEventBundle/Entity/EventType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
diff --git a/src/Bundle/ChillEventBundle/Entity/Participation.php b/src/Bundle/ChillEventBundle/Entity/Participation.php
index fb8ffeaed..9ba34d398 100644
--- a/src/Bundle/ChillEventBundle/Entity/Participation.php
+++ b/src/Bundle/ChillEventBundle/Entity/Participation.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Entity;
use ArrayAccess;
@@ -19,6 +21,7 @@ use DateTime;
use Doctrine\ORM\Mapping as ORM;
use RuntimeException;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
+use function in_array;
/**
* Class Participation.
@@ -28,7 +31,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
* @ORM\Table(name="chill_event_participation")
* @ORM\HasLifecycleCallbacks
*/
-class Participation implements HasCenterInterface, HasScopeInterface, ArrayAccess
+class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterface
{
/**
* @var Event
@@ -193,7 +196,7 @@ class Participation implements HasCenterInterface, HasScopeInterface, ArrayAcces
{
return in_array($offset, [
'person', 'role', 'status', 'event',
- ]);
+ ], true);
}
/**
diff --git a/src/Bundle/ChillEventBundle/Entity/Role.php b/src/Bundle/ChillEventBundle/Entity/Role.php
index 3c7b50135..999116700 100644
--- a/src/Bundle/ChillEventBundle/Entity/Role.php
+++ b/src/Bundle/ChillEventBundle/Entity/Role.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
diff --git a/src/Bundle/ChillEventBundle/Entity/Status.php b/src/Bundle/ChillEventBundle/Entity/Status.php
index a4914b552..f7d936671 100644
--- a/src/Bundle/ChillEventBundle/Entity/Status.php
+++ b/src/Bundle/ChillEventBundle/Entity/Status.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
diff --git a/src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php b/src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php
index 4d9d41a22..953f1cc82 100644
--- a/src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php
+++ b/src/Bundle/ChillEventBundle/Form/ChoiceLoader/EventChoiceLoader.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Form\ChoiceLoader;
use Chill\EventBundle\Entity\Event;
@@ -15,13 +17,11 @@ use RuntimeException;
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
use function call_user_func;
+use function count;
use function in_array;
-/*
- * Class EventChoiceLoader
- *
- * @package Chill\EventBundle\Form\ChoiceLoader
- * @author Mathieu Jaumotte jaum_mathieu@collectifs.net
+/**
+ * Class EventChoiceLoader.
*/
class EventChoiceLoader implements ChoiceLoaderInterface
{
@@ -61,7 +61,7 @@ class EventChoiceLoader implements ChoiceLoaderInterface
{
return new \Symfony\Component\Form\ChoiceList\ArrayChoiceList(
$this->lazyLoadedEvents,
- function (Event $p) use ($value) {
+ static function (Event $p) use ($value) {
return call_user_func($value, $p);
}
);
@@ -84,7 +84,7 @@ class EventChoiceLoader implements ChoiceLoaderInterface
$event = $this->eventRepository->find($value);
if ($this->hasCenterFilter()
- && !in_array($event->getCenter(), $this->centers)) {
+ && !in_array($event->getCenter(), $this->centers, true)) {
throw new RuntimeException('chosen an event not in correct center');
}
diff --git a/src/Bundle/ChillEventBundle/Form/EventType.php b/src/Bundle/ChillEventBundle/Form/EventType.php
index 9861c0915..6fe0535b3 100644
--- a/src/Bundle/ChillEventBundle/Form/EventType.php
+++ b/src/Bundle/ChillEventBundle/Form/EventType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Form;
use Chill\EventBundle\Form\Type\PickEventTypeType;
diff --git a/src/Bundle/ChillEventBundle/Form/EventTypeType.php b/src/Bundle/ChillEventBundle/Form/EventTypeType.php
index 8e95057dd..dee3fea25 100644
--- a/src/Bundle/ChillEventBundle/Form/EventTypeType.php
+++ b/src/Bundle/ChillEventBundle/Form/EventTypeType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Form;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
diff --git a/src/Bundle/ChillEventBundle/Form/ParticipationType.php b/src/Bundle/ChillEventBundle/Form/ParticipationType.php
index 0f44e641c..70efcb7b9 100644
--- a/src/Bundle/ChillEventBundle/Form/ParticipationType.php
+++ b/src/Bundle/ChillEventBundle/Form/ParticipationType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Form;
use Chill\EventBundle\Entity\EventType;
diff --git a/src/Bundle/ChillEventBundle/Form/RoleType.php b/src/Bundle/ChillEventBundle/Form/RoleType.php
index 938648240..da91637d8 100644
--- a/src/Bundle/ChillEventBundle/Form/RoleType.php
+++ b/src/Bundle/ChillEventBundle/Form/RoleType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Form;
use Chill\EventBundle\Entity\EventType;
diff --git a/src/Bundle/ChillEventBundle/Form/StatusType.php b/src/Bundle/ChillEventBundle/Form/StatusType.php
index 1cb97db58..cea82049a 100644
--- a/src/Bundle/ChillEventBundle/Form/StatusType.php
+++ b/src/Bundle/ChillEventBundle/Form/StatusType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Form;
use Chill\EventBundle\Form\Type\PickEventTypeType;
diff --git a/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php b/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php
index 11d9dbef3..bb12e272c 100644
--- a/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php
+++ b/src/Bundle/ChillEventBundle/Form/Type/PickEventType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Form\Type;
use Chill\EventBundle\Entity\Event;
@@ -27,6 +29,8 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Translation\TranslatorInterface;
+use function in_array;
+use function is_array;
/**
* Class PickEventType.
@@ -104,14 +108,14 @@ class PickEventType extends AbstractType
// add the default options
$resolver->setDefaults([
'class' => Event::class,
- 'choice_label' => function (Event $e) {
+ 'choice_label' => static function (Event $e) {
return $e->getDate()->format('d/m/Y, H:i') . ' → ' .
// $e->getType()->getName()['fr'] . ': ' . // display the type of event
$e->getName();
},
'placeholder' => 'Pick an event',
'attr' => ['class' => 'select2 '],
- 'choice_attr' => function (Event $e) {
+ 'choice_attr' => static function (Event $e) {
return ['data-center' => $e->getCenter()->getId()];
},
'choiceloader' => function (Options $options) {
@@ -138,7 +142,7 @@ class PickEventType extends AbstractType
// option role
if (null === $options['role']) {
$centers = array_map(
- function (GroupCenter $g) {
+ static function (GroupCenter $g) {
return $g->getCenter();
},
$this->user->getGroupCenters()->toArray()
@@ -167,9 +171,9 @@ class PickEventType extends AbstractType
}
if (!in_array($c->getId(), array_map(
- function (Center $c) { return $c->getId(); },
+ static function (Center $c) { return $c->getId(); },
$centers
- ))) {
+ ), true)) {
throw new AccessDeniedException('The given center is not reachable');
}
$selectedCenters[] = $c;
diff --git a/src/Bundle/ChillEventBundle/Form/Type/PickEventTypeType.php b/src/Bundle/ChillEventBundle/Form/Type/PickEventTypeType.php
index 0511497ec..bad43a349 100644
--- a/src/Bundle/ChillEventBundle/Form/Type/PickEventTypeType.php
+++ b/src/Bundle/ChillEventBundle/Form/Type/PickEventTypeType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Form\Type;
use Chill\EventBundle\Entity\EventType;
@@ -37,14 +39,14 @@ class PickEventTypeType extends AbstractType
$resolver->setDefaults(
[
'class' => EventType::class,
- 'query_builder' => function (EntityRepository $er) {
+ 'query_builder' => static function (EntityRepository $er) {
return $er->createQueryBuilder('et')
->where('et.active = true');
},
- 'choice_label' => function (EventType $t) use ($helper) {
+ 'choice_label' => static function (EventType $t) use ($helper) {
return $helper->localize($t->getName());
},
- 'choice_attrs' => function (EventType $t) {
+ 'choice_attrs' => static function (EventType $t) {
return ['data-link-category' => $t->getId()];
},
]
diff --git a/src/Bundle/ChillEventBundle/Form/Type/PickRoleType.php b/src/Bundle/ChillEventBundle/Form/Type/PickRoleType.php
index 56da2cb40..2caf95598 100644
--- a/src/Bundle/ChillEventBundle/Form/Type/PickRoleType.php
+++ b/src/Bundle/ChillEventBundle/Form/Type/PickRoleType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Form\Type;
use Chill\EventBundle\Entity\EventType;
@@ -109,13 +111,13 @@ class PickRoleType extends AbstractType
'class' => Role::class,
'query_builder' => $qb,
'group_by' => null,
- 'choice_attr' => function (Role $r) {
+ 'choice_attr' => static function (Role $r) {
return [
'data-event-type' => $r->getType()->getId(),
'data-link-category' => $r->getType()->getId(),
];
},
- 'choice_label' => function (Role $r) use ($translatableStringHelper, $translator) {
+ 'choice_label' => static function (Role $r) use ($translatableStringHelper, $translator) {
return $translatableStringHelper->localize($r->getName()) .
($r->getActive() === true ? '' :
' (' . $translator->trans('unactive') . ')');
diff --git a/src/Bundle/ChillEventBundle/Form/Type/PickStatusType.php b/src/Bundle/ChillEventBundle/Form/Type/PickStatusType.php
index f554943b2..dea302049 100644
--- a/src/Bundle/ChillEventBundle/Form/Type/PickStatusType.php
+++ b/src/Bundle/ChillEventBundle/Form/Type/PickStatusType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Form\Type;
use Chill\EventBundle\Entity\EventType;
@@ -110,13 +112,13 @@ class PickStatusType extends AbstractType
'class' => Status::class,
'query_builder' => $qb,
'group_by' => null,
- 'choice_attr' => function (Status $s) {
+ 'choice_attr' => static function (Status $s) {
return [
'data-event-type' => $s->getType()->getId(),
'data-link-category' => $s->getType()->getId(),
];
},
- 'choice_label' => function (Status $s) use ($translatableStringHelper, $translator) {
+ 'choice_label' => static function (Status $s) use ($translatableStringHelper, $translator) {
return $translatableStringHelper->localize($s->getName()) .
($s->getActive() === true ? '' :
' (' . $translator->trans('unactive') . ')');
diff --git a/src/Bundle/ChillEventBundle/Menu/PersonMenuBuilder.php b/src/Bundle/ChillEventBundle/Menu/PersonMenuBuilder.php
index c9f5f96b4..f96bed266 100644
--- a/src/Bundle/ChillEventBundle/Menu/PersonMenuBuilder.php
+++ b/src/Bundle/ChillEventBundle/Menu/PersonMenuBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Menu;
use Chill\EventBundle\Security\Authorization\EventVoter;
@@ -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'] ?? null;
if ($this->authorizationChecker->isGranted(EventVoter::SEE, $person)) {
diff --git a/src/Bundle/ChillEventBundle/Repository/EventRepository.php b/src/Bundle/ChillEventBundle/Repository/EventRepository.php
index 282902de0..352021120 100644
--- a/src/Bundle/ChillEventBundle/Repository/EventRepository.php
+++ b/src/Bundle/ChillEventBundle/Repository/EventRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Repository;
use Doctrine\ORM\EntityRepository;
diff --git a/src/Bundle/ChillEventBundle/Repository/ParticipationRepository.php b/src/Bundle/ChillEventBundle/Repository/ParticipationRepository.php
index 75dc4d346..673d63df8 100644
--- a/src/Bundle/ChillEventBundle/Repository/ParticipationRepository.php
+++ b/src/Bundle/ChillEventBundle/Repository/ParticipationRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Repository;
use Doctrine\ORM\EntityRepository;
diff --git a/src/Bundle/ChillEventBundle/Resources/test/Fixtures/App/AppKernel.php b/src/Bundle/ChillEventBundle/Resources/test/Fixtures/App/AppKernel.php
index 59f7702f7..5d91c6f5c 100644
--- a/src/Bundle/ChillEventBundle/Resources/test/Fixtures/App/AppKernel.php
+++ b/src/Bundle/ChillEventBundle/Resources/test/Fixtures/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/ChillEventBundle/Resources/test/bootstrap.php b/src/Bundle/ChillEventBundle/Resources/test/bootstrap.php
index 1260ef94b..9d402a12b 100644
--- a/src/Bundle/ChillEventBundle/Resources/test/bootstrap.php
+++ b/src/Bundle/ChillEventBundle/Resources/test/bootstrap.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
if (!is_file($autoloadFile = __DIR__ . '/../../vendor/autoload.php')) {
throw new \LogicException('Could not find autoload.php in vendor/. Did you run "composer install --dev"?');
}
diff --git a/src/Bundle/ChillEventBundle/Search/EventSearch.php b/src/Bundle/ChillEventBundle/Search/EventSearch.php
index 3b16f346e..b3594c274 100644
--- a/src/Bundle/ChillEventBundle/Search/EventSearch.php
+++ b/src/Bundle/ChillEventBundle/Search/EventSearch.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Search;
use Chill\EventBundle\Entity\Event;
@@ -19,6 +21,7 @@ use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Templating\EngineInterface as TemplatingEngine;
+use function count;
/**
* Search within Events.
@@ -135,7 +138,7 @@ class EventSearch extends AbstractSearch
public function supports($domain, $format)
{
- return 'event' === $domain or 'events' === $domain;
+ return 'event' === $domain || 'events' === $domain;
}
protected function composeQuery(QueryBuilder &$qb, $terms)
@@ -171,8 +174,8 @@ class EventSearch extends AbstractSearch
}
if (
- (isset($terms['name']) or isset($terms['_default']))
- and (!empty($terms['name']) or !empty($terms['_default']))) {
+ (isset($terms['name']) || isset($terms['_default']))
+ && (!empty($terms['name']) || !empty($terms['_default']))) {
// the form with name:"xyz" has precedence
$name = $terms['name'] ?? $terms['_default'];
diff --git a/src/Bundle/ChillEventBundle/Security/Authorization/EventVoter.php b/src/Bundle/ChillEventBundle/Security/Authorization/EventVoter.php
index bbd93228e..b2c201e01 100644
--- a/src/Bundle/ChillEventBundle/Security/Authorization/EventVoter.php
+++ b/src/Bundle/ChillEventBundle/Security/Authorization/EventVoter.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Security\Authorization;
use Chill\EventBundle\Entity\Event;
@@ -20,6 +22,8 @@ use Psr\Log\LoggerInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
use Symfony\Component\Security\Core\Role\Role;
+use function count;
+use function in_array;
/**
* Description of EventVoter.
@@ -85,8 +89,8 @@ class EventVoter extends AbstractChillVoter implements ProvideRoleHierarchyInter
public function supports($attribute, $subject)
{
- return ($subject instanceof Event && in_array($attribute, self::ROLES))
- || ($subject instanceof Person && \in_array($attribute, [self::CREATE, self::SEE]))
+ return ($subject instanceof Event && in_array($attribute, self::ROLES, true))
+ || ($subject instanceof Person && in_array($attribute, [self::CREATE, self::SEE], true))
|| (null === $subject && self::SEE === $attribute);
}
diff --git a/src/Bundle/ChillEventBundle/Security/Authorization/ParticipationVoter.php b/src/Bundle/ChillEventBundle/Security/Authorization/ParticipationVoter.php
index aff66dbdb..3438f71c3 100644
--- a/src/Bundle/ChillEventBundle/Security/Authorization/ParticipationVoter.php
+++ b/src/Bundle/ChillEventBundle/Security/Authorization/ParticipationVoter.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Security\Authorization;
use Chill\EventBundle\Entity\Participation;
@@ -20,6 +22,8 @@ use Psr\Log\LoggerInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
use Symfony\Component\Security\Core\Role\Role;
+use function count;
+use function in_array;
class ParticipationVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
{
@@ -82,8 +86,8 @@ class ParticipationVoter extends AbstractChillVoter implements ProvideRoleHierar
public function supports($attribute, $subject)
{
- return ($subject instanceof Participation && in_array($attribute, self::ROLES))
- || ($subject instanceof Person && \in_array($attribute, [self::CREATE, self::SEE]))
+ return ($subject instanceof Participation && in_array($attribute, self::ROLES, true))
+ || ($subject instanceof Person && in_array($attribute, [self::CREATE, self::SEE], true))
|| (null === $subject && self::SEE === $attribute);
}
diff --git a/src/Bundle/ChillEventBundle/Tests/Controller/EventControllerTest.php b/src/Bundle/ChillEventBundle/Tests/Controller/EventControllerTest.php
index 113fffa99..8966a45a1 100644
--- a/src/Bundle/ChillEventBundle/Tests/Controller/EventControllerTest.php
+++ b/src/Bundle/ChillEventBundle/Tests/Controller/EventControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -15,7 +17,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class EventControllerTest extends WebTestCase
+final class EventControllerTest extends WebTestCase
{
public function testSkipped()
{
diff --git a/src/Bundle/ChillEventBundle/Tests/Controller/EventTypeControllerTest.php b/src/Bundle/ChillEventBundle/Tests/Controller/EventTypeControllerTest.php
index 85347ba8e..4b69b9849 100644
--- a/src/Bundle/ChillEventBundle/Tests/Controller/EventTypeControllerTest.php
+++ b/src/Bundle/ChillEventBundle/Tests/Controller/EventTypeControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -15,7 +17,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class EventTypeControllerTest extends WebTestCase
+final class EventTypeControllerTest extends WebTestCase
{
public function testSkipped()
{
diff --git a/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php b/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php
index f03b5a5ba..201cfb183 100644
--- a/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php
+++ b/src/Bundle/ChillEventBundle/Tests/Controller/ParticipationControllerTest.php
@@ -7,9 +7,13 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
+use function count;
+use function in_array;
/**
* Test the creation of participation controller.
@@ -17,7 +21,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class ParticipationControllerTest extends WebTestCase
+final class ParticipationControllerTest extends WebTestCase
{
/**
* @var \Symfony\Component\BrowserKit\Client
@@ -44,7 +48,7 @@ class ParticipationControllerTest extends WebTestCase
{
self::bootKernel();
- $this->client = static::createClient([], [
+ $this->client = self::createClient([], [
'PHP_AUTH_USER' => 'center a_social',
'PHP_AUTH_PW' => 'password',
'HTTP_ACCEPT_LANGUAGE' => 'fr_FR',
@@ -134,7 +138,7 @@ class ParticipationControllerTest extends WebTestCase
public function testEditMultipleAction()
{
- /* @var $event \Chill\EventBundle\Entity\Event */
+ /** @var \Chill\EventBundle\Entity\Event $event */
$event = $this->getRandomEventWithMultipleParticipations();
$crawler = $this->client->request('GET', '/fr/event/participation/' . $event->getId() .
@@ -235,7 +239,7 @@ class ParticipationControllerTest extends WebTestCase
$this->personsIdsCache = array_merge(
$this->personsIdsCache,
$event->getParticipations()->map(
- function ($p) { return $p->getPerson()->getId(); }
+ static function ($p) { return $p->getPerson()->getId(); }
)
->toArray()
);
@@ -299,7 +303,7 @@ class ParticipationControllerTest extends WebTestCase
$event = $this->getRandomEventWithMultipleParticipations();
$persons_id = implode(',', $event->getParticipations()->map(
- function ($p) { return $p->getPerson()->getId(); }
+ static function ($p) { return $p->getPerson()->getId(); }
)->toArray());
$crawler = $this->client->request(
@@ -325,7 +329,7 @@ class ParticipationControllerTest extends WebTestCase
$nbParticipations = $event->getParticipations()->count();
// get the persons_id participating on this event
$persons_id = $event->getParticipations()->map(
- function ($p) { return $p->getPerson()->getId(); }
+ static function ($p) { return $p->getPerson()->getId(); }
)->toArray();
// exclude the existing persons_ids from the new person
$this->personsIdsCache = array_merge($this->personsIdsCache, $persons_id);
@@ -454,8 +458,8 @@ class ParticipationControllerTest extends WebTestCase
$circles = $this->em->getRepository('ChillMainBundle:Scope')
->findAll();
- array_filter($circles, function ($circle) use ($circleName) {
- return in_array($circleName, $circle->getName());
+ array_filter($circles, static function ($circle) use ($circleName) {
+ return in_array($circleName, $circle->getName(), true);
});
$circle = $circles[0];
@@ -507,7 +511,7 @@ class ParticipationControllerTest extends WebTestCase
$person = $persons[array_rand($persons)];
- if (in_array($person->getId(), $this->personsIdsCache)) {
+ if (in_array($person->getId(), $this->personsIdsCache, true)) {
return $this->getRandomPerson($centerName); // we try another time
}
$this->personsIdsCache[] = $person->getId();
diff --git a/src/Bundle/ChillEventBundle/Tests/Controller/RoleControllerTest.php b/src/Bundle/ChillEventBundle/Tests/Controller/RoleControllerTest.php
index 23237d060..d24b10a40 100644
--- a/src/Bundle/ChillEventBundle/Tests/Controller/RoleControllerTest.php
+++ b/src/Bundle/ChillEventBundle/Tests/Controller/RoleControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -15,7 +17,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class RoleControllerTest extends WebTestCase
+final class RoleControllerTest extends WebTestCase
{
public function testSkipped()
{
diff --git a/src/Bundle/ChillEventBundle/Tests/Controller/StatusControllerTest.php b/src/Bundle/ChillEventBundle/Tests/Controller/StatusControllerTest.php
index 2ddcabee2..d07909032 100644
--- a/src/Bundle/ChillEventBundle/Tests/Controller/StatusControllerTest.php
+++ b/src/Bundle/ChillEventBundle/Tests/Controller/StatusControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -15,7 +17,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class StatusControllerTest extends WebTestCase
+final class StatusControllerTest extends WebTestCase
{
public function testSkipped()
{
diff --git a/src/Bundle/ChillEventBundle/Tests/Search/EventSearchTest.php b/src/Bundle/ChillEventBundle/Tests/Search/EventSearchTest.php
index edb388cd7..3e93c0dbf 100644
--- a/src/Bundle/ChillEventBundle/Tests/Search/EventSearchTest.php
+++ b/src/Bundle/ChillEventBundle/Tests/Search/EventSearchTest.php
@@ -7,12 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Tests\Search;
use Chill\EventBundle\Entity\Event;
use Chill\EventBundle\Search\EventSearch;
use DateTime;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
+use function in_array;
/**
* Test the EventSearch class.
@@ -20,7 +23,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class EventSearchTest extends WebTestCase
+final class EventSearchTest extends WebTestCase
{
/**
* The center A.
@@ -68,10 +71,10 @@ class EventSearchTest extends WebTestCase
public function setUp()
{
self::bootKernel();
- /* @var $kernel \Symfony\Component\HttpKernel\KernelInterface */
+ /** @var \Symfony\Component\HttpKernel\KernelInterface $kernel */
$kernel = self::$kernel;
- $this->client = static::createClient([], [
+ $this->client = self::createClient([], [
'PHP_AUTH_USER' => 'center a_social',
'PHP_AUTH_PW' => 'password',
'HTTP_ACCEPT_LANGUAGE' => 'fr_FR',
@@ -123,7 +126,7 @@ class EventSearchTest extends WebTestCase
*/
public function testDisplayAllWrongUser()
{
- $client = static::createClient([], [
+ $client = self::createClient([], [
'PHP_AUTH_USER' => 'center b_social',
'PHP_AUTH_PW' => 'password',
'HTTP_ACCEPT_LANGUAGE' => 'fr_FR',
@@ -147,7 +150,7 @@ class EventSearchTest extends WebTestCase
'q' => '@events date-from:2016-05-30 date-to:2016-06-20',
]);
- /* @var $dateFrom \DateTime the date from in DateTime */
+ /** @var DateTime $dateFrom the date from in DateTime */
$dateFrom = DateTime::createFromFormat('Y-m-d', '2016-05-30');
$dateTo = DateTime::createFromFormat('Y-m-d', '2016-06-20');
@@ -161,7 +164,7 @@ class EventSearchTest extends WebTestCase
// there should not have any other results, but if any other bundle
// add some other event, we go on next pages
- if ($crawler->selectLink('Voir tous les résultats')->count() == 0) {
+ if ($crawler->selectLink('Voir tous les résultats')->count() === 0) {
return;
}
@@ -193,7 +196,7 @@ class EventSearchTest extends WebTestCase
$crawler = $this->client->request('GET', '/fr/search', [
'q' => '@events date-from:2016-05-30',
]);
- /* @var $dateFrom \DateTime the date from in DateTime */
+ /** @var DateTime $dateFrom the date from in DateTime */
$dateFrom = DateTime::createFromFormat('Y-m-d', '2016-05-30');
$dates = $this->iterateOnRowsToFindDate($crawler->filter('tr'));
@@ -229,7 +232,7 @@ class EventSearchTest extends WebTestCase
'q' => '@events date:2016-05-30',
]);
- /* @var $dateFrom \DateTime the date from in DateTime */
+ /** @var DateTime $dateFrom the date from in DateTime */
$dateTo = DateTime::createFromFormat('Y-m-d', '2016-05-30');
$dates = $this->iterateOnRowsToFindDate($crawler->filter('tr'));
@@ -238,7 +241,7 @@ class EventSearchTest extends WebTestCase
$this->assertLessThanOrEqual($dateTo, $date);
}
- if ($crawler->selectLink('Voir tous les résultats')->count() == 0) {
+ if ($crawler->selectLink('Voir tous les résultats')->count() === 0) {
return;
}
@@ -333,9 +336,9 @@ class EventSearchTest extends WebTestCase
$circles = $this->entityManager->getRepository('ChillMainBundle:Scope')
->findAll();
- /* @var $circle \Chill\MainBundle\Entity\Scope */
+ /** @var \Chill\MainBundle\Entity\Scope $circle */
foreach ($circles as $circle) {
- if (in_array($name, $circle->getName())) {
+ if (in_array($name, $circle->getName(), true)) {
return $circle;
}
}
@@ -364,7 +367,7 @@ class EventSearchTest extends WebTestCase
'décembre' => 12,
];
- $results = $trs->each(function ($tr, $i) use ($months) {
+ $results = $trs->each(static function ($tr, $i) use ($months) {
// we skip the first row
if (0 < $i) {
// get the second node, which should contains a date
diff --git a/src/Bundle/ChillEventBundle/Timeline/TimelineEventProvider.php b/src/Bundle/ChillEventBundle/Timeline/TimelineEventProvider.php
index c2169d5a9..92629fd21 100644
--- a/src/Bundle/ChillEventBundle/Timeline/TimelineEventProvider.php
+++ b/src/Bundle/ChillEventBundle/Timeline/TimelineEventProvider.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\EventBundle\Timeline;
use Chill\EventBundle\Entity\Event;
@@ -22,6 +24,7 @@ use LogicException;
use RuntimeException;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Role\Role;
+use function count;
/**
* Class TimelineEventProvider.
@@ -205,7 +208,7 @@ class TimelineEventProvider implements TimelineProviderInterface
foreach ($reachableCenters as $center) {
$reachableCircleId = array_map(
- function (Scope $scope) { return $scope->getId(); },
+ static function (Scope $scope) { return $scope->getId(); },
$this->helper->getReachableCircles($this->user, $role, $person->getCenter())
);
$centerAndScopeLines[] = sprintf(
diff --git a/src/Bundle/ChillEventBundle/migrations/Version20160318111334.php b/src/Bundle/ChillEventBundle/migrations/Version20160318111334.php
index a364aa4d4..241003abf 100644
--- a/src/Bundle/ChillEventBundle/migrations/Version20160318111334.php
+++ b/src/Bundle/ChillEventBundle/migrations/Version20160318111334.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\Migrations\Event;
use Doctrine\DBAL\Schema\Schema;
@@ -20,7 +22,7 @@ class Version20160318111334 extends AbstractMigration
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
- $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
+ $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE chill_event_role DROP CONSTRAINT FK_AA714E54C54C8C93');
$this->addSql('ALTER TABLE chill_event_status DROP CONSTRAINT FK_A6CC85D0C54C8C93');
@@ -49,7 +51,7 @@ class Version20160318111334 extends AbstractMigration
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
- $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
+ $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE SEQUENCE chill_event_event_type_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE chill_event_role_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
diff --git a/src/Bundle/ChillFamilyMembersBundle/ChillAMLIFamilyMembersBundle.php b/src/Bundle/ChillFamilyMembersBundle/ChillAMLIFamilyMembersBundle.php
index 90d73e461..68007ff1d 100644
--- a/src/Bundle/ChillFamilyMembersBundle/ChillAMLIFamilyMembersBundle.php
+++ b/src/Bundle/ChillFamilyMembersBundle/ChillAMLIFamilyMembersBundle.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\FamilyMembersBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
diff --git a/src/Bundle/ChillFamilyMembersBundle/Config/ConfigRepository.php b/src/Bundle/ChillFamilyMembersBundle/Config/ConfigRepository.php
index 6bce386ed..de159eadd 100644
--- a/src/Bundle/ChillFamilyMembersBundle/Config/ConfigRepository.php
+++ b/src/Bundle/ChillFamilyMembersBundle/Config/ConfigRepository.php
@@ -7,8 +7,12 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\FamilyMembersBundle\Config;
+use function count;
+
class ConfigRepository
{
/**
diff --git a/src/Bundle/ChillFamilyMembersBundle/DependencyInjection/ChillAMLIFamilyMembersExtension.php b/src/Bundle/ChillFamilyMembersBundle/DependencyInjection/ChillAMLIFamilyMembersExtension.php
index 3e595dcb6..3407138c2 100644
--- a/src/Bundle/ChillFamilyMembersBundle/DependencyInjection/ChillAMLIFamilyMembersExtension.php
+++ b/src/Bundle/ChillFamilyMembersBundle/DependencyInjection/ChillAMLIFamilyMembersExtension.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\FamilyMembersBundle\DependencyInjection;
use Chill\AMLI\FamilyMembersBundle\Security\Voter\FamilyMemberVoter;
@@ -45,7 +47,7 @@ class ChillAMLIFamilyMembersExtension extends Extension implements PrependExtens
$this->prependRoutes($container);
}
- /* (non-PHPdoc)
+ /** (non-PHPdoc).
* @see \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface::prepend()
*/
public function prependRoutes(ContainerBuilder $container)
diff --git a/src/Bundle/ChillFamilyMembersBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillFamilyMembersBundle/DependencyInjection/Configuration.php
index 69a346912..28057507a 100644
--- a/src/Bundle/ChillFamilyMembersBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillFamilyMembersBundle/DependencyInjection/Configuration.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\FamilyMembersBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
diff --git a/src/Bundle/ChillFamilyMembersBundle/Entity/AbstractFamilyMember.php b/src/Bundle/ChillFamilyMembersBundle/Entity/AbstractFamilyMember.php
index 50da10bcf..ac8743af2 100644
--- a/src/Bundle/ChillFamilyMembersBundle/Entity/AbstractFamilyMember.php
+++ b/src/Bundle/ChillFamilyMembersBundle/Entity/AbstractFamilyMember.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\FamilyMembersBundle\Entity;
use Chill\MainBundle\Entity\HasCenterInterface;
diff --git a/src/Bundle/ChillFamilyMembersBundle/Entity/FamilyMember.php b/src/Bundle/ChillFamilyMembersBundle/Entity/FamilyMember.php
index 854b4aa58..9e679454b 100644
--- a/src/Bundle/ChillFamilyMembersBundle/Entity/FamilyMember.php
+++ b/src/Bundle/ChillFamilyMembersBundle/Entity/FamilyMember.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\FamilyMembersBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
diff --git a/src/Bundle/ChillFamilyMembersBundle/Form/FamilyMemberType.php b/src/Bundle/ChillFamilyMembersBundle/Form/FamilyMemberType.php
index 4351adf8c..939999d48 100644
--- a/src/Bundle/ChillFamilyMembersBundle/Form/FamilyMemberType.php
+++ b/src/Bundle/ChillFamilyMembersBundle/Form/FamilyMemberType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\FamilyMembersBundle\Form;
use Chill\AMLI\FamilyMembersBundle\Config\ConfigRepository;
diff --git a/src/Bundle/ChillFamilyMembersBundle/Form/FamilyMembersType.php b/src/Bundle/ChillFamilyMembersBundle/Form/FamilyMembersType.php
index df99d5ba9..9ea1f2fa9 100644
--- a/src/Bundle/ChillFamilyMembersBundle/Form/FamilyMembersType.php
+++ b/src/Bundle/ChillFamilyMembersBundle/Form/FamilyMembersType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\FamilyMembersBundle\Form;
use Chill\MainBundle\Form\Type\ChillCollectionType;
diff --git a/src/Bundle/ChillFamilyMembersBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillFamilyMembersBundle/Menu/UserMenuBuilder.php
index 565198894..17976b6ef 100644
--- a/src/Bundle/ChillFamilyMembersBundle/Menu/UserMenuBuilder.php
+++ b/src/Bundle/ChillFamilyMembersBundle/Menu/UserMenuBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\FamilyMembersBundle\Menu;
use Chill\AMLI\FamilyMembersBundle\Security\Voter\FamilyMemberVoter;
@@ -37,7 +39,7 @@ class UserMenuBuilder 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(FamilyMemberVoter::SHOW, $person)) {
diff --git a/src/Bundle/ChillFamilyMembersBundle/Security/Voter/FamilyMemberVoter.php b/src/Bundle/ChillFamilyMembersBundle/Security/Voter/FamilyMemberVoter.php
index fba5e0c37..73c320720 100644
--- a/src/Bundle/ChillFamilyMembersBundle/Security/Voter/FamilyMemberVoter.php
+++ b/src/Bundle/ChillFamilyMembersBundle/Security/Voter/FamilyMemberVoter.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\FamilyMembersBundle\Security\Voter;
use Chill\AMLI\FamilyMembersBundle\Entity\FamilyMember;
@@ -62,8 +64,8 @@ class FamilyMemberVoter extends AbstractChillVoter implements ProvideRoleHierarc
protected function supports($attribute, $subject)
{
- return (in_array($attribute, self::ROLES) && $subject instanceof FamilyMember)
- or ($subject instanceof Person && in_array($attribute, [self::SHOW, self::CREATE]));
+ return (in_array($attribute, self::ROLES, true) && $subject instanceof FamilyMember)
+ || ($subject instanceof Person && in_array($attribute, [self::SHOW, self::CREATE], true));
}
protected function voteOnAttribute($attribute, $subject, \Symfony\Component\Security\Core\Authentication\Token\TokenInterface $token)
diff --git a/src/Bundle/ChillFamilyMembersBundle/Templating/Twig.php b/src/Bundle/ChillFamilyMembersBundle/Templating/Twig.php
index f10c2ab66..c2c060b79 100644
--- a/src/Bundle/ChillFamilyMembersBundle/Templating/Twig.php
+++ b/src/Bundle/ChillFamilyMembersBundle/Templating/Twig.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\FamilyMembersBundle\Templating;
use Chill\AMLI\FamilyMembersBundle\Config\ConfigRepository;
diff --git a/src/Bundle/ChillFamilyMembersBundle/Tests/Controller/FamilyMemberControllerTest.php b/src/Bundle/ChillFamilyMembersBundle/Tests/Controller/FamilyMemberControllerTest.php
index 6baa62bc1..7a10a6158 100644
--- a/src/Bundle/ChillFamilyMembersBundle/Tests/Controller/FamilyMemberControllerTest.php
+++ b/src/Bundle/ChillFamilyMembersBundle/Tests/Controller/FamilyMemberControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\AMLI\FamilyMembersBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -15,25 +17,25 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class FamilyMemberControllerTest extends WebTestCase
+final class FamilyMemberControllerTest extends WebTestCase
{
public function testEdit()
{
- $client = static::createClient();
+ $client = self::createClient();
$crawler = $client->request('GET', '/edit');
}
public function testIndex()
{
- $client = static::createClient();
+ $client = self::createClient();
$crawler = $client->request('GET', '/index');
}
public function testNew()
{
- $client = static::createClient();
+ $client = self::createClient();
$crawler = $client->request('GET', '/new');
}
diff --git a/src/Bundle/ChillMainBundle/CRUD/CompilerPass/CRUDControllerCompilerPass.php b/src/Bundle/ChillMainBundle/CRUD/CompilerPass/CRUDControllerCompilerPass.php
index e3ee53897..86ed8a4fa 100644
--- a/src/Bundle/ChillMainBundle/CRUD/CompilerPass/CRUDControllerCompilerPass.php
+++ b/src/Bundle/ChillMainBundle/CRUD/CompilerPass/CRUDControllerCompilerPass.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\CRUD\CompilerPass;
use Symfony\Component\DependencyInjection\Alias;
diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php
index fc6580f61..0e2881b54 100644
--- a/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php
+++ b/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\CRUD\Controller;
use Chill\MainBundle\CRUD\Form\CRUDDeleteEntityForm;
diff --git a/src/Bundle/ChillMainBundle/CRUD/Form/CRUDDeleteEntityForm.php b/src/Bundle/ChillMainBundle/CRUD/Form/CRUDDeleteEntityForm.php
index 277bcca51..00cb7bfc4 100644
--- a/src/Bundle/ChillMainBundle/CRUD/Form/CRUDDeleteEntityForm.php
+++ b/src/Bundle/ChillMainBundle/CRUD/Form/CRUDDeleteEntityForm.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\CRUD\Form;
use Symfony\Component\Form\AbstractType;
diff --git a/src/Bundle/ChillMainBundle/CRUD/Resolver/Resolver.php b/src/Bundle/ChillMainBundle/CRUD/Resolver/Resolver.php
index 0ac1da9ff..11b84e586 100644
--- a/src/Bundle/ChillMainBundle/CRUD/Resolver/Resolver.php
+++ b/src/Bundle/ChillMainBundle/CRUD/Resolver/Resolver.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\CRUD\Resolver;
use Doctrine\ORM\EntityManagerInterface;
diff --git a/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php b/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php
index 8a6d316e5..33cce8a2f 100644
--- a/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php
+++ b/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php
@@ -19,7 +19,9 @@ use Symfony\Component\Routing\RouteCollection;
use function array_filter;
use function array_keys;
use function array_search;
+use function count;
use function in_array;
+use const ARRAY_FILTER_USE_BOTH;
class CRUDRoutesLoader extends Loader
{
@@ -124,7 +126,7 @@ class CRUDRoutesLoader extends Loader
// path are rewritten
// if name === 'default', we rewrite it to nothing :-)
- $localName = in_array($name, ['_entity', '_index']) ? '' : '/' . $name;
+ $localName = in_array($name, ['_entity', '_index'], true) ? '' : '/' . $name;
if ('collection' === $action['single_collection'] || '_index' === $name) {
$localPath = $action['path'] ?? $localName . '.{_format}';
@@ -137,7 +139,7 @@ class CRUDRoutesLoader extends Loader
$methods = array_keys(array_filter(
$action['methods'],
- function ($value, $key) { return $value; },
+ static function ($value, $key) { return $value; },
ARRAY_FILTER_USE_BOTH
));
@@ -147,8 +149,8 @@ class CRUDRoutesLoader extends Loader
'or allow, at least, one method');
}
- if ('_entity' === $name && in_array(Request::METHOD_POST, $methods)) {
- unset($methods[array_search(Request::METHOD_POST, $methods)]);
+ if ('_entity' === $name && in_array(Request::METHOD_POST, $methods, true)) {
+ unset($methods[array_search(Request::METHOD_POST, $methods, true)]);
$entityPostRoute = $this->createEntityPostRoute(
$name,
$crudConfig,
diff --git a/src/Bundle/ChillMainBundle/CRUD/Templating/TwigCRUDResolver.php b/src/Bundle/ChillMainBundle/CRUD/Templating/TwigCRUDResolver.php
index 40b792bb6..8704a79ca 100644
--- a/src/Bundle/ChillMainBundle/CRUD/Templating/TwigCRUDResolver.php
+++ b/src/Bundle/ChillMainBundle/CRUD/Templating/TwigCRUDResolver.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\CRUD\Templating;
use Chill\MainBundle\CRUD\Resolver\Resolver;
diff --git a/src/Bundle/ChillMainBundle/Center/GroupingCenterInterface.php b/src/Bundle/ChillMainBundle/Center/GroupingCenterInterface.php
index 442ebffa2..4fb6071cd 100644
--- a/src/Bundle/ChillMainBundle/Center/GroupingCenterInterface.php
+++ b/src/Bundle/ChillMainBundle/Center/GroupingCenterInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Center;
/**
diff --git a/src/Bundle/ChillMainBundle/ChillMainBundle.php b/src/Bundle/ChillMainBundle/ChillMainBundle.php
index 244dfa3b0..2ff7ef862 100644
--- a/src/Bundle/ChillMainBundle/ChillMainBundle.php
+++ b/src/Bundle/ChillMainBundle/ChillMainBundle.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle;
use Chill\MainBundle\CRUD\CompilerPass\CRUDControllerCompilerPass;
diff --git a/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php b/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php
index 9bed468e4..1f07af303 100644
--- a/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php
+++ b/src/Bundle/ChillMainBundle/Command/ChillImportUsersCommand.php
@@ -36,6 +36,7 @@ use function array_key_exists;
use function array_keys;
use function array_merge;
use function bin2hex;
+use function count;
use function implode;
use function random_bytes;
use function trim;
@@ -324,7 +325,7 @@ class ChillImportUsersCommand extends Command
$question
->setMultiselect(true)
->setAutocompleterValues(array_keys($permissionGroupsByName))
- ->setNormalizer(function ($value) {
+ ->setNormalizer(static function ($value) {
if (null === $value) {
return '';
}
diff --git a/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php b/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php
index 0a78f8c59..c94ea35c2 100644
--- a/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php
+++ b/src/Bundle/ChillMainBundle/Command/ChillUserSendRenewPasswordCodeCommand.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Command;
use Chill\MainBundle\Entity\User;
@@ -139,8 +141,8 @@ class ChillUserSendRenewPasswordCodeCommand extends Command
$headers = $reader->getHeader();
- if (false === in_array('username', $headers)
- && false === in_array('email', $headers)) {
+ if (false === in_array('username', $headers, true)
+ && false === in_array('email', $headers, true)) {
throw new InvalidArgumentException('The csv file does not have an '
. 'username or email header');
}
@@ -150,7 +152,7 @@ class ChillUserSendRenewPasswordCodeCommand extends Command
protected function getUser($row)
{
- /* @var $userRepository \Chill\MainBundle\Repository\UserRepository */
+ /** @var \Chill\MainBundle\Repository\UserRepository $userRepository */
$userRepository = $this->em->getRepository(User::class);
try {
diff --git a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php
index 4f816cf6d..dfb912eb9 100644
--- a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php
+++ b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Command;
use Doctrine\ORM\EntityManager;
@@ -15,6 +17,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Intl\Intl;
+use function in_array;
/*
* Load or update the languages entities command
@@ -52,8 +55,9 @@ class LoadAndUpdateLanguagesCommand extends Command
parent::__construct();
}
- /*
- * (non-PHPdoc)
+ /**
+ * (non-PHPdoc).
+ *
* @see \Symfony\Component\Console\Command\Command::configure()
*/
protected function configure()
@@ -78,8 +82,9 @@ class LoadAndUpdateLanguagesCommand extends Command
);
}
- /*
- * (non-PHPdoc)
+ /**
+ * (non-PHPdoc).
+ *
* @see \Symfony\Component\Console\Command\Command::execute()
*/
protected function execute(InputInterface $input, OutputInterface $output)
@@ -99,11 +104,11 @@ class LoadAndUpdateLanguagesCommand extends Command
$excludeCode = (
(
!$input->getOption(self::INCLUDE_REGIONAL_VERSION)
- and strpos($code, '_')
- and !in_array($code, $this->regionalVersionToInclude)
- ) or (
+ && strpos($code, '_')
+ && !in_array($code, $this->regionalVersionToInclude, true)
+ ) || (
!$input->getOption(self::INCLUDE_ANCIENT)
- and in_array($code, $this->ancientToExclude)
+ && in_array($code, $this->ancientToExclude, true)
)
);
diff --git a/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php
index 9ef4f70ff..b47146324 100644
--- a/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php
+++ b/src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Command;
use Doctrine\ORM\EntityManager;
@@ -62,8 +64,9 @@ class LoadCountriesCommand extends Command
return $countryEntities;
}
- /*
- * (non-PHPdoc)
+ /**
+ * (non-PHPdoc).
+ *
* @see \Symfony\Component\Console\Command\Command::configure()
*/
protected function configure()
@@ -73,8 +76,9 @@ class LoadCountriesCommand extends Command
'but will update names according to available languages');
}
- /*
- * (non-PHPdoc)
+ /**
+ * (non-PHPdoc).
+ *
* @see \Symfony\Component\Console\Command\Command::execute()
*/
protected function execute(InputInterface $input, OutputInterface $output)
diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php
index e99a47673..a5f3c8611 100644
--- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php
+++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php
@@ -24,6 +24,7 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Validator\Validator\ValidatorInterface;
+use function count;
class LoadPostalCodesCommand extends Command
{
@@ -149,21 +150,21 @@ class LoadPostalCodesCommand extends Command
->setName($row[1])
->setCountry($country);
- if (null != $row[3]) {
+ if (null !== $row[3]) {
$postalCode->setRefPostalCodeId($row[3]);
}
- if (null != $row[4] & null != $row[5]) {
+ if (null !== $row[4] & null !== $row[5]) {
$postalCode->setCenter(Point::fromLonLat((float) $row[5], (float) $row[4]));
}
- if (null != $row[6]) {
+ if (null !== $row[6]) {
$postalCode->setPostalCodeSource($row[6]);
}
$errors = $this->validator->validate($postalCode);
- if ($errors->count() == 0) {
+ if ($errors->count() === 0) {
$em->persist($postalCode);
} else {
$msg = '';
@@ -195,9 +196,9 @@ class LoadPostalCodesCommand extends Command
. 'have the right to read it.');
}
- $resource = fopen($filename, 'r');
+ $resource = fopen($filename, 'rb');
- if (false == $resource) {
+ if (false === $resource) {
throw new RuntimeException("The file '{$filename}' could not be opened.");
}
diff --git a/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php b/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php
index 78ab6ada0..d61aed91c 100644
--- a/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php
+++ b/src/Bundle/ChillMainBundle/Command/SetPasswordCommand.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Command;
use Chill\MainBundle\Entity\User;
diff --git a/src/Bundle/ChillMainBundle/Controller/AddressApiController.php b/src/Bundle/ChillMainBundle/Controller/AddressApiController.php
index 9a5f9cc62..db87874e2 100644
--- a/src/Bundle/ChillMainBundle/Controller/AddressApiController.php
+++ b/src/Bundle/ChillMainBundle/Controller/AddressApiController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
diff --git a/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php
index 6f6836730..1230cd0f6 100644
--- a/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php
+++ b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
diff --git a/src/Bundle/ChillMainBundle/Controller/AdminController.php b/src/Bundle/ChillMainBundle/Controller/AdminController.php
index be6cc4e21..96ba627e4 100644
--- a/src/Bundle/ChillMainBundle/Controller/AdminController.php
+++ b/src/Bundle/ChillMainBundle/Controller/AdminController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
diff --git a/src/Bundle/ChillMainBundle/Controller/CenterController.php b/src/Bundle/ChillMainBundle/Controller/CenterController.php
index d07cd1dab..02ea19e20 100644
--- a/src/Bundle/ChillMainBundle/Controller/CenterController.php
+++ b/src/Bundle/ChillMainBundle/Controller/CenterController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\Entity\Center;
diff --git a/src/Bundle/ChillMainBundle/Controller/DefaultController.php b/src/Bundle/ChillMainBundle/Controller/DefaultController.php
index 0670f2365..2c8102a39 100644
--- a/src/Bundle/ChillMainBundle/Controller/DefaultController.php
+++ b/src/Bundle/ChillMainBundle/Controller/DefaultController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
diff --git a/src/Bundle/ChillMainBundle/Controller/ExportController.php b/src/Bundle/ChillMainBundle/Controller/ExportController.php
index eab491c52..809d0502d 100644
--- a/src/Bundle/ChillMainBundle/Controller/ExportController.php
+++ b/src/Bundle/ChillMainBundle/Controller/ExportController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\Export\ExportManager;
@@ -23,6 +25,7 @@ use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Translation\TranslatorInterface;
+use function count;
use function serialize;
use function unserialize;
@@ -80,7 +83,7 @@ class ExportController extends AbstractController
public function downloadResultAction(Request $request, $alias)
{
- /* @var $exportManager \Chill\MainBundle\Export\ExportManager */
+ /** @var \Chill\MainBundle\Export\ExportManager $exportManager */
$exportManager = $this->exportManager;
$key = $request->query->get('key', null);
@@ -118,7 +121,7 @@ class ExportController extends AbstractController
*/
public function generateAction(Request $request, $alias)
{
- /* @var $exportManager \Chill\MainBundle\Export\ExportManager */
+ /** @var \Chill\MainBundle\Export\ExportManager $exportManager */
$exportManager = $this->exportManager;
$key = $request->query->get('key', null);
@@ -212,7 +215,7 @@ class ExportController extends AbstractController
*/
protected function createCreateFormExport($alias, $step, $data = [])
{
- /* @var $exportManager \Chill\MainBundle\Export\ExportManager */
+ /** @var \Chill\MainBundle\Export\ExportManager $exportManager */
$exportManager = $this->exportManager;
$isGenerate = strpos($step, 'generate_') === 0;
@@ -222,20 +225,20 @@ class ExportController extends AbstractController
'csrf_protection' => $isGenerate ? false : true,
]);
- if ('centers' === $step or 'generate_centers' === $step) {
+ if ('centers' === $step || 'generate_centers' === $step) {
$builder->add('centers', PickCenterType::class, [
'export_alias' => $alias,
]);
}
- if ('export' === $step or 'generate_export' === $step) {
+ if ('export' === $step || 'generate_export' === $step) {
$builder->add('export', ExportType::class, [
'export_alias' => $alias,
'picked_centers' => $exportManager->getPickedCenters($data['centers']),
]);
}
- if ('formatter' === $step or 'generate_formatter' === $step) {
+ if ('formatter' === $step || 'generate_formatter' === $step) {
$builder->add('formatter', FormatterType::class, [
'formatter_alias' => $exportManager
->getFormatterAlias($data['export']),
@@ -388,7 +391,7 @@ class ExportController extends AbstractController
$dataFormatter = $this->session->get('formatter_step_raw', null);
$dataExport = $this->session->get('export_step_raw', null);
- if (null === $dataFormatter and $export instanceof \Chill\MainBundle\Export\ExportInterface) {
+ if (null === $dataFormatter && $export instanceof \Chill\MainBundle\Export\ExportInterface) {
return $this->redirectToRoute('chill_main_export_new', [
'alias' => $alias, 'step' => $this->getNextStep('generate', $export, true),
]);
@@ -401,7 +404,7 @@ class ExportController extends AbstractController
'alias' => $alias,
];
unset($parameters['_token']);
- $key = md5(uniqid(rand(), false));
+ $key = md5(uniqid(mt_rand(), false));
$this->redis->setEx($key, 3600, serialize($parameters));
@@ -466,7 +469,7 @@ class ExportController extends AbstractController
*/
protected function selectCentersStep(Request $request, $export, $alias)
{
- /* @var $exportManager \Chill\MainBundle\Export\ExportManager */
+ /** @var \Chill\MainBundle\Export\ExportManager $exportManager */
$exportManager = $this->exportManager;
$form = $this->createCreateFormExport($alias, 'centers');
diff --git a/src/Bundle/ChillMainBundle/Controller/LocationApiController.php b/src/Bundle/ChillMainBundle/Controller/LocationApiController.php
index 52b6f1e81..525475e3c 100644
--- a/src/Bundle/ChillMainBundle/Controller/LocationApiController.php
+++ b/src/Bundle/ChillMainBundle/Controller/LocationApiController.php
@@ -7,11 +7,11 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
-use DateInterval;
-use DateTime;
use Symfony\Component\HttpFoundation\Request;
/**
@@ -21,22 +21,11 @@ class LocationApiController extends ApiController
{
public function customizeQuery(string $action, Request $request, $query): void
{
- $query->andWhere($query->expr()->orX(
- $query->expr()->andX(
- $query->expr()->eq('e.createdBy', ':user'),
- $query->expr()->gte('e.createdAt', ':dateBefore')
- ),
+ $query->andWhere(
$query->expr()->andX(
$query->expr()->eq('e.availableForUsers', "'TRUE'"),
$query->expr()->eq('e.active', "'TRUE'"),
- $query->expr()->isNotNull('e.name'),
- $query->expr()->neq('e.name', ':emptyString'),
)
- ))
- ->setParameters([
- 'user' => $this->getUser(),
- 'dateBefore' => (new DateTime())->sub(new DateInterval('P6M')),
- 'emptyString' => '',
- ]);
+ );
}
}
diff --git a/src/Bundle/ChillMainBundle/Controller/LocationController.php b/src/Bundle/ChillMainBundle/Controller/LocationController.php
index ca740bcb5..10087ec1e 100644
--- a/src/Bundle/ChillMainBundle/Controller/LocationController.php
+++ b/src/Bundle/ChillMainBundle/Controller/LocationController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
diff --git a/src/Bundle/ChillMainBundle/Controller/LocationTypeApiController.php b/src/Bundle/ChillMainBundle/Controller/LocationTypeApiController.php
index 2ee0bc41b..1c7fbdb89 100644
--- a/src/Bundle/ChillMainBundle/Controller/LocationTypeApiController.php
+++ b/src/Bundle/ChillMainBundle/Controller/LocationTypeApiController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
diff --git a/src/Bundle/ChillMainBundle/Controller/LocationTypeController.php b/src/Bundle/ChillMainBundle/Controller/LocationTypeController.php
index b7c98a6e3..542282260 100644
--- a/src/Bundle/ChillMainBundle/Controller/LocationTypeController.php
+++ b/src/Bundle/ChillMainBundle/Controller/LocationTypeController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
diff --git a/src/Bundle/ChillMainBundle/Controller/LoginController.php b/src/Bundle/ChillMainBundle/Controller/LoginController.php
index 09b14fb44..d853d75af 100644
--- a/src/Bundle/ChillMainBundle/Controller/LoginController.php
+++ b/src/Bundle/ChillMainBundle/Controller/LoginController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
diff --git a/src/Bundle/ChillMainBundle/Controller/MenuController.php b/src/Bundle/ChillMainBundle/Controller/MenuController.php
index 0f87217eb..81a80f485 100644
--- a/src/Bundle/ChillMainBundle/Controller/MenuController.php
+++ b/src/Bundle/ChillMainBundle/Controller/MenuController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
diff --git a/src/Bundle/ChillMainBundle/Controller/NotificationController.php b/src/Bundle/ChillMainBundle/Controller/NotificationController.php
index 58be0a33a..4eed79740 100644
--- a/src/Bundle/ChillMainBundle/Controller/NotificationController.php
+++ b/src/Bundle/ChillMainBundle/Controller/NotificationController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\Notification\NotificationRenderer;
diff --git a/src/Bundle/ChillMainBundle/Controller/PasswordController.php b/src/Bundle/ChillMainBundle/Controller/PasswordController.php
index e8139c4cf..853cb85d6 100644
--- a/src/Bundle/ChillMainBundle/Controller/PasswordController.php
+++ b/src/Bundle/ChillMainBundle/Controller/PasswordController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\Entity\User;
@@ -175,7 +177,7 @@ class PasswordController extends AbstractController
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
- /* @var $qb \Doctrine\ORM\QueryBuilder */
+ /** @var \Doctrine\ORM\QueryBuilder $qb */
$qb = $this->getDoctrine()->getManager()
->createQueryBuilder();
$qb->select('u')
diff --git a/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php b/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php
index 3476c4bbe..6a2afccb2 100644
--- a/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php
+++ b/src/Bundle/ChillMainBundle/Controller/PermissionApiController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
diff --git a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php
index 393849776..8cffd02b3 100644
--- a/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php
+++ b/src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\Entity\PermissionsGroup;
@@ -24,6 +26,7 @@ use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Security\Core\Role\RoleHierarchy;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
+use function array_key_exists;
/**
* Class PermissionsGroupController.
@@ -143,7 +146,7 @@ class PermissionsGroupController extends AbstractController
$roleScopesSorted = [];
foreach ($permissionsGroup->getRoleScopes()->toArray() as $roleScope) {
- /* @var $roleScope RoleScope */
+ /** @var RoleScope $roleScope */
$title = $roleProvider->getRoleTitle($roleScope->getRole());
$roleScopesSorted[$title][] = $roleScope;
}
@@ -154,7 +157,7 @@ class PermissionsGroupController extends AbstractController
'edit_form' => $editForm->createView(),
'role_scopes_sorted' => $roleScopesSorted,
'expanded_roles' => $this->getExpandedRoles($permissionsGroup->getRoleScopes()->toArray()),
- 'delete_role_scopes_form' => array_map(function ($form) {
+ 'delete_role_scopes_form' => array_map(static function ($form) {
return $form->createView();
}, $deleteRoleScopesForm),
'add_role_scopes_form' => $addRoleScopesForm->createView(),
@@ -290,7 +293,7 @@ class PermissionsGroupController extends AbstractController
$roleScopesSorted = [];
foreach ($permissionsGroup->getRoleScopes()->toArray() as $roleScope) {
- /* @var $roleScope RoleScope */
+ /** @var RoleScope $roleScope */
$title = $roleProvider->getRoleTitle($roleScope->getRole());
$roleScopesSorted[$title][] = $roleScope;
}
@@ -301,7 +304,7 @@ class PermissionsGroupController extends AbstractController
'role_scopes_sorted' => $roleScopesSorted,
'edit_form' => $editForm->createView(),
'expanded_roles' => $this->getExpandedRoles($permissionsGroup->getRoleScopes()->toArray()),
- 'delete_role_scopes_form' => array_map(function ($form) {
+ 'delete_role_scopes_form' => array_map(static function ($form) {
return $form->createView();
}, $deleteRoleScopesForm),
'add_role_scopes_form' => $addRoleScopesForm->createView(),
@@ -357,7 +360,7 @@ class PermissionsGroupController extends AbstractController
// sort $roleScopes by name
usort(
$roleScopes,
- function (RoleScope $a, RoleScope $b) use ($translatableStringHelper) {
+ static function (RoleScope $a, RoleScope $b) use ($translatableStringHelper) {
if ($a->getScope() === null) {
return 1;
}
@@ -378,7 +381,7 @@ class PermissionsGroupController extends AbstractController
$roleScopesSorted = [];
foreach ($roleScopes as $roleScope) {
- /* @var $roleScope RoleScope */
+ /** @var RoleScope $roleScope */
$title = $roleProvider->getRoleTitle($roleScope->getRole());
$roleScopesSorted[$title][] = $roleScope;
}
@@ -434,7 +437,7 @@ class PermissionsGroupController extends AbstractController
$roleScopesSorted = [];
foreach ($permissionsGroup->getRoleScopes()->toArray() as $roleScope) {
- /* @var $roleScope RoleScope */
+ /** @var RoleScope $roleScope */
$title = $roleProvider->getRoleTitle($roleScope->getRole());
$roleScopesSorted[$title][] = $roleScope;
}
@@ -445,7 +448,7 @@ class PermissionsGroupController extends AbstractController
'role_scopes_sorted' => $roleScopesSorted,
'edit_form' => $editForm->createView(),
'expanded_roles' => $this->getExpandedRoles($permissionsGroup->getRoleScopes()->toArray()),
- 'delete_role_scopes_form' => array_map(function ($form) {
+ 'delete_role_scopes_form' => array_map(static function ($form) {
return $form->createView();
}, $deleteRoleScopesForm),
'add_role_scopes_form' => $addRoleScopesForm->createView(),
@@ -569,7 +572,7 @@ class PermissionsGroupController extends AbstractController
if (!array_key_exists($roleScope->getRole(), $expandedRoles)) {
$expandedRoles[$roleScope->getRole()] =
array_map(
- function (Role $role) {
+ static function (Role $role) {
return $role->getRole();
},
$this->roleHierarchy
diff --git a/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php b/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php
index fc11a30d6..fb926733b 100644
--- a/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php
+++ b/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
diff --git a/src/Bundle/ChillMainBundle/Controller/PostalCodeController.php b/src/Bundle/ChillMainBundle/Controller/PostalCodeController.php
index 04ac9332e..0280be61f 100644
--- a/src/Bundle/ChillMainBundle/Controller/PostalCodeController.php
+++ b/src/Bundle/ChillMainBundle/Controller/PostalCodeController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\Entity\PostalCode;
diff --git a/src/Bundle/ChillMainBundle/Controller/ScopeController.php b/src/Bundle/ChillMainBundle/Controller/ScopeController.php
index 8fae5d730..07945c7fa 100644
--- a/src/Bundle/ChillMainBundle/Controller/ScopeController.php
+++ b/src/Bundle/ChillMainBundle/Controller/ScopeController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\Entity\Scope;
diff --git a/src/Bundle/ChillMainBundle/Controller/SearchController.php b/src/Bundle/ChillMainBundle/Controller/SearchController.php
index 7d1a08f46..c231bf162 100644
--- a/src/Bundle/ChillMainBundle/Controller/SearchController.php
+++ b/src/Bundle/ChillMainBundle/Controller/SearchController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\Pagination\PaginatorFactory;
@@ -25,6 +27,7 @@ use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Contracts\Translation\TranslatorInterface;
+use function count;
use function key;
use function reset;
@@ -56,9 +59,9 @@ class SearchController extends AbstractController
public function advancedSearchAction($name, Request $request)
{
try {
- /* @var $variable Chill\MainBundle\Search\SearchProvider */
+ /** @var Chill\MainBundle\Search\SearchProvider $variable */
$searchProvider = $this->searchProvider;
- /* @var $variable Chill\MainBundle\Search\HasAdvancedSearchFormInterface */
+ /** @var Chill\MainBundle\Search\HasAdvancedSearchFormInterface $variable */
$search = $this->searchProvider
->getHasAdvancedFormByName($name);
} catch (\Chill\MainBundle\Search\UnknowSearchNameException $e) {
@@ -100,12 +103,12 @@ class SearchController extends AbstractController
public function advancedSearchListAction(Request $request)
{
- /* @var $variable Chill\MainBundle\Search\SearchProvider */
+ /** @var Chill\MainBundle\Search\SearchProvider $variable */
$searchProvider = $this->searchProvider;
$advancedSearchProviders = $searchProvider
->getHasAdvancedFormSearchServices();
- if (\count($advancedSearchProviders) === 1) {
+ if (count($advancedSearchProviders) === 1) {
reset($advancedSearchProviders);
return $this->redirectToRoute('chill_main_advanced_search', [
diff --git a/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php b/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php
index 55b809265..8cf5f8782 100644
--- a/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php
+++ b/src/Bundle/ChillMainBundle/Controller/TimelineCenterController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\Pagination\PaginatorFactory;
@@ -15,6 +17,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Security;
+use function count;
class TimelineCenterController extends AbstractController
{
diff --git a/src/Bundle/ChillMainBundle/Controller/UIController.php b/src/Bundle/ChillMainBundle/Controller/UIController.php
index 9424cfbad..97be4ca3c 100644
--- a/src/Bundle/ChillMainBundle/Controller/UIController.php
+++ b/src/Bundle/ChillMainBundle/Controller/UIController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\Templating\UI\CountNotificationUser;
diff --git a/src/Bundle/ChillMainBundle/Controller/UserApiController.php b/src/Bundle/ChillMainBundle/Controller/UserApiController.php
index 46ba35155..75e566048 100644
--- a/src/Bundle/ChillMainBundle/Controller/UserApiController.php
+++ b/src/Bundle/ChillMainBundle/Controller/UserApiController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
diff --git a/src/Bundle/ChillMainBundle/Controller/UserController.php b/src/Bundle/ChillMainBundle/Controller/UserController.php
index 4167bb173..5b72115b8 100644
--- a/src/Bundle/ChillMainBundle/Controller/UserController.php
+++ b/src/Bundle/ChillMainBundle/Controller/UserController.php
@@ -87,7 +87,7 @@ class UserController extends CRUDController
return $this->redirect($this->generateUrl(
'chill_crud_admin_user_edit',
- \array_merge(['id' => $uid], $returnPathParams)
+ array_merge(['id' => $uid], $returnPathParams)
));
}
@@ -237,7 +237,7 @@ class UserController extends CRUDController
[
'add_groupcenter_form' => $this->createAddLinkGroupCenterForm($entity, $request)->createView(),
'delete_groupcenter_form' => array_map(
- function (Form $form) {
+ static function (Form $form) {
return $form->createView();
},
iterator_to_array($this->getDeleteLinkGroupCenterByUser($entity, $request), true)
diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAbstractNotificationsTrait.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAbstractNotificationsTrait.php
index a5ff75ec4..bbeab94b3 100644
--- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAbstractNotificationsTrait.php
+++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAbstractNotificationsTrait.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Entity\Notification;
diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAddressReferences.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAddressReferences.php
index cea5a7e0e..a4afefa2b 100644
--- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAddressReferences.php
+++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAddressReferences.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Doctrine\Model\Point;
@@ -67,7 +69,7 @@ class LoadAddressReferences extends AbstractFixture implements ContainerAwareInt
$ar->setRefId($this->faker->numerify('ref-id-######'));
$ar->setStreet($this->faker->streetName);
- $ar->setStreetNumber(rand(0, 199));
+ $ar->setStreetNumber((string) mt_rand(0, 199));
$ar->setPoint($this->getRandomPoint());
$ar->setPostcode($this->getReference(
LoadPostalCodes::$refs[array_rand(LoadPostalCodes::$refs)]
@@ -87,8 +89,8 @@ class LoadAddressReferences extends AbstractFixture implements ContainerAwareInt
{
$lonBrussels = 4.35243;
$latBrussels = 50.84676;
- $lon = $lonBrussels + 0.01 * rand(-5, 5);
- $lat = $latBrussels + 0.01 * rand(-5, 5);
+ $lon = $lonBrussels + 0.01 * mt_rand(-5, 5);
+ $lat = $latBrussels + 0.01 * mt_rand(-5, 5);
return Point::fromLonLat($lon, $lat);
}
diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCenters.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCenters.php
index adcfe484e..e4cd7d565 100644
--- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCenters.php
+++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCenters.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Entity\Center;
diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCivility.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCivility.php
index 84a2ba181..856ef6a46 100644
--- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCivility.php
+++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCivility.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Entity\Civility;
diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCountries.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCountries.php
index e162b1d97..88750b340 100644
--- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCountries.php
+++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadCountries.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Command\LoadCountriesCommand;
diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadGroupCenters.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadGroupCenters.php
index 4b1580324..ad04709ab 100644
--- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadGroupCenters.php
+++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadGroupCenters.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Entity\GroupCenter;
diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php
index cfa149411..47d63efdf 100644
--- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php
+++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Entity\Language;
@@ -16,6 +18,7 @@ use Doctrine\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Intl\Intl;
+use function in_array;
/**
* Load languages into database.
@@ -46,8 +49,8 @@ class LoadLanguages extends AbstractFixture implements ContainerAwareInterface,
foreach (Intl::getLanguageBundle()->getLanguageNames() as $code => $language) {
if (
- !in_array($code, $this->regionalVersionToInclude)
- && !in_array($code, $this->ancientToExclude)
+ !in_array($code, $this->regionalVersionToInclude, true)
+ && !in_array($code, $this->ancientToExclude, true)
) {
$lang = (new Language())
->setId($code)
diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLocationType.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLocationType.php
index 72d1c05e5..3e24d034c 100644
--- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLocationType.php
+++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLocationType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Entity\LocationType;
diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPermissionsGroup.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPermissionsGroup.php
index cffdf98d7..dc7773765 100644
--- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPermissionsGroup.php
+++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPermissionsGroup.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Entity\PermissionsGroup;
diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPostalCodes.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPostalCodes.php
index 17728d14d..ecf839450 100644
--- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPostalCodes.php
+++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPostalCodes.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Doctrine\Model\Point;
@@ -57,7 +59,7 @@ class LoadPostalCodes extends AbstractFixture implements OrderedFixtureInterface
1315,INCOURT,BE
1315,INCOURT,BE
1315,INCOURT,BE
- 1320,BEAUVECHAIN,BE
+ 1320,BEAUVECHAIN,BE
EOF;
private static $postalCodeFrance = <<<'EOF'
@@ -322,7 +324,7 @@ class LoadPostalCodes extends AbstractFixture implements OrderedFixtureInterface
85770,L ILE D ELLE,FR,85111,46.3334258655,-0.919100677098,INSEE
85800,ST GILLES CROIX DE VIE,FR,85222,46.6904708814,-1.91946363327,INSEE
85800,LE FENOUILLER,FR,85088,46.7161264566,-1.89206667498,INSEE
- 85800,GIVRAND,FR,85100,46.6822701061,-1.8787272243,INSEE
+ 85800,GIVRAND,FR,85100,46.6822701061,-1.8787272243,INSEE
EOF;
public function getOrder()
@@ -350,15 +352,15 @@ class LoadPostalCodes extends AbstractFixture implements OrderedFixtureInterface
->setCode($code[0])
->setName(ucwords(strtolower($code[1])));
- if (null != $code[3]) {
+ if (null !== $code[3]) {
$c->setRefPostalCodeId($code[3]);
}
- if (null != $code[4] & null != $code[5]) {
+ if (null !== $code[4] & null !== $code[5]) {
$c->setCenter(Point::fromLonLat((float) $code[5], (float) $code[4]));
}
- if (null != $code[6]) {
+ if (null !== $code[6]) {
$c->setPostalCodeSource($code[6]);
}
diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadRoleScopes.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadRoleScopes.php
index adacea5ef..9db21414d 100644
--- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadRoleScopes.php
+++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadRoleScopes.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Entity\RoleScope;
diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadScopes.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadScopes.php
index 33a7b2d6b..d3a66d887 100644
--- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadScopes.php
+++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadScopes.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\AbstractFixture;
diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php
index 70c6fe1dc..b7d7cb941 100644
--- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php
+++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadUsers.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Entity\User;
@@ -26,7 +28,7 @@ use function str_replace;
* create a user for each permission_group and center.
* username and password are identicals.
*/
-class LoadUsers extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface
+class LoadUsers extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
{
public static $refs = [
'center a_social' => [
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php
index 4fc4fb752..012643aad 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/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\Controller\AddressApiController;
@@ -42,6 +44,7 @@ use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
+use function count;
/**
* Class ChillMainExtension
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/ExportsCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/ExportsCompilerPass.php
index f91cfe126..64b5704bc 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/ExportsCompilerPass.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/ExportsCompilerPass.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DependencyInjection\CompilerPass;
use LogicException;
@@ -61,7 +63,7 @@ class ExportsCompilerPass implements CompilerPassInterface
"service '{$id}' definition");
}
- if (array_search($attributes['alias'], $knownAliases)) {
+ if (array_search($attributes['alias'], $knownAliases, true)) {
throw new LogicException('There is already a chill.export_aggregator service with alias '
. $attributes['alias'] . '. Choose another alias.');
}
@@ -92,7 +94,7 @@ class ExportsCompilerPass implements CompilerPassInterface
"service '{$id}' definition");
}
- if (array_search($attributes['prefix'], $knownAliases)) {
+ if (array_search($attributes['prefix'], $knownAliases, true)) {
throw new LogicException('There is already a chill.export_elements_provider service with prefix '
. $attributes['prefix'] . '. Choose another prefix.');
}
@@ -123,7 +125,7 @@ class ExportsCompilerPass implements CompilerPassInterface
"service '{$id}' definition");
}
- if (array_search($attributes['alias'], $knownAliases)) {
+ if (array_search($attributes['alias'], $knownAliases, true)) {
throw new LogicException('There is already a chill.export service with alias '
. $attributes['alias'] . '. Choose another alias.');
}
@@ -154,7 +156,7 @@ class ExportsCompilerPass implements CompilerPassInterface
"service '{$id}' definition");
}
- if (array_search($attributes['alias'], $knownAliases)) {
+ if (array_search($attributes['alias'], $knownAliases, true)) {
throw new LogicException('There is already a chill.export_filter service with alias '
. $attributes['alias'] . '. Choose another alias.');
}
@@ -185,7 +187,7 @@ class ExportsCompilerPass implements CompilerPassInterface
"service '{$id}' definition");
}
- if (array_search($attributes['alias'], $knownAliases)) {
+ if (array_search($attributes['alias'], $knownAliases, true)) {
throw new LogicException('There is already a chill.export_formatter service with alias '
. $attributes['alias'] . '. Choose another alias.');
}
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/GroupingCenterCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/GroupingCenterCompilerPass.php
index 7a361f0e0..9b5d0903c 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/GroupingCenterCompilerPass.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/GroupingCenterCompilerPass.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DependencyInjection\CompilerPass;
use LogicException;
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/MenuCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/MenuCompilerPass.php
index 34cd6246e..7a63412d5 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/MenuCompilerPass.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/MenuCompilerPass.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DependencyInjection\CompilerPass;
use Chill\MainBundle\Routing\MenuComposer;
@@ -35,8 +37,8 @@ class MenuCompilerPass implements CompilerPassInterface
];
}
- usort($services, function ($a, $b) {
- if ($a['priority'] == $b['priority']) {
+ usort($services, static function ($a, $b) {
+ if ($a['priority'] === $b['priority']) {
return 0;
}
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/NotificationCounterCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/NotificationCounterCompilerPass.php
index 3092c3ee6..36435400c 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/NotificationCounterCompilerPass.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/NotificationCounterCompilerPass.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DependencyInjection\CompilerPass;
use Chill\MainBundle\Templating\UI\CountNotificationUser;
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/SearchableServicesCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/SearchableServicesCompilerPass.php
index 756438e71..e5504a532 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/SearchableServicesCompilerPass.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/SearchableServicesCompilerPass.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DependencyInjection\CompilerPass;
use LogicException;
@@ -16,8 +18,9 @@ use Symfony\Component\DependencyInjection\Reference;
class SearchableServicesCompilerPass implements CompilerPassInterface
{
- /*
- * (non-PHPdoc)
+ /**
+ * (non-PHPdoc).
+ *
* @see \Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process()
*/
public function process(ContainerBuilder $container)
@@ -44,7 +47,7 @@ class SearchableServicesCompilerPass implements CompilerPassInterface
"service '{$id}' definition");
}
- if (array_search($attributes['alias'], $knownAliases)) {
+ if (array_search($attributes['alias'], $knownAliases, true)) {
throw new LogicException('There is already a chill.search service with alias '
. $attributes['alias'] . '. Choose another alias.');
}
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/TimelineCompilerClass.php b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/TimelineCompilerClass.php
index 246a81a1a..8b9b83fb6 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/TimelineCompilerClass.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/TimelineCompilerClass.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DependencyInjection\CompilerPass;
use LogicException;
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/WidgetsCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/WidgetsCompilerPass.php
index 2fd9416c4..f079571a1 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/WidgetsCompilerPass.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/WidgetsCompilerPass.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DependencyInjection\CompilerPass;
use Chill\MainBundle\DependencyInjection\Widget\AbstractWidgetsCompilerPass;
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ConfigConsistencyCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/ConfigConsistencyCompilerPass.php
index 17a9a0422..5a803e9de 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/ConfigConsistencyCompilerPass.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/ConfigConsistencyCompilerPass.php
@@ -7,12 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DependencyInjection;
use LogicException;
use RuntimeException;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
+use function count;
/**
* Description of ConfigConsistencyCompilerPass.
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php
index 85d0150ba..9236c8a50 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.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;
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/MissingBundleException.php b/src/Bundle/ChillMainBundle/DependencyInjection/MissingBundleException.php
index 636cc69c3..54961699a 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/MissingBundleException.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/MissingBundleException.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DependencyInjection;
use Exception;
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/RoleProvidersCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/RoleProvidersCompilerPass.php
index 5e3538234..fa9fd2d30 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/RoleProvidersCompilerPass.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/RoleProvidersCompilerPass.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DependencyInjection;
use LogicException;
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php
index b8eebc3be..e352470e7 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DependencyInjection\Widget;
use Chill\MainBundle\DependencyInjection\Widget\Factory\WidgetFactoryInterface;
@@ -19,6 +21,11 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
use UnexpectedValueException;
+use function array_key_exists;
+use function count;
+use function get_class;
+use function in_array;
+use function is_array;
/**
* Compile the configurations and inject required service into container.
@@ -135,7 +142,7 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface
$managerDefinition = $container->getDefinition(self::WIDGET_MANAGER);
// collect the widget factories
- /* @var $extensionClass HasWidgetFactoriesExtensionInterface */
+ /** @var HasWidgetFactoriesExtensionInterface $extensionClass */
$extensionClass = $container->getExtension($extension);
// throw an error if extension does not implement HasWidgetFactoriesExtensionInterface
if (!$extensionClass instanceof HasWidgetFactoriesExtensionInterface) {
@@ -182,7 +189,7 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface
// register the widget with config to the service, using the method
// `addWidget`
if ($this->widgetServices[$alias] instanceof WidgetFactoryInterface) {
- /* @var $factory WidgetFactoryInterface */
+ /** @var WidgetFactoryInterface $factory */
$factory = $this->widgetServices[$alias];
// get the config (under the key which equals to widget_alias
$config = isset($param[$factory->getWidgetAlias()]) ?
@@ -263,7 +270,7 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface
// add the services defined by factories
foreach ($this->widgetFactories as $factory) {
- /* @var $factory WidgetFactoryInterface */
+ /** @var WidgetFactoryInterface $factory */
$alias = $factory->getWidgetAlias();
// check the alias is not empty
@@ -281,7 +288,7 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface
get_class($factory));
}
- if (count($factory->getAllowedPlaces()) == 0) {
+ if (count($factory->getAllowedPlaces()) === 0) {
throw new LengthException("The method 'getAllowedPlaces' should "
. 'return a non-empty array, but returned 0 elements on ' .
get_class($factory) . '::getAllowedPlaces()');
@@ -345,7 +352,7 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface
}
// check if the order exists
- if (array_search($ordering, $this->cacheOrdering[$place])) {
+ if (array_search($ordering, $this->cacheOrdering[$place], true)) {
// if the order exists, increment of 1 and try again
return $this->cacheAndGetOrdering($place, $ordering + 1);
}
@@ -367,7 +374,7 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface
{
if ($this->widgetServices[$widgetAlias] instanceof WidgetFactoryInterface) {
if (in_array($place, $this->widgetServices[$widgetAlias]
- ->getAllowedPlaces())) {
+ ->getAllowedPlaces(), true)) {
return true;
}
} else {
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AddWidgetConfigurationTrait.php b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AddWidgetConfigurationTrait.php
index 8e377880f..2b2d0f001 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AddWidgetConfigurationTrait.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AddWidgetConfigurationTrait.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DependencyInjection\Widget;
use Chill\MainBundle\DependencyInjection\Widget\AbstractWidgetsCompilerPass as WidgetsCompilerPass;
@@ -14,7 +16,10 @@ use Generator;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\DependencyInjection\ContainerBuilder;
+use function array_key_exists;
+use function count;
use function implode;
+use function in_array;
/**
* This trait allow to add automatic configuration for widget inside your config.
@@ -192,7 +197,7 @@ trait AddWidgetConfigurationTrait
protected function filterWidgetByPlace($place)
{
foreach ($this->widgetFactories as $factory) {
- if (in_array($place, $factory->getAllowedPlaces())) {
+ if (in_array($place, $factory->getAllowedPlaces(), true)) {
yield $factory;
}
}
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/Factory/AbstractWidgetFactory.php b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/Factory/AbstractWidgetFactory.php
index e6153bc4e..242b46e9c 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/Factory/AbstractWidgetFactory.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/Factory/AbstractWidgetFactory.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DependencyInjection\Widget\Factory;
use Symfony\Component\DependencyInjection\ContainerBuilder;
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/Factory/WidgetFactoryInterface.php b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/Factory/WidgetFactoryInterface.php
index 99092e461..8ab19a270 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/Factory/WidgetFactoryInterface.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/Factory/WidgetFactoryInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DependencyInjection\Widget\Factory;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/HasWidgetFactoriesExtensionInterface.php b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/HasWidgetFactoriesExtensionInterface.php
index 702ba15da..92279ea70 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/HasWidgetFactoriesExtensionInterface.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/HasWidgetFactoriesExtensionInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\DependencyInjection\Widget;
use Chill\MainBundle\DependencyInjection\Widget\Factory\WidgetFactoryInterface;
diff --git a/src/Bundle/ChillMainBundle/Doctrine/DQL/GetJsonFieldByKey.php b/src/Bundle/ChillMainBundle/Doctrine/DQL/GetJsonFieldByKey.php
index 0a60974b1..d57cc866d 100644
--- a/src/Bundle/ChillMainBundle/Doctrine/DQL/GetJsonFieldByKey.php
+++ b/src/Bundle/ChillMainBundle/Doctrine/DQL/GetJsonFieldByKey.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Doctrine\DQL;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
diff --git a/src/Bundle/ChillMainBundle/Doctrine/DQL/JsonAggregate.php b/src/Bundle/ChillMainBundle/Doctrine/DQL/JsonAggregate.php
index a2d2b1f82..a678f8c27 100644
--- a/src/Bundle/ChillMainBundle/Doctrine/DQL/JsonAggregate.php
+++ b/src/Bundle/ChillMainBundle/Doctrine/DQL/JsonAggregate.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Doctrine\DQL;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
diff --git a/src/Bundle/ChillMainBundle/Doctrine/DQL/JsonbArrayLength.php b/src/Bundle/ChillMainBundle/Doctrine/DQL/JsonbArrayLength.php
index 31b1504db..680d5c6f4 100644
--- a/src/Bundle/ChillMainBundle/Doctrine/DQL/JsonbArrayLength.php
+++ b/src/Bundle/ChillMainBundle/Doctrine/DQL/JsonbArrayLength.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Doctrine\DQL;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
diff --git a/src/Bundle/ChillMainBundle/Doctrine/DQL/JsonbExistsInArray.php b/src/Bundle/ChillMainBundle/Doctrine/DQL/JsonbExistsInArray.php
index 1f4d12afa..6295cf366 100644
--- a/src/Bundle/ChillMainBundle/Doctrine/DQL/JsonbExistsInArray.php
+++ b/src/Bundle/ChillMainBundle/Doctrine/DQL/JsonbExistsInArray.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Doctrine\DQL;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
diff --git a/src/Bundle/ChillMainBundle/Doctrine/DQL/Replace.php b/src/Bundle/ChillMainBundle/Doctrine/DQL/Replace.php
index 779d1281d..d7f46ab54 100644
--- a/src/Bundle/ChillMainBundle/Doctrine/DQL/Replace.php
+++ b/src/Bundle/ChillMainBundle/Doctrine/DQL/Replace.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Doctrine\DQL;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
diff --git a/src/Bundle/ChillMainBundle/Doctrine/DQL/STContains.php b/src/Bundle/ChillMainBundle/Doctrine/DQL/STContains.php
index 9a28b6132..810084e56 100644
--- a/src/Bundle/ChillMainBundle/Doctrine/DQL/STContains.php
+++ b/src/Bundle/ChillMainBundle/Doctrine/DQL/STContains.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Doctrine\DQL;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
diff --git a/src/Bundle/ChillMainBundle/Doctrine/DQL/Similarity.php b/src/Bundle/ChillMainBundle/Doctrine/DQL/Similarity.php
index 0ef7d8b2f..d6a3c1238 100644
--- a/src/Bundle/ChillMainBundle/Doctrine/DQL/Similarity.php
+++ b/src/Bundle/ChillMainBundle/Doctrine/DQL/Similarity.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Doctrine\DQL;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
diff --git a/src/Bundle/ChillMainBundle/Doctrine/DQL/StrictWordSimilarityOPS.php b/src/Bundle/ChillMainBundle/Doctrine/DQL/StrictWordSimilarityOPS.php
index 6606c2298..fead5a37d 100644
--- a/src/Bundle/ChillMainBundle/Doctrine/DQL/StrictWordSimilarityOPS.php
+++ b/src/Bundle/ChillMainBundle/Doctrine/DQL/StrictWordSimilarityOPS.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Doctrine\DQL;
use Doctrine\ORM\Query\Lexer;
diff --git a/src/Bundle/ChillMainBundle/Doctrine/DQL/Unaccent.php b/src/Bundle/ChillMainBundle/Doctrine/DQL/Unaccent.php
index 80e3e58e8..799b208bb 100644
--- a/src/Bundle/ChillMainBundle/Doctrine/DQL/Unaccent.php
+++ b/src/Bundle/ChillMainBundle/Doctrine/DQL/Unaccent.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Doctrine\DQL;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
diff --git a/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php b/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php
index 4c91f9679..3aabe46fc 100644
--- a/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php
+++ b/src/Bundle/ChillMainBundle/Doctrine/Event/TrackCreateUpdateSubscriber.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Doctrine\Event;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
diff --git a/src/Bundle/ChillMainBundle/Doctrine/Migrations/VersionComparator.php b/src/Bundle/ChillMainBundle/Doctrine/Migrations/VersionComparator.php
index f1e528213..aafa852f6 100644
--- a/src/Bundle/ChillMainBundle/Doctrine/Migrations/VersionComparator.php
+++ b/src/Bundle/ChillMainBundle/Doctrine/Migrations/VersionComparator.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Doctrine\Migrations;
use Doctrine\Migrations\Version\Comparator;
diff --git a/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php b/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php
index 423e23e04..f63101b33 100644
--- a/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php
+++ b/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Doctrine\Model;
use Exception;
diff --git a/src/Bundle/ChillMainBundle/Doctrine/Model/PointException.php b/src/Bundle/ChillMainBundle/Doctrine/Model/PointException.php
index 98a8b0e9d..5186e8168 100644
--- a/src/Bundle/ChillMainBundle/Doctrine/Model/PointException.php
+++ b/src/Bundle/ChillMainBundle/Doctrine/Model/PointException.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Doctrine\Model;
use Exception;
diff --git a/src/Bundle/ChillMainBundle/Doctrine/Model/TrackCreationInterface.php b/src/Bundle/ChillMainBundle/Doctrine/Model/TrackCreationInterface.php
index ba570eec4..f4862c35a 100644
--- a/src/Bundle/ChillMainBundle/Doctrine/Model/TrackCreationInterface.php
+++ b/src/Bundle/ChillMainBundle/Doctrine/Model/TrackCreationInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Doctrine\Model;
use Chill\MainBundle\Entity\User;
diff --git a/src/Bundle/ChillMainBundle/Doctrine/Model/TrackUpdateInterface.php b/src/Bundle/ChillMainBundle/Doctrine/Model/TrackUpdateInterface.php
index e4021de66..d85dc5809 100644
--- a/src/Bundle/ChillMainBundle/Doctrine/Model/TrackUpdateInterface.php
+++ b/src/Bundle/ChillMainBundle/Doctrine/Model/TrackUpdateInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Doctrine\Model;
use Chill\MainBundle\Entity\User;
diff --git a/src/Bundle/ChillMainBundle/Doctrine/Type/NativeDateIntervalType.php b/src/Bundle/ChillMainBundle/Doctrine/Type/NativeDateIntervalType.php
index 1d90fe382..a1ec0c955 100644
--- a/src/Bundle/ChillMainBundle/Doctrine/Type/NativeDateIntervalType.php
+++ b/src/Bundle/ChillMainBundle/Doctrine/Type/NativeDateIntervalType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Doctrine\Type;
use DateInterval;
@@ -14,6 +16,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\DBAL\Types\DateIntervalType;
use Exception;
+use function count;
use function current;
use function preg_match;
use function reset;
@@ -84,7 +87,7 @@ class NativeDateIntervalType extends DateIntervalType
$current = current($strings);
if (is_numeric($current)) {
- $next = \next($strings);
+ $next = next($strings);
switch ($next) {
case 'year':
diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php
index 9fabe8674..dcf0c5a96 100644
--- a/src/Bundle/ChillMainBundle/Entity/Address.php
+++ b/src/Bundle/ChillMainBundle/Entity/Address.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity;
use Chill\MainBundle\Doctrine\Model\Point;
diff --git a/src/Bundle/ChillMainBundle/Entity/AddressReference.php b/src/Bundle/ChillMainBundle/Entity/AddressReference.php
index 02d600272..e793167f6 100644
--- a/src/Bundle/ChillMainBundle/Entity/AddressReference.php
+++ b/src/Bundle/ChillMainBundle/Entity/AddressReference.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity;
use Chill\MainBundle\Doctrine\Model\Point;
diff --git a/src/Bundle/ChillMainBundle/Entity/Center.php b/src/Bundle/ChillMainBundle/Entity/Center.php
index b76f2fed2..10584bea9 100644
--- a/src/Bundle/ChillMainBundle/Entity/Center.php
+++ b/src/Bundle/ChillMainBundle/Entity/Center.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
diff --git a/src/Bundle/ChillMainBundle/Entity/Civility.php b/src/Bundle/ChillMainBundle/Entity/Civility.php
index 2ab66ebb8..4fcad0db8 100644
--- a/src/Bundle/ChillMainBundle/Entity/Civility.php
+++ b/src/Bundle/ChillMainBundle/Entity/Civility.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
diff --git a/src/Bundle/ChillMainBundle/Entity/Country.php b/src/Bundle/ChillMainBundle/Entity/Country.php
index a199c5a7b..1bd009689 100644
--- a/src/Bundle/ChillMainBundle/Entity/Country.php
+++ b/src/Bundle/ChillMainBundle/Entity/Country.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
diff --git a/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php b/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php
index 4a4977632..51b8978a0 100644
--- a/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php
+++ b/src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity\Embeddable;
use DateTime;
diff --git a/src/Bundle/ChillMainBundle/Entity/GroupCenter.php b/src/Bundle/ChillMainBundle/Entity/GroupCenter.php
index dd0f700e9..ccf000b9d 100644
--- a/src/Bundle/ChillMainBundle/Entity/GroupCenter.php
+++ b/src/Bundle/ChillMainBundle/Entity/GroupCenter.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
diff --git a/src/Bundle/ChillMainBundle/Entity/HasCenterInterface.php b/src/Bundle/ChillMainBundle/Entity/HasCenterInterface.php
index a917662ca..5ffe6dc87 100644
--- a/src/Bundle/ChillMainBundle/Entity/HasCenterInterface.php
+++ b/src/Bundle/ChillMainBundle/Entity/HasCenterInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity;
/**
diff --git a/src/Bundle/ChillMainBundle/Entity/HasCentersInterface.php b/src/Bundle/ChillMainBundle/Entity/HasCentersInterface.php
index f3bb80201..ae22cd6c6 100644
--- a/src/Bundle/ChillMainBundle/Entity/HasCentersInterface.php
+++ b/src/Bundle/ChillMainBundle/Entity/HasCentersInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity;
interface HasCentersInterface
diff --git a/src/Bundle/ChillMainBundle/Entity/HasScopeInterface.php b/src/Bundle/ChillMainBundle/Entity/HasScopeInterface.php
index cf93b7326..44d4b4834 100644
--- a/src/Bundle/ChillMainBundle/Entity/HasScopeInterface.php
+++ b/src/Bundle/ChillMainBundle/Entity/HasScopeInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity;
/**
diff --git a/src/Bundle/ChillMainBundle/Entity/HasScopesInterface.php b/src/Bundle/ChillMainBundle/Entity/HasScopesInterface.php
index b88618ee7..1beea38f5 100644
--- a/src/Bundle/ChillMainBundle/Entity/HasScopesInterface.php
+++ b/src/Bundle/ChillMainBundle/Entity/HasScopesInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity;
interface HasScopesInterface
diff --git a/src/Bundle/ChillMainBundle/Entity/Language.php b/src/Bundle/ChillMainBundle/Entity/Language.php
index 0a14a4380..ad47eae1b 100644
--- a/src/Bundle/ChillMainBundle/Entity/Language.php
+++ b/src/Bundle/ChillMainBundle/Entity/Language.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
diff --git a/src/Bundle/ChillMainBundle/Entity/Location.php b/src/Bundle/ChillMainBundle/Entity/Location.php
index 036673ec9..ba1ad8fb0 100644
--- a/src/Bundle/ChillMainBundle/Entity/Location.php
+++ b/src/Bundle/ChillMainBundle/Entity/Location.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
diff --git a/src/Bundle/ChillMainBundle/Entity/LocationType.php b/src/Bundle/ChillMainBundle/Entity/LocationType.php
index 8b171eb0f..cda7e073f 100644
--- a/src/Bundle/ChillMainBundle/Entity/LocationType.php
+++ b/src/Bundle/ChillMainBundle/Entity/LocationType.php
@@ -7,10 +7,13 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity;
use Chill\MainBundle\Repository\LocationTypeRepository;
use Doctrine\ORM\Mapping as ORM;
+use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
@@ -20,9 +23,14 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
* @DiscriminatorMap(typeProperty="type", mapping={
* "location-type": LocationType::class
* })
+ * @UniqueEntity({"defaultFor"})
*/
class LocationType
{
+ public const DEFAULT_FOR_3PARTY = 'thirdparty';
+
+ public const DEFAULT_FOR_PERSON = 'person';
+
public const STATUS_NEVER = 'never';
public const STATUS_OPTIONAL = 'optional';
@@ -53,6 +61,12 @@ class LocationType
*/
private string $contactData = self::STATUS_OPTIONAL;
+ /**
+ * @ORM\Column(type="string", nullable=true, length=32, unique=true)
+ * @Serializer\Groups({"read"})
+ */
+ private ?string $defaultFor = null;
+
/**
* @ORM\Id
* @ORM\GeneratedValue
@@ -87,6 +101,11 @@ class LocationType
return $this->contactData;
}
+ public function getDefaultFor(): ?string
+ {
+ return $this->defaultFor;
+ }
+
public function getId(): ?int
{
return $this->id;
@@ -125,6 +144,13 @@ class LocationType
return $this;
}
+ public function setDefaultFor(?string $defaultFor): self
+ {
+ $this->defaultFor = $defaultFor;
+
+ return $this;
+ }
+
public function setTitle(array $title): self
{
$this->title = $title;
diff --git a/src/Bundle/ChillMainBundle/Entity/Notification.php b/src/Bundle/ChillMainBundle/Entity/Notification.php
index bdf2529ca..cba4f33e5 100644
--- a/src/Bundle/ChillMainBundle/Entity/Notification.php
+++ b/src/Bundle/ChillMainBundle/Entity/Notification.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity;
use DateTimeImmutable;
diff --git a/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php b/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php
index 150312f42..f066178dc 100644
--- a/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php
+++ b/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
@@ -119,7 +121,7 @@ class PermissionsGroup
public function isRoleScopePresentOnce(ExecutionContextInterface $context)
{
$roleScopesId = array_map(
- function (RoleScope $roleScope) {
+ static function (RoleScope $roleScope) {
return $roleScope->getId();
},
$this->getRoleScopes()->toArray()
diff --git a/src/Bundle/ChillMainBundle/Entity/PostalCode.php b/src/Bundle/ChillMainBundle/Entity/PostalCode.php
index 11a5d10c9..866ad04db 100644
--- a/src/Bundle/ChillMainBundle/Entity/PostalCode.php
+++ b/src/Bundle/ChillMainBundle/Entity/PostalCode.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity;
use Chill\MainBundle\Doctrine\Model\Point;
diff --git a/src/Bundle/ChillMainBundle/Entity/Scope.php b/src/Bundle/ChillMainBundle/Entity/Scope.php
index adac7ce40..3a6cbd953 100644
--- a/src/Bundle/ChillMainBundle/Entity/Scope.php
+++ b/src/Bundle/ChillMainBundle/Entity/Scope.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php
index d0ff644c1..73fc45bbe 100644
--- a/src/Bundle/ChillMainBundle/Entity/User.php
+++ b/src/Bundle/ChillMainBundle/Entity/User.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
@@ -16,6 +18,7 @@ use RuntimeException;
use Symfony\Component\Security\Core\User\AdvancedUserInterface;
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
+use function in_array;
/**
* User.
@@ -336,7 +339,7 @@ class User implements AdvancedUserInterface
$groupCentersIds = [];
foreach ($this->getGroupCenters() as $groupCenter) {
- if (in_array($groupCenter->getId(), $groupCentersIds)) {
+ if (in_array($groupCenter->getId(), $groupCentersIds, true)) {
$context->buildViolation('The user has already those permissions')
->addViolation();
} else {
@@ -353,8 +356,8 @@ class User implements AdvancedUserInterface
public function removeGroupCenter(GroupCenter $groupCenter)
{
if ($this->groupCenters->removeElement($groupCenter) === false) {
- throw new RuntimeException(sprintf('The groupCenter could not be removed, '
- . 'it seems not to be associated with the user. Aborting.'));
+ throw new RuntimeException('The groupCenter could not be removed, '
+ . 'it seems not to be associated with the user. Aborting.');
}
}
diff --git a/src/Bundle/ChillMainBundle/Entity/UserJob.php b/src/Bundle/ChillMainBundle/Entity/UserJob.php
index dfc48d16b..bccba10dd 100644
--- a/src/Bundle/ChillMainBundle/Entity/UserJob.php
+++ b/src/Bundle/ChillMainBundle/Entity/UserJob.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
diff --git a/src/Bundle/ChillMainBundle/Export/AggregatorInterface.php b/src/Bundle/ChillMainBundle/Export/AggregatorInterface.php
index 19de762d5..244d3ba14 100644
--- a/src/Bundle/ChillMainBundle/Export/AggregatorInterface.php
+++ b/src/Bundle/ChillMainBundle/Export/AggregatorInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Export;
use Closure;
diff --git a/src/Bundle/ChillMainBundle/Export/DirectExportInterface.php b/src/Bundle/ChillMainBundle/Export/DirectExportInterface.php
index 4a8efc586..734939b7c 100644
--- a/src/Bundle/ChillMainBundle/Export/DirectExportInterface.php
+++ b/src/Bundle/ChillMainBundle/Export/DirectExportInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Export;
use Symfony\Component\Security\Core\Role\Role;
diff --git a/src/Bundle/ChillMainBundle/Export/ExportElementInterface.php b/src/Bundle/ChillMainBundle/Export/ExportElementInterface.php
index b1fad50b4..0e4457764 100644
--- a/src/Bundle/ChillMainBundle/Export/ExportElementInterface.php
+++ b/src/Bundle/ChillMainBundle/Export/ExportElementInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Export;
use Symfony\Component\Form\FormBuilderInterface;
diff --git a/src/Bundle/ChillMainBundle/Export/ExportElementValidatedInterface.php b/src/Bundle/ChillMainBundle/Export/ExportElementValidatedInterface.php
index c888b05c3..c2e13d25e 100644
--- a/src/Bundle/ChillMainBundle/Export/ExportElementValidatedInterface.php
+++ b/src/Bundle/ChillMainBundle/Export/ExportElementValidatedInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Export;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
diff --git a/src/Bundle/ChillMainBundle/Export/ExportElementsProviderInterface.php b/src/Bundle/ChillMainBundle/Export/ExportElementsProviderInterface.php
index b33237a4f..b43d2d267 100644
--- a/src/Bundle/ChillMainBundle/Export/ExportElementsProviderInterface.php
+++ b/src/Bundle/ChillMainBundle/Export/ExportElementsProviderInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Export;
/**
diff --git a/src/Bundle/ChillMainBundle/Export/ExportInterface.php b/src/Bundle/ChillMainBundle/Export/ExportInterface.php
index bfe6ee0bc..419d9b250 100644
--- a/src/Bundle/ChillMainBundle/Export/ExportInterface.php
+++ b/src/Bundle/ChillMainBundle/Export/ExportInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Export;
use Closure;
diff --git a/src/Bundle/ChillMainBundle/Export/ExportManager.php b/src/Bundle/ChillMainBundle/Export/ExportManager.php
index e80dd154c..782a2fdd2 100644
--- a/src/Bundle/ChillMainBundle/Export/ExportManager.php
+++ b/src/Bundle/ChillMainBundle/Export/ExportManager.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Export;
use Chill\MainBundle\Form\Type\Export\ExportType;
@@ -24,6 +26,11 @@ use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use UnexpectedValueException;
+use function array_key_exists;
+use function count;
+use function get_class;
+use function gettype;
+use function in_array;
/**
* Collects all agregators, filters and export from
@@ -115,7 +122,7 @@ class ExportManager
public function &getFiltersApplyingOn(ExportInterface $export, ?array $centers = null)
{
foreach ($this->filters as $alias => $filter) {
- if (in_array($filter->applyOn(), $export->supportsModifiers())
+ if (in_array($filter->applyOn(), $export->supportsModifiers(), true)
&& $this->isGrantedForElement($filter, $export, $centers)) {
yield $alias => $filter;
}
@@ -136,7 +143,7 @@ class ExportManager
}
foreach ($this->aggregators as $alias => $aggregator) {
- if (in_array($aggregator->applyOn(), $export->supportsModifiers())
+ if (in_array($aggregator->applyOn(), $export->supportsModifiers(), true)
&& $this->isGrantedForElement($aggregator, $export, $centers)) {
yield $alias => $aggregator;
}
@@ -192,7 +199,7 @@ class ExportManager
} elseif ($element instanceof FormatterInterface) {
$this->addFormatter($element, $alias);
} else {
- throw new LogicException('This element ' . \get_class($element) . ' '
+ throw new LogicException('This element ' . get_class($element) . ' '
. 'is not an instance of export element');
}
}
@@ -285,7 +292,7 @@ class ExportManager
);
}
- /* @var $formatter FormatterInterface */
+ /** @var FormatterInterface $formatter */
$formatter = $this->getFormatter($this->getFormatterAlias($data));
$filtersData = [];
$aggregatorsData = [];
@@ -345,8 +352,8 @@ class ExportManager
$existingTypes = [];
foreach ($this->exports as $export) {
- if (!in_array($export->getType(), $existingTypes)) {
- array_push($existingTypes, $export->getType());
+ if (!in_array($export->getType(), $existingTypes, true)) {
+ $existingTypes[] = $export->getType();
}
}
@@ -473,7 +480,7 @@ class ExportManager
public function getFormattersByTypes(array $types)
{
foreach ($this->formatters as $alias => $formatter) {
- if (in_array($formatter->getType(), $types)) {
+ if (in_array($formatter->getType(), $types, true)) {
yield $alias => $formatter;
}
}
@@ -520,8 +527,8 @@ class ExportManager
if ($element instanceof ExportInterface || $element instanceof DirectExportInterface) {
$role = $element->requiredRole();
} elseif ($element instanceof ModifierInterface) {
- if (is_null($element->addRole())) {
- if (is_null($export)) {
+ if (null === $element->addRole()) {
+ if (null === $export) {
throw new LogicException('The export should not be null: as the '
. 'ModifierInstance element is not an export, we should '
. 'be aware of the export to determine which role is required');
@@ -674,8 +681,8 @@ class ExportManager
$usedTypes = [];
foreach ($this->retrieveUsedAggregators($data) as $alias => $aggregator) {
- if (!in_array($aggregator->applyOn(), $usedTypes)) {
- array_push($usedTypes, $aggregator->applyOn());
+ if (!in_array($aggregator->applyOn(), $usedTypes, true)) {
+ $usedTypes[] = $aggregator->applyOn();
}
}
@@ -714,11 +721,11 @@ class ExportManager
$usedTypes = [];
foreach ($data as $alias => $filterData) {
- if (true == $filterData['enabled']) {
+ if (true === $filterData['enabled']) {
$filter = $this->getFilter($alias);
- if (!in_array($filter->applyOn(), $usedTypes)) {
- array_push($usedTypes, $filter->applyOn());
+ if (!in_array($filter->applyOn(), $usedTypes, true)) {
+ $usedTypes[] = $filter->applyOn();
}
}
}
diff --git a/src/Bundle/ChillMainBundle/Export/FilterInterface.php b/src/Bundle/ChillMainBundle/Export/FilterInterface.php
index ac7c0c7dc..0b27f1cf1 100644
--- a/src/Bundle/ChillMainBundle/Export/FilterInterface.php
+++ b/src/Bundle/ChillMainBundle/Export/FilterInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Export;
/**
diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php
index c1404d2b8..914fa15c3 100644
--- a/src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php
+++ b/src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php
@@ -20,6 +20,11 @@ use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Contracts\Translation\TranslatorInterface;
+use function array_key_exists;
+use function array_slice;
+use function call_user_func;
+use function count;
+use function is_array;
/**
* Command to get the report with curl:
@@ -163,7 +168,7 @@ class CSVFormatter implements FormatterInterface
// gather data in an array
foreach ($keys as $key) {
- $values = array_map(function ($row) use ($key, $alias) {
+ $values = array_map(static function ($row) use ($key, $alias) {
if (!array_key_exists($key, $row)) {
throw new LogicException("the key '" . $key . "' is declared by "
. "the aggregator with alias '" . $alias . "' but is not "
@@ -190,7 +195,7 @@ class CSVFormatter implements FormatterInterface
$keys = $this->export->getQueryKeys($this->exportData);
foreach ($keys as $key) {
- $values = array_map(function ($row) use ($key, $export) {
+ $values = array_map(static function ($row) use ($key, $export) {
if (!array_key_exists($key, $row)) {
throw new LogicException("the key '" . $key . "' is declared by "
. "the export with title '" . $export->getTitle() . "' but is not "
@@ -216,14 +221,14 @@ class CSVFormatter implements FormatterInterface
$columnKeysNb = count($this->getColumnHeaders());
$resultsKeysNb = count($this->export->getQueryKeys($this->exportData));
$results = $this->getOrderedResults();
- /* @var $columnHeaders string[] the column headers associations */
+ /** @var string[] $columnHeaders the column headers associations */
$columnHeaders = [];
- /* @var $data string[] the data of the csv file */
+ /** @var string[] $data the data of the csv file */
$contentData = [];
$content = [];
// create a file pointer connected to the output stream
- $output = fopen('php://output', 'w');
+ $output = fopen('php://output', 'wb');
//title
fputcsv($output, [$this->translator->trans($this->export->getTitle())]);
@@ -253,7 +258,7 @@ class CSVFormatter implements FormatterInterface
}
// add the column headers
- /* @var $columns string[] the column for this row */
+ /** @var string[] $columns the column for this row */
$columns = array_slice($row, $rowKeysNb, $columnKeysNb);
$columnPosition = $this->findColumnPosition($columnHeaders, $columns);
diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php
index 193cc0feb..94c8c5ee3 100644
--- a/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php
+++ b/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Export\Formatter;
use Chill\MainBundle\Export\ExportManager;
@@ -20,6 +22,7 @@ use Symfony\Component\Translation\TranslatorInterface;
use function array_key_exists;
use function array_keys;
use function array_map;
+use function count;
use function implode;
// command to get the report with curl : curl --user "center a_social:password" "http://localhost:8000/fr/exports/generate/count_person?export[filters][person_gender_filter][enabled]=&export[filters][person_nationality_filter][enabled]=&export[filters][person_nationality_filter][form][nationalities]=&export[aggregators][person_nationality_aggregator][order]=1&export[aggregators][person_nationality_aggregator][form][group_by_level]=country&export[submit]=&export[_token]=RHpjHl389GrK-bd6iY5NsEqrD5UKOTHH40QKE9J1edU" --globoff
@@ -114,7 +117,7 @@ class CSVListFormatter implements FormatterInterface
$this->exportData = $exportData;
$this->formatterData = $formatterData;
- $output = fopen('php://output', 'w');
+ $output = fopen('php://output', 'wb');
$this->prepareHeaders($output);
@@ -195,7 +198,7 @@ class CSVListFormatter implements FormatterInterface
foreach ($keys as $key) {
// get an array with all values for this key if possible
- $values = array_map(function ($v) use ($key) { return $v[$key]; }, $this->result);
+ $values = array_map(static function ($v) use ($key) { return $v[$key]; }, $this->result);
// store the label in the labelsCache property
$this->labelsCache[$key] = $export->getLabels($key, $values, $this->exportData);
}
diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php
index ccdfcb97a..7e3334340 100644
--- a/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php
+++ b/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Export\Formatter;
use Chill\MainBundle\Export\ExportManager;
@@ -17,6 +19,7 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Translation\TranslatorInterface;
use function array_map;
+use function count;
/**
* Create a CSV List for the export where the header are printed on the
@@ -109,7 +112,7 @@ class CSVPivotedListFormatter implements FormatterInterface
$this->exportData = $exportData;
$this->formatterData = $formatterData;
- $output = fopen('php://output', 'w');
+ $output = fopen('php://output', 'wb');
$i = 1;
$lines = [];
@@ -183,7 +186,7 @@ class CSVPivotedListFormatter implements FormatterInterface
foreach ($keys as $key) {
// get an array with all values for this key if possible
- $values = array_map(function ($v) use ($key) { return $v[$key]; }, $this->result);
+ $values = array_map(static function ($v) use ($key) { return $v[$key]; }, $this->result);
// store the label in the labelsCache property
$this->labelsCache[$key] = $export->getLabels($key, $values, $this->exportData);
}
diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php
index 71119205e..590e79a41 100644
--- a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php
+++ b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Export\Formatter;
use Chill\MainBundle\Export\ExportManager;
@@ -22,7 +24,10 @@ use function array_map;
use function array_merge;
use function array_multisort;
use function array_unique;
+use function call_user_func;
+use function count;
use function fopen;
+use function is_array;
use function stream_get_contents;
use function sys_get_temp_dir;
use function tempnam;
@@ -201,7 +206,7 @@ class SpreadSheetFormatter implements FormatterInterface
$this->tempfile = tempnam(sys_get_temp_dir(), '');
$this->generateContent();
- $f = fopen($this->tempfile, 'r');
+ $f = fopen($this->tempfile, 'rb');
$response->setContent(stream_get_contents($f));
fclose($f);
@@ -342,20 +347,17 @@ class SpreadSheetFormatter implements FormatterInterface
switch ($this->formatterData['format']) {
case 'ods':
- $writer = \PhpOffice\PhpSpreadsheet\IOFactory
- ::createWriter($spreadsheet, 'Ods');
+ $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Ods');
break;
case 'xlsx':
- $writer = \PhpOffice\PhpSpreadsheet\IOFactory
- ::createWriter($spreadsheet, 'Xlsx');
+ $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
break;
case 'csv':
- $writer = \PhpOffice\PhpSpreadsheet\IOFactory
- ::createWriter($spreadsheet, 'Csv');
+ $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Csv');
break;
diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php
index e4fb8cf19..e31535602 100644
--- a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php
+++ b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Export\Formatter;
use Chill\MainBundle\Export\ExportManager;
@@ -25,6 +27,7 @@ use Symfony\Component\Translation\TranslatorInterface;
use function array_key_exists;
use function array_keys;
use function array_map;
+use function count;
use function fopen;
use function implode;
use function stream_get_contents;
@@ -167,23 +170,20 @@ class SpreadsheetListFormatter implements FormatterInterface
switch ($this->formatterData['format']) {
case 'ods':
- $writer = \PhpOffice\PhpSpreadsheet\IOFactory
- ::createWriter($spreadsheet, 'Ods');
+ $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Ods');
$contentType = 'application/vnd.oasis.opendocument.spreadsheet';
break;
case 'xlsx':
- $writer = \PhpOffice\PhpSpreadsheet\IOFactory
- ::createWriter($spreadsheet, 'Xlsx');
+ $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
$contentType = 'application/vnd.openxmlformats-officedocument.'
. 'spreadsheetml.sheet';
break;
case 'csv':
- $writer = \PhpOffice\PhpSpreadsheet\IOFactory
- ::createWriter($spreadsheet, 'Csv');
+ $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Csv');
$contentType = 'text/csv';
break;
@@ -201,7 +201,7 @@ class SpreadsheetListFormatter implements FormatterInterface
$tempfile = tempnam(sys_get_temp_dir(), '');
$writer->save($tempfile);
- $f = fopen($tempfile, 'r');
+ $f = fopen($tempfile, 'rb');
$response->setContent(stream_get_contents($f));
fclose($f);
@@ -257,7 +257,7 @@ class SpreadsheetListFormatter implements FormatterInterface
foreach ($keys as $key) {
// get an array with all values for this key if possible
- $values = array_map(function ($v) use ($key) { return $v[$key]; }, $this->result);
+ $values = array_map(static function ($v) use ($key) { return $v[$key]; }, $this->result);
// store the label in the labelsCache property
$this->labelsCache[$key] = $export->getLabels($key, $values, $this->exportData);
}
diff --git a/src/Bundle/ChillMainBundle/Export/FormatterInterface.php b/src/Bundle/ChillMainBundle/Export/FormatterInterface.php
index f18822008..2e4e569fc 100644
--- a/src/Bundle/ChillMainBundle/Export/FormatterInterface.php
+++ b/src/Bundle/ChillMainBundle/Export/FormatterInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Export;
use Symfony\Component\Form\FormBuilderInterface;
diff --git a/src/Bundle/ChillMainBundle/Export/GroupedExportInterface.php b/src/Bundle/ChillMainBundle/Export/GroupedExportInterface.php
index f0ee4ea62..6a0e7722a 100644
--- a/src/Bundle/ChillMainBundle/Export/GroupedExportInterface.php
+++ b/src/Bundle/ChillMainBundle/Export/GroupedExportInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Export;
/**
diff --git a/src/Bundle/ChillMainBundle/Export/ListInterface.php b/src/Bundle/ChillMainBundle/Export/ListInterface.php
index 197cdf25e..496415e3b 100644
--- a/src/Bundle/ChillMainBundle/Export/ListInterface.php
+++ b/src/Bundle/ChillMainBundle/Export/ListInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Export;
/**
diff --git a/src/Bundle/ChillMainBundle/Export/ModifierInterface.php b/src/Bundle/ChillMainBundle/Export/ModifierInterface.php
index ce5161556..1265f52c4 100644
--- a/src/Bundle/ChillMainBundle/Export/ModifierInterface.php
+++ b/src/Bundle/ChillMainBundle/Export/ModifierInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Export;
use Doctrine\ORM\QueryBuilder;
diff --git a/src/Bundle/ChillMainBundle/Form/AdvancedSearchType.php b/src/Bundle/ChillMainBundle/Form/AdvancedSearchType.php
index 17b033ec1..e1d94728e 100644
--- a/src/Bundle/ChillMainBundle/Form/AdvancedSearchType.php
+++ b/src/Bundle/ChillMainBundle/Form/AdvancedSearchType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form;
use Chill\MainBundle\Search\SearchProvider;
diff --git a/src/Bundle/ChillMainBundle/Form/CenterType.php b/src/Bundle/ChillMainBundle/Form/CenterType.php
index 2f493078f..494df50e9 100644
--- a/src/Bundle/ChillMainBundle/Form/CenterType.php
+++ b/src/Bundle/ChillMainBundle/Form/CenterType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form;
use Symfony\Component\Form\AbstractType;
diff --git a/src/Bundle/ChillMainBundle/Form/ChoiceLoader/PostalCodeChoiceLoader.php b/src/Bundle/ChillMainBundle/Form/ChoiceLoader/PostalCodeChoiceLoader.php
index 9c7b7d414..7e0702de1 100644
--- a/src/Bundle/ChillMainBundle/Form/ChoiceLoader/PostalCodeChoiceLoader.php
+++ b/src/Bundle/ChillMainBundle/Form/ChoiceLoader/PostalCodeChoiceLoader.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\ChoiceLoader;
use Chill\MainBundle\Entity\PostalCode;
@@ -45,7 +47,7 @@ class PostalCodeChoiceLoader implements ChoiceLoaderInterface
{
return new \Symfony\Component\Form\ChoiceList\ArrayChoiceList(
$this->lazyLoadedPostalCodes,
- function (?PostalCode $pc = null) use ($value) {
+ static function (?PostalCode $pc = null) use ($value) {
return call_user_func($value, $pc);
}
);
diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php
index 252d7d43f..73a61c998 100644
--- a/src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php
+++ b/src/Bundle/ChillMainBundle/Form/DataMapper/AddressDataMapper.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\DataMapper;
use Chill\MainBundle\Entity\Address;
diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php
index 7039fe9a6..7284b9b3a 100644
--- a/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php
+++ b/src/Bundle/ChillMainBundle/Form/DataMapper/ScopePickerDataMapper.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\DataMapper;
use Chill\MainBundle\Entity\Scope;
diff --git a/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php b/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php
index 2c8c5d348..776a8d80c 100644
--- a/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php
+++ b/src/Bundle/ChillMainBundle/Form/Event/CustomizeFormEvent.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Event;
use Symfony\Component\Form\FormBuilderInterface;
diff --git a/src/Bundle/ChillMainBundle/Form/LocationFormType.php b/src/Bundle/ChillMainBundle/Form/LocationFormType.php
index 22d3d1702..ecb4a76ea 100644
--- a/src/Bundle/ChillMainBundle/Form/LocationFormType.php
+++ b/src/Bundle/ChillMainBundle/Form/LocationFormType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form;
use Chill\MainBundle\Entity\LocationType as EntityLocationType;
@@ -33,7 +35,7 @@ final class LocationFormType extends AbstractType
$builder
->add('locationType', EntityType::class, [
'class' => EntityLocationType::class,
- 'choice_attr' => function (EntityLocationType $entity) {
+ 'choice_attr' => static function (EntityLocationType $entity) {
return [
'data-address' => $entity->getAddressRequired(),
'data-contact' => $entity->getContactData(),
diff --git a/src/Bundle/ChillMainBundle/Form/LocationTypeType.php b/src/Bundle/ChillMainBundle/Form/LocationTypeType.php
index 1e4776f8f..aa096b3e6 100644
--- a/src/Bundle/ChillMainBundle/Form/LocationTypeType.php
+++ b/src/Bundle/ChillMainBundle/Form/LocationTypeType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form;
use Chill\MainBundle\Entity\LocationType;
@@ -71,6 +73,18 @@ final class LocationTypeType extends AbstractType
],
'expanded' => true,
]
+ )
+ ->add(
+ 'defaultFor',
+ ChoiceType::class,
+ [
+ 'choices' => [
+ 'none' => null,
+ 'person' => LocationType::DEFAULT_FOR_PERSON,
+ 'thirdparty' => LocationType::DEFAULT_FOR_3PARTY,
+ ],
+ 'expanded' => true,
+ ]
);
}
}
diff --git a/src/Bundle/ChillMainBundle/Form/PermissionsGroupType.php b/src/Bundle/ChillMainBundle/Form/PermissionsGroupType.php
index 1fb0426b4..e798a262e 100644
--- a/src/Bundle/ChillMainBundle/Form/PermissionsGroupType.php
+++ b/src/Bundle/ChillMainBundle/Form/PermissionsGroupType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form;
use Chill\MainBundle\Form\Utils\PermissionsGroupFlagProvider;
@@ -17,6 +19,7 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use function array_combine;
use function array_merge;
+use function count;
class PermissionsGroupType extends AbstractType
{
diff --git a/src/Bundle/ChillMainBundle/Form/ScopeType.php b/src/Bundle/ChillMainBundle/Form/ScopeType.php
index 9733f918f..c0c08ffbf 100644
--- a/src/Bundle/ChillMainBundle/Form/ScopeType.php
+++ b/src/Bundle/ChillMainBundle/Form/ScopeType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
diff --git a/src/Bundle/ChillMainBundle/Form/Type/AddressType.php b/src/Bundle/ChillMainBundle/Form/Type/AddressType.php
index 80bde17fd..24872650f 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/AddressType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/AddressType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Chill\MainBundle\Entity\Address;
diff --git a/src/Bundle/ChillMainBundle/Form/Type/AppendScopeChoiceTypeTrait.php b/src/Bundle/ChillMainBundle/Form/Type/AppendScopeChoiceTypeTrait.php
index 86ffb8e26..3391fc845 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/AppendScopeChoiceTypeTrait.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/AppendScopeChoiceTypeTrait.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Chill\MainBundle\Entity\Center;
@@ -117,7 +119,7 @@ trait AppendScopeChoiceTypeTrait
$builder->addEventListener(
FormEvents::PRE_SET_DATA,
- function (FormEvent $event) use ($choices, $name, $dataTransformer, $builder) {
+ static function (FormEvent $event) use ($choices, $name, $dataTransformer, $builder) {
$form = $event->getForm();
$form->add(
$builder
diff --git a/src/Bundle/ChillMainBundle/Form/Type/ChillCollectionType.php b/src/Bundle/ChillMainBundle/Form/Type/ChillCollectionType.php
index a50a66340..88d5d3ce0 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/ChillCollectionType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/ChillCollectionType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
diff --git a/src/Bundle/ChillMainBundle/Form/Type/ChillDateTimeType.php b/src/Bundle/ChillMainBundle/Form/Type/ChillDateTimeType.php
index d1699b9d3..f0d9d5eae 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/ChillDateTimeType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/ChillDateTimeType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
diff --git a/src/Bundle/ChillMainBundle/Form/Type/ChillDateType.php b/src/Bundle/ChillMainBundle/Form/Type/ChillDateType.php
index 7679b5f72..1b7f51115 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/ChillDateType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/ChillDateType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
diff --git a/src/Bundle/ChillMainBundle/Form/Type/ChillTextareaType.php b/src/Bundle/ChillMainBundle/Form/Type/ChillTextareaType.php
index 9cca05aa5..18bfd885b 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/ChillTextareaType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/ChillTextareaType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
diff --git a/src/Bundle/ChillMainBundle/Form/Type/CommentType.php b/src/Bundle/ChillMainBundle/Form/Type/CommentType.php
index e05b6bc96..3adca5eca 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/CommentType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/CommentType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
diff --git a/src/Bundle/ChillMainBundle/Form/Type/ComposedGroupCenterType.php b/src/Bundle/ChillMainBundle/Form/Type/ComposedGroupCenterType.php
index f7b19f453..1398a8ce2 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/ComposedGroupCenterType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/ComposedGroupCenterType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Chill\MainBundle\Entity\Center;
@@ -23,12 +25,12 @@ class ComposedGroupCenterType extends AbstractType
{
$builder->add('permissionsgroup', EntityType::class, [
'class' => 'Chill\MainBundle\Entity\PermissionsGroup',
- 'choice_label' => function (PermissionsGroup $group) {
+ 'choice_label' => static function (PermissionsGroup $group) {
return $group->getName();
},
])->add('center', EntityType::class, [
'class' => 'Chill\MainBundle\Entity\Center',
- 'choice_label' => function (Center $center) {
+ 'choice_label' => static function (Center $center) {
return $center->getName();
},
]);
diff --git a/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php b/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php
index bafdf627e..bf5e2d4f8 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Chill\MainBundle\Entity\Scope;
@@ -18,6 +20,7 @@ use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
+use function in_array;
/**
* Form to Edit/create a role scope. If the role scope does not
@@ -72,8 +75,8 @@ class ComposedRoleScopeType extends AbstractType
->add('role', ChoiceType::class, [
'choices' => array_combine(array_values($values), array_keys($values)),
'placeholder' => 'Choose amongst roles',
- 'choice_attr' => function ($role) use ($rolesWithoutScopes) {
- if (in_array($role, $rolesWithoutScopes)) {
+ 'choice_attr' => static function ($role) use ($rolesWithoutScopes) {
+ if (in_array($role, $rolesWithoutScopes, true)) {
return ['data-has-scope' => '0'];
}
@@ -85,7 +88,7 @@ class ComposedRoleScopeType extends AbstractType
])
->add('scope', EntityType::class, [
'class' => 'ChillMainBundle:Scope',
- 'choice_label' => function (Scope $scope) use ($translatableStringHelper) {
+ 'choice_label' => static function (Scope $scope) use ($translatableStringHelper) {
return $translatableStringHelper->localize($scope->getName());
},
'required' => false,
diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php
index 32b4890a1..76f217df6 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/AddressToIdDataTransformer.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type\DataTransformer;
use Chill\MainBundle\Repository\AddressRepository;
diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php
index a7deab29c..a0f609d46 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type\DataTransformer;
use Chill\MainBundle\Entity\Center;
@@ -16,6 +18,7 @@ use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Traversable;
+use function count;
class CenterTransformer implements DataTransformerInterface
{
diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php
index ca5bfafef..48ef5cdf0 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type\DataTransformer;
use Doctrine\Common\Collections\ArrayCollection;
diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php
index 844754a98..145ab0441 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type\DataTransformer;
use Doctrine\ORM\EntityManagerInterface;
diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php
index 32957afc4..5f6c3ed65 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ScopeTransformer.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type\DataTransformer;
use Chill\MainBundle\Entity\Scope;
@@ -25,7 +27,7 @@ class ScopeTransformer implements DataTransformerInterface
public function reverseTransform($id)
{
- if (null == $id) {
+ if (null === $id) {
return null;
}
diff --git a/src/Bundle/ChillMainBundle/Form/Type/DateIntervalType.php b/src/Bundle/ChillMainBundle/Form/Type/DateIntervalType.php
index 442d82608..66ae4d846 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/DateIntervalType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/DateIntervalType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Chill\MainBundle\Form\Type\DataTransformer\DateIntervalTransformer;
@@ -19,7 +21,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\GreaterThan;
use function array_diff;
use function array_values;
+use function count;
use function implode;
+use function is_array;
/**
* Show a dateInterval type.
@@ -80,14 +84,14 @@ class DateIntervalType extends AbstractType
'Months' => 'M',
'Years' => 'Y',
])
- ->setAllowedValues('unit_choices', function ($values) {
+ ->setAllowedValues('unit_choices', static function ($values) {
if (false === is_array($values)) {
throw new InvalidOptionsException('The value `unit_choice` should be an array');
}
$diff = array_diff(array_values($values), ['D', 'W', 'M', 'Y']);
- if (count($diff) == 0) {
+ if (count($diff) === 0) {
return true;
}
diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/AggregatorType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/AggregatorType.php
index b0ff4d51c..9a5d97083 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/Export/AggregatorType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/Export/AggregatorType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type\Export;
use Symfony\Component\Form\AbstractType;
diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php
index b84e85892..4b0c0694b 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/Export/ExportType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type\Export;
use Chill\MainBundle\Export\ExportManager;
diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php
index 1dbfccf59..8612dd690 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type\Export;
use Symfony\Component\Form\AbstractType;
diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/FormatterType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/FormatterType.php
index 9c0a91fec..c7c87e949 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/Export/FormatterType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/Export/FormatterType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type\Export;
use Chill\MainBundle\Export\ExportManager;
diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php
index 3bedc9a3d..daf33eb57 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type\Export;
use Chill\MainBundle\Center\GroupingCenterInterface;
@@ -25,6 +27,7 @@ use function array_intersect;
use function array_key_exists;
use function array_merge;
use function array_unique;
+use function count;
use function in_array;
/**
@@ -79,10 +82,10 @@ class PickCenterType extends AbstractType
$builder->add(self::CENTERS_IDENTIFIERS, EntityType::class, [
'class' => 'ChillMainBundle:Center',
- 'query_builder' => function (EntityRepository $er) use ($centers) {
+ 'query_builder' => static function (EntityRepository $er) use ($centers) {
$qb = $er->createQueryBuilder('c');
$ids = array_map(
- function (Center $el) { return $el->getId(); },
+ static function (Center $el) { return $el->getId(); },
$centers
);
@@ -90,7 +93,7 @@ class PickCenterType extends AbstractType
},
'multiple' => true,
'expanded' => true,
- 'choice_label' => function (Center $c) { return $c->getName(); },
+ 'choice_label' => static function (Center $c) { return $c->getName(); },
'data' => count($this->groupingCenters) > 0 ? null : $centers,
]);
@@ -135,7 +138,7 @@ class PickCenterType extends AbstractType
foreach ($gc->getGroups() as $group) {
foreach ($gc->getCentersForGroup($group) as $center) {
- if (in_array($center, $reachablesCenters)) {
+ if (in_array($center, $reachablesCenters, true)) {
$result[$group] = $group;
}
}
diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/PickFormatterType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/PickFormatterType.php
index 9f6374109..2b1c8e093 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/Export/PickFormatterType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/Export/PickFormatterType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type\Export;
use Chill\MainBundle\Export\ExportManager;
diff --git a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php
index ff8820f4d..488246a50 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type\Listing;
use Chill\MainBundle\Templating\Listing\FilterOrderHelper;
@@ -19,6 +21,7 @@ use Symfony\Component\Form\FormView;
use Symfony\Component\HttpFoundation\RequestStack;
use function array_combine;
use function array_map;
+use function count;
final class FilterOrderType extends \Symfony\Component\Form\AbstractType
{
@@ -45,7 +48,7 @@ final class FilterOrderType extends \Symfony\Component\Form\AbstractType
foreach ($helper->getCheckboxes() as $name => $c) {
$choices = array_combine(
- array_map(function ($c, $t) {
+ array_map(static function ($c, $t) {
if (null !== $t) {
return $t;
}
diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php b/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php
index 686fc83da..647c45553 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/PickAddressType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Chill\MainBundle\Entity\Address;
diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php b/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php
index 9a5be7bc6..5ccf217a0 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/PickCenterType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Chill\MainBundle\Entity\Center;
@@ -25,6 +27,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Security;
use function array_merge;
use function array_values;
+use function count;
/**
* Pick a center.
@@ -79,14 +82,14 @@ class PickCenterType extends AbstractType
$builder
->addModelTransformer(new CallbackTransformer(
- function ($data) {
+ static function ($data) {
if (null === $data) {
return ['center' => null];
}
return ['center' => $data];
},
- function ($data) {
+ static function ($data) {
return $data['center'];
}
));
diff --git a/src/Bundle/ChillMainBundle/Form/Type/PostalCodeType.php b/src/Bundle/ChillMainBundle/Form/Type/PostalCodeType.php
index 0e80345af..debd56ad4 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/PostalCodeType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/PostalCodeType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Chill\MainBundle\Entity\PostalCode;
@@ -75,7 +77,7 @@ class PostalCodeType extends AbstractType
$helper = $this->translatableStringHelper;
$resolver
->setDefault('class', PostalCode::class)
- ->setDefault('choice_label', function (PostalCode $code) use ($helper) {
+ ->setDefault('choice_label', static function (PostalCode $code) use ($helper) {
return $code->getCode() . ' ' . $code->getName() . ' [' .
$helper->localize($code->getCountry()->getName()) . ']';
})
diff --git a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php
index 95c262575..0b3642f7d 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Chill\MainBundle\Entity\Center;
@@ -28,6 +30,7 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Security\Core\Security;
use function array_map;
+use function count;
/**
* Allow to pick amongst available scope for the current
@@ -140,7 +143,7 @@ class ScopePickerType extends AbstractType
->join('pg.groupCenters', 'gc')
// add center constraint
->where($qb->expr()->in('IDENTITY(gc.center)', ':centers'))
- ->setParameter('centers', array_map(fn (Center $c) => $c->getId(), $centers))
+ ->setParameter('centers', array_map(static fn (Center $c) => $c->getId(), $centers))
// role constraints
->andWhere($qb->expr()->in('rs.role', ':roles'))
->setParameter('roles', $roles)
diff --git a/src/Bundle/ChillMainBundle/Form/Type/Select2ChoiceType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2ChoiceType.php
index bd02fbd3f..ae5ab075e 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/Select2ChoiceType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/Select2ChoiceType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
diff --git a/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php
index e0fa0374c..bed90ad18 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Chill\MainBundle\Form\Type\DataTransformer\ObjectToIdTransformer;
@@ -17,6 +19,8 @@ use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\OptionsResolver\OptionsResolver;
+use const SORT_FLAG_CASE;
+use const SORT_STRING;
/**
* Extends choice to allow adding select2 library on widget.
@@ -62,7 +66,7 @@ class Select2CountryType extends AbstractType
foreach ($preferredCountries as $pc) {
foreach ($countries as $c) {
- if ($c->getCountryCode() == $pc) {
+ if ($c->getCountryCode() === $pc) {
$preferredChoices[$c->getId()] = $this->translatableStringHelper->localize($c->getName());
}
}
diff --git a/src/Bundle/ChillMainBundle/Form/Type/Select2EntityType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2EntityType.php
index 9392b2a8c..b4db6393e 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/Select2EntityType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/Select2EntityType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
diff --git a/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php
index a74454172..9fad2bdb3 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Chill\MainBundle\Form\Type\DataTransformer\MultipleObjectsToIdTransformer;
@@ -17,6 +19,8 @@ use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\OptionsResolver\OptionsResolver;
+use const SORT_FLAG_CASE;
+use const SORT_STRING;
/**
* Extends choice to allow adding select2 library on widget for languages (multiple).
diff --git a/src/Bundle/ChillMainBundle/Form/Type/TranslatableStringFormType.php b/src/Bundle/ChillMainBundle/Form/Type/TranslatableStringFormType.php
index 3a5f8c8fb..3f44a4e97 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/TranslatableStringFormType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/TranslatableStringFormType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
/*
@@ -17,6 +19,7 @@ use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Translation\Translator;
+use function in_array;
class TranslatableStringFormType extends AbstractType
{
@@ -38,7 +41,8 @@ class TranslatableStringFormType extends AbstractType
TextType::class,
['required' => (in_array(
$lang,
- $this->frameworkTranslatorFallback
+ $this->frameworkTranslatorFallback,
+ true
))]
);
}
diff --git a/src/Bundle/ChillMainBundle/Form/Type/UserPickerType.php b/src/Bundle/ChillMainBundle/Form/Type/UserPickerType.php
index 57106da07..9c8829dd9 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/UserPickerType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/UserPickerType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Chill\MainBundle\Entity\Scope;
@@ -72,7 +74,7 @@ class UserPickerType extends AbstractType
->setAllowedTypes('having_permissions_group_flag', ['string', 'null'])
->setDefault('class', User::class)
->setDefault('placeholder', 'Choose an user')
- ->setDefault('choice_label', function (User $u) {
+ ->setDefault('choice_label', static function (User $u) {
return $u->getUsername();
})
->setDefault('scope', null)
diff --git a/src/Bundle/ChillMainBundle/Form/UserCurrentLocationType.php b/src/Bundle/ChillMainBundle/Form/UserCurrentLocationType.php
index a6bc6ef8a..4bdf61604 100644
--- a/src/Bundle/ChillMainBundle/Form/UserCurrentLocationType.php
+++ b/src/Bundle/ChillMainBundle/Form/UserCurrentLocationType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form;
use Chill\MainBundle\Entity\Location;
diff --git a/src/Bundle/ChillMainBundle/Form/UserJobType.php b/src/Bundle/ChillMainBundle/Form/UserJobType.php
index 3938ef731..74d69bd07 100644
--- a/src/Bundle/ChillMainBundle/Form/UserJobType.php
+++ b/src/Bundle/ChillMainBundle/Form/UserJobType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
diff --git a/src/Bundle/ChillMainBundle/Form/UserPasswordType.php b/src/Bundle/ChillMainBundle/Form/UserPasswordType.php
index 3a88d5d6b..d2e60c1ef 100644
--- a/src/Bundle/ChillMainBundle/Form/UserPasswordType.php
+++ b/src/Bundle/ChillMainBundle/Form/UserPasswordType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form;
use Psr\Log\LoggerInterface;
diff --git a/src/Bundle/ChillMainBundle/Form/UserType.php b/src/Bundle/ChillMainBundle/Form/UserType.php
index cf062f1ab..58f053ac1 100644
--- a/src/Bundle/ChillMainBundle/Form/UserType.php
+++ b/src/Bundle/ChillMainBundle/Form/UserType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form;
use Chill\MainBundle\Entity\Center;
@@ -49,7 +51,7 @@ class UserType extends AbstractType
'required' => false,
'placeholder' => 'Choose a main center',
'class' => Center::class,
- 'query_builder' => function (EntityRepository $er) {
+ 'query_builder' => static function (EntityRepository $er) {
$qb = $er->createQueryBuilder('c');
$qb->addOrderBy('c.name');
diff --git a/src/Bundle/ChillMainBundle/Form/Utils/PermissionsGroupFlagProvider.php b/src/Bundle/ChillMainBundle/Form/Utils/PermissionsGroupFlagProvider.php
index 0f7bb23b9..f4a91f100 100644
--- a/src/Bundle/ChillMainBundle/Form/Utils/PermissionsGroupFlagProvider.php
+++ b/src/Bundle/ChillMainBundle/Form/Utils/PermissionsGroupFlagProvider.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Utils;
interface PermissionsGroupFlagProvider
diff --git a/src/Bundle/ChillMainBundle/Notification/Mailer.php b/src/Bundle/ChillMainBundle/Notification/Mailer.php
index 82f5ce19d..84382b4fb 100644
--- a/src/Bundle/ChillMainBundle/Notification/Mailer.php
+++ b/src/Bundle/ChillMainBundle/Notification/Mailer.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Notification;
use Chill\MainBundle\Entity\User;
diff --git a/src/Bundle/ChillMainBundle/Notification/NotificationRenderer.php b/src/Bundle/ChillMainBundle/Notification/NotificationRenderer.php
index 1a8c68ca2..048dfc02f 100644
--- a/src/Bundle/ChillMainBundle/Notification/NotificationRenderer.php
+++ b/src/Bundle/ChillMainBundle/Notification/NotificationRenderer.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Notification;
use Chill\ActivityBundle\Notification\ActivityNotificationRenderer;
diff --git a/src/Bundle/ChillMainBundle/Pagination/ChillItemsPerPageTwig.php b/src/Bundle/ChillMainBundle/Pagination/ChillItemsPerPageTwig.php
index b94a75645..3a236f5c1 100644
--- a/src/Bundle/ChillMainBundle/Pagination/ChillItemsPerPageTwig.php
+++ b/src/Bundle/ChillMainBundle/Pagination/ChillItemsPerPageTwig.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Pagination;
use Twig\Environment;
diff --git a/src/Bundle/ChillMainBundle/Pagination/ChillPaginationTwig.php b/src/Bundle/ChillMainBundle/Pagination/ChillPaginationTwig.php
index 6ea40fc67..ed540b0c2 100644
--- a/src/Bundle/ChillMainBundle/Pagination/ChillPaginationTwig.php
+++ b/src/Bundle/ChillMainBundle/Pagination/ChillPaginationTwig.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Pagination;
use Twig\Environment;
diff --git a/src/Bundle/ChillMainBundle/Pagination/Page.php b/src/Bundle/ChillMainBundle/Pagination/Page.php
index 5bac58327..c93af4508 100644
--- a/src/Bundle/ChillMainBundle/Pagination/Page.php
+++ b/src/Bundle/ChillMainBundle/Pagination/Page.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Pagination;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
diff --git a/src/Bundle/ChillMainBundle/Pagination/PageInterface.php b/src/Bundle/ChillMainBundle/Pagination/PageInterface.php
index ea6b841a7..acca7301c 100644
--- a/src/Bundle/ChillMainBundle/Pagination/PageInterface.php
+++ b/src/Bundle/ChillMainBundle/Pagination/PageInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Pagination;
/**
diff --git a/src/Bundle/ChillMainBundle/Pagination/Paginator.php b/src/Bundle/ChillMainBundle/Pagination/Paginator.php
index 3599a9257..d6da55618 100644
--- a/src/Bundle/ChillMainBundle/Pagination/Paginator.php
+++ b/src/Bundle/ChillMainBundle/Pagination/Paginator.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Pagination;
use RuntimeException;
@@ -103,13 +105,17 @@ class Paginator implements PaginatorInterface
public function countPages()
{
+ if (0 === $this->itemPerPage) {
+ return 1;
+ }
+
$nb = floor($this->totalItems / $this->itemPerPage);
if ($this->totalItems % $this->itemPerPage > 0) {
++$nb;
}
- return 0 == $nb ? 1 : (int) $nb;
+ return 0 === $nb ? 1 : (int) $nb;
}
/**
@@ -206,7 +212,7 @@ class Paginator implements PaginatorInterface
public function hasPage($number)
{
return 0 < $number
- and $this->countPages() >= $number;
+ && $this->countPages() >= $number;
}
/**
diff --git a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php
index f453ba7e8..e02729287 100644
--- a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php
+++ b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Pagination;
use Symfony\Component\HttpFoundation\RequestStack;
diff --git a/src/Bundle/ChillMainBundle/Pagination/PaginatorInterface.php b/src/Bundle/ChillMainBundle/Pagination/PaginatorInterface.php
index 010831a62..bf7130516 100644
--- a/src/Bundle/ChillMainBundle/Pagination/PaginatorInterface.php
+++ b/src/Bundle/ChillMainBundle/Pagination/PaginatorInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Pagination;
use Countable;
diff --git a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php
index f6c62dff1..e807efebe 100644
--- a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php
+++ b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Phonenumber;
use GuzzleHttp\Client;
@@ -19,6 +21,7 @@ use function array_key_exists;
use function in_array;
use function json_decode;
use function preg_replace;
+use function strlen;
/**
* Helper to some task linked to phonenumber.
@@ -107,7 +110,7 @@ class PhonenumberHelper
return false;
}
- return in_array($validation, ['landline', 'voip', 'mobile']);
+ return in_array($validation, ['landline', 'voip', 'mobile'], true);
}
/**
@@ -128,7 +131,7 @@ class PhonenumberHelper
return true;
}
- return in_array($validation, ['landline', 'voip']);
+ return in_array($validation, ['landline', 'voip'], true);
}
/**
diff --git a/src/Bundle/ChillMainBundle/Phonenumber/Templating.php b/src/Bundle/ChillMainBundle/Phonenumber/Templating.php
index b21ca50db..414732263 100644
--- a/src/Bundle/ChillMainBundle/Phonenumber/Templating.php
+++ b/src/Bundle/ChillMainBundle/Phonenumber/Templating.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Phonenumber;
use Twig\Extension\AbstractExtension;
diff --git a/src/Bundle/ChillMainBundle/Redis/ChillRedis.php b/src/Bundle/ChillMainBundle/Redis/ChillRedis.php
index ce8a829ad..2ae13b2ac 100644
--- a/src/Bundle/ChillMainBundle/Redis/ChillRedis.php
+++ b/src/Bundle/ChillMainBundle/Redis/ChillRedis.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Redis;
use Redis;
diff --git a/src/Bundle/ChillMainBundle/Redis/RedisConnectionFactory.php b/src/Bundle/ChillMainBundle/Redis/RedisConnectionFactory.php
index 7ed0bece5..6d61c408c 100644
--- a/src/Bundle/ChillMainBundle/Redis/RedisConnectionFactory.php
+++ b/src/Bundle/ChillMainBundle/Redis/RedisConnectionFactory.php
@@ -7,42 +7,40 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Redis;
use RuntimeException;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
-class RedisConnectionFactory implements EventSubscriberInterface
+final class RedisConnectionFactory implements EventSubscriberInterface
{
- protected $host;
+ private string $host;
- protected $port;
+ private int $port;
- /**
- * @var Redis
- */
- protected $redis;
+ private ChillRedis $redis;
- protected $timeout;
+ private int $timeout;
public function __construct($parameters)
{
$this->host = $parameters['host'];
- $this->port = $parameters['port'];
- $this->timeout = $parameters['timeout'];
+ $this->port = (int) $parameters['port'];
+ $this->timeout = (int) $parameters['timeout'];
+ $this->redis = new ChillRedis();
}
public function create()
{
- $redis = $this->redis = new ChillRedis();
-
- $result = $redis->connect($this->host, $this->port, $this->timeout);
+ $result = $this->redis->connect($this->host, $this->port, $this->timeout);
if (false === $result) {
throw new RuntimeException('Could not connect to redis instance');
}
- return $redis;
+ return $this->redis;
}
public static function getSubscribedEvents(): array
@@ -56,8 +54,6 @@ class RedisConnectionFactory implements EventSubscriberInterface
public function onKernelFinishRequest()
{
- if (null !== $this->redis) {
- $this->redis->close();
- }
+ $this->redis->close();
}
}
diff --git a/src/Bundle/ChillMainBundle/Repository/CivilityRepository.php b/src/Bundle/ChillMainBundle/Repository/CivilityRepository.php
index 9e3f8928a..3604f25d0 100644
--- a/src/Bundle/ChillMainBundle/Repository/CivilityRepository.php
+++ b/src/Bundle/ChillMainBundle/Repository/CivilityRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Repository;
use Chill\MainBundle\Entity\Civility;
diff --git a/src/Bundle/ChillMainBundle/Repository/LocationRepository.php b/src/Bundle/ChillMainBundle/Repository/LocationRepository.php
index 44484c91c..253298d49 100644
--- a/src/Bundle/ChillMainBundle/Repository/LocationRepository.php
+++ b/src/Bundle/ChillMainBundle/Repository/LocationRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Repository;
use Chill\MainBundle\Entity\Location;
diff --git a/src/Bundle/ChillMainBundle/Repository/LocationTypeRepository.php b/src/Bundle/ChillMainBundle/Repository/LocationTypeRepository.php
index be47fe74c..e8d5579d0 100644
--- a/src/Bundle/ChillMainBundle/Repository/LocationTypeRepository.php
+++ b/src/Bundle/ChillMainBundle/Repository/LocationTypeRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Repository;
use Chill\MainBundle\Entity\LocationType;
diff --git a/src/Bundle/ChillMainBundle/Repository/NotificationRepository.php b/src/Bundle/ChillMainBundle/Repository/NotificationRepository.php
index e9aeed681..4af19550c 100644
--- a/src/Bundle/ChillMainBundle/Repository/NotificationRepository.php
+++ b/src/Bundle/ChillMainBundle/Repository/NotificationRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Repository;
use Chill\MainBundle\Entity\Notification;
diff --git a/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php b/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php
index 9eb8c859d..6dc446111 100644
--- a/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php
+++ b/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Repository;
use Chill\MainBundle\Entity\Center;
diff --git a/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepositoryInterface.php b/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepositoryInterface.php
index d55797fd5..206096b96 100644
--- a/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepositoryInterface.php
+++ b/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepositoryInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Repository;
use Chill\MainBundle\Entity\Center;
diff --git a/src/Bundle/ChillMainBundle/Repository/UserJobRepository.php b/src/Bundle/ChillMainBundle/Repository/UserJobRepository.php
index 0e012ad2c..13eb9e481 100644
--- a/src/Bundle/ChillMainBundle/Repository/UserJobRepository.php
+++ b/src/Bundle/ChillMainBundle/Repository/UserJobRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Repository;
use Chill\MainBundle\Entity\UserJob;
diff --git a/src/Bundle/ChillMainBundle/Repository/UserRepository.php b/src/Bundle/ChillMainBundle/Repository/UserRepository.php
index 388088fa7..00556702e 100644
--- a/src/Bundle/ChillMainBundle/Repository/UserRepository.php
+++ b/src/Bundle/ChillMainBundle/Repository/UserRepository.php
@@ -17,6 +17,7 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectRepository;
+use function count;
final class UserRepository implements ObjectRepository
{
diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss
index 53a9d200b..e7f613bc8 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss
+++ b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss
@@ -10,6 +10,9 @@
// Chill buttons
@import './scss/buttons';
+// Chill badges
+@import './scss/badge';
+
// Chill forms
@import './scss/forms';
@@ -202,9 +205,9 @@ footer.footer {
}
}
-
/*
- * SPECIFIC RULES
+ * GENERIC MAIN STYLES
+ * miscellaneous
*/
/// titles
@@ -280,7 +283,6 @@ div.metadata {
}
/// chill help tooltip
-
.chill-help-tooltip {
&::before {
content: '\f05a';
@@ -295,7 +297,6 @@ div.metadata {
/// display definition list
// with dt and dd on same line
-
dl.definition-inline {
dd {
display: inline;
@@ -317,6 +318,19 @@ dl.definition-inline {
font-style: italic;
}
+/// flash
+div#flashMessages {
+ margin-top: 20px;
+ .flash-notice {
+ margin-top: 10px;
+ margin-bottom: 10px;
+ }
+}
+
+/*
+ * SPECIFIC RULES
+ */
+
//// still used ?
// move from chillmain.css, converted to sass
@@ -369,14 +383,6 @@ div#usefulbar {
}
}
-div#flashMessages {
- margin-top: 20px;
- .flash-notice {
- margin-top: 10px;
- margin-bottom: 10px;
- }
-}
-
.personName {
font-variant: small-caps;
text-transform: capitalize;
diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/badge.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/badge.scss
new file mode 100644
index 000000000..5a7c084a8
--- /dev/null
+++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/badge.scss
@@ -0,0 +1,54 @@
+
+/// mixin used in this sheet
+@mixin remove_link {
+ cursor: pointer;
+ &:before {
+ font: normal normal normal 14px/1 ForkAwesome;
+ margin-left: 0.5em;
+ content: "\f00d"; // fa-times
+ color: var(--bs-danger);
+ text-decoration: none;
+ }
+}
+
+/*
+* SUGGESTIONS LIST - A specific list of badges used to manage suggestions (with add/remove link)
+* /!\ use bootstrap badge styles,
+* cfr. src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_custom.scss
+*/
+
+ul.list-suggest {
+ list-style-type: none;
+ padding-left: 0;
+ li > span {
+ white-space: normal;
+ text-align: start;
+ margin-bottom: 3px;
+ }
+ &.add-items {
+ li {
+ cursor: pointer;
+ & > span:before {
+ font: normal normal normal 14px/1 ForkAwesome;
+ margin-right: 0.5em;
+ content: "\f067"; // fa-plus
+ color: var(--bs-success);
+ }
+ }
+ }
+ &.remove-items {
+ li {
+ a {
+ @include remove_link;
+ }
+ }
+ }
+}
+
+/// manage remove link if it isn't a list but a title
+/// (cfr. in Vue AccompanyingCourseWorkEdit)
+div.item-title {
+ a {
+ @include remove_link;
+ }
+}
diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/api/apiMethods.js b/src/Bundle/ChillMainBundle/Resources/public/lib/api/apiMethods.js
index 5b49ba546..96a95ad93 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/lib/api/apiMethods.js
+++ b/src/Bundle/ChillMainBundle/Resources/public/lib/api/apiMethods.js
@@ -10,7 +10,6 @@
body: (body !== null) ? JSON.stringify(body) : null
})
.then(response => {
-
if (response.ok) {
return response.json();
}
diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_custom.scss b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_custom.scss
index 9d632026f..38998bfd5 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_custom.scss
+++ b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_custom.scss
@@ -4,3 +4,12 @@
*/
+/// A specific list of badges, use bootstrap badge styles
+/// cfr. src/Bundle/ChillMainBundle/Resources/public/chill/scss/badge.scss
+ul.list-suggest {
+ li > span {
+ @extend .badge;
+ @extend .bg-primary;
+ }
+}
+
diff --git a/src/Bundle/ChillMainBundle/Resources/test/Fixtures/App/app/AppKernel.php b/src/Bundle/ChillMainBundle/Resources/test/Fixtures/App/app/AppKernel.php
index 1e2499c40..4f0542aec 100644
--- a/src/Bundle/ChillMainBundle/Resources/test/Fixtures/App/app/AppKernel.php
+++ b/src/Bundle/ChillMainBundle/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/ChillMainBundle/Resources/test/Fixtures/App/app/autoload.php b/src/Bundle/ChillMainBundle/Resources/test/Fixtures/App/app/autoload.php
index a2dfe7f92..ea351fb8a 100644
--- a/src/Bundle/ChillMainBundle/Resources/test/Fixtures/App/app/autoload.php
+++ b/src/Bundle/ChillMainBundle/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/ChillMainBundle/Resources/views/LocationType/index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/LocationType/index.html.twig
index ec617c6c0..5402d5e89 100644
--- a/src/Bundle/ChillMainBundle/Resources/views/LocationType/index.html.twig
+++ b/src/Bundle/ChillMainBundle/Resources/views/LocationType/index.html.twig
@@ -11,6 +11,7 @@
{{ 'Address required'|trans }}
{{ 'Contact data'|trans }}
{{ 'Active'|trans }}
+
{{ 'Default for'|trans }}
@@ -33,6 +34,7 @@
{%- endif -%}
+
{{ entity.defaultFor|trans }}
diff --git a/src/Bundle/ChillMainBundle/Routing/LocalMenuBuilderInterface.php b/src/Bundle/ChillMainBundle/Routing/LocalMenuBuilderInterface.php
index c26b13586..23d4a5724 100644
--- a/src/Bundle/ChillMainBundle/Routing/LocalMenuBuilderInterface.php
+++ b/src/Bundle/ChillMainBundle/Routing/LocalMenuBuilderInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Routing;
use Knp\Menu\MenuItem;
diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminSectionMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminSectionMenuBuilder.php
index b76fbe4f2..9bcc80ad2 100644
--- a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminSectionMenuBuilder.php
+++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/AdminSectionMenuBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Routing\MenuBuilder;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/LocationMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/LocationMenuBuilder.php
index a304275d3..da1ce479b 100644
--- a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/LocationMenuBuilder.php
+++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/LocationMenuBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Routing\MenuBuilder;
use Knp\Menu\MenuItem;
diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/PermissionMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/PermissionMenuBuilder.php
index 116aa0498..6fab6b635 100644
--- a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/PermissionMenuBuilder.php
+++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/PermissionMenuBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Routing\MenuBuilder;
use Knp\Menu\MenuItem;
diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/SectionMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/SectionMenuBuilder.php
index b1d5abcfd..9aae86e48 100644
--- a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/SectionMenuBuilder.php
+++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/SectionMenuBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Routing\MenuBuilder;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
diff --git a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php
index bdff818ef..51758d979 100644
--- a/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php
+++ b/src/Bundle/ChillMainBundle/Routing/MenuBuilder/UserMenuBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Routing\MenuBuilder;
use Chill\MainBundle\Entity\User;
diff --git a/src/Bundle/ChillMainBundle/Routing/MenuComposer.php b/src/Bundle/ChillMainBundle/Routing/MenuComposer.php
index 94a6970c8..a94cf41f3 100644
--- a/src/Bundle/ChillMainBundle/Routing/MenuComposer.php
+++ b/src/Bundle/ChillMainBundle/Routing/MenuComposer.php
@@ -16,6 +16,7 @@ use Knp\Menu\ItemInterface;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Translation\TranslatorInterface;
+use function array_key_exists;
use function array_merge;
use function array_values;
@@ -128,7 +129,7 @@ class MenuComposer
*/
public function hasLocalMenuBuilder($menuId): bool
{
- return \array_key_exists($menuId, $this->localMenuBuilders);
+ return array_key_exists($menuId, $this->localMenuBuilders);
}
/**
diff --git a/src/Bundle/ChillMainBundle/Routing/MenuTwig.php b/src/Bundle/ChillMainBundle/Routing/MenuTwig.php
index 536d5b555..bf59bfcb8 100644
--- a/src/Bundle/ChillMainBundle/Routing/MenuTwig.php
+++ b/src/Bundle/ChillMainBundle/Routing/MenuTwig.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Routing;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
diff --git a/src/Bundle/ChillMainBundle/Search/AbstractSearch.php b/src/Bundle/ChillMainBundle/Search/AbstractSearch.php
index 3577c1300..adadc3422 100644
--- a/src/Bundle/ChillMainBundle/Search/AbstractSearch.php
+++ b/src/Bundle/ChillMainBundle/Search/AbstractSearch.php
@@ -7,9 +7,12 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Search;
use DateTime;
+use function array_key_exists;
use function strpos;
/**
diff --git a/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php b/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php
index 18e98a0e7..5a68fab37 100644
--- a/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php
+++ b/src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Search\Entity;
use Chill\MainBundle\Repository\UserRepository;
@@ -31,7 +33,7 @@ class SearchUserApiProvider implements SearchApiInterface
public function prepare(array $metadatas): void
{
- $ids = array_map(fn ($m) => $m['id'], $metadatas);
+ $ids = array_map(static fn ($m) => $m['id'], $metadatas);
$this->userRepository->findBy(['id' => $ids]);
}
@@ -60,6 +62,6 @@ class SearchUserApiProvider implements SearchApiInterface
public function supportsTypes(string $pattern, array $types, array $parameters): bool
{
- return in_array('user', $types);
+ return in_array('user', $types, true);
}
}
diff --git a/src/Bundle/ChillMainBundle/Search/HasAdvancedSearchFormInterface.php b/src/Bundle/ChillMainBundle/Search/HasAdvancedSearchFormInterface.php
index a06d28b48..dbe34c00b 100644
--- a/src/Bundle/ChillMainBundle/Search/HasAdvancedSearchFormInterface.php
+++ b/src/Bundle/ChillMainBundle/Search/HasAdvancedSearchFormInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Search;
use Symfony\Component\Form\FormBuilderInterface;
diff --git a/src/Bundle/ChillMainBundle/Search/Model/Result.php b/src/Bundle/ChillMainBundle/Search/Model/Result.php
index ca6960fc5..96d021187 100644
--- a/src/Bundle/ChillMainBundle/Search/Model/Result.php
+++ b/src/Bundle/ChillMainBundle/Search/Model/Result.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Search\Model;
class Result
diff --git a/src/Bundle/ChillMainBundle/Search/ParsingException.php b/src/Bundle/ChillMainBundle/Search/ParsingException.php
index 29533d85f..1c53463a5 100644
--- a/src/Bundle/ChillMainBundle/Search/ParsingException.php
+++ b/src/Bundle/ChillMainBundle/Search/ParsingException.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Search;
use Exception;
diff --git a/src/Bundle/ChillMainBundle/Search/SearchApi.php b/src/Bundle/ChillMainBundle/Search/SearchApi.php
index d83af2825..b0740b383 100644
--- a/src/Bundle/ChillMainBundle/Search/SearchApi.php
+++ b/src/Bundle/ChillMainBundle/Search/SearchApi.php
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query\ResultSetMappingBuilder;
use function array_map;
use function array_merge;
+use function count;
use function implode;
use function strtr;
@@ -160,7 +161,7 @@ class SearchApi
private function findQueries($pattern, array $types, array $parameters): array
{
return array_map(
- fn ($p) => $p->provideQuery($pattern, $parameters),
+ static fn ($p) => $p->provideQuery($pattern, $parameters),
$this->findProviders($pattern, $types, $parameters),
);
}
diff --git a/src/Bundle/ChillMainBundle/Search/SearchApiInterface.php b/src/Bundle/ChillMainBundle/Search/SearchApiInterface.php
index 0c0e42ac3..111bd5e5e 100644
--- a/src/Bundle/ChillMainBundle/Search/SearchApiInterface.php
+++ b/src/Bundle/ChillMainBundle/Search/SearchApiInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Search;
interface SearchApiInterface
diff --git a/src/Bundle/ChillMainBundle/Search/SearchApiNoQueryException.php b/src/Bundle/ChillMainBundle/Search/SearchApiNoQueryException.php
index b7e139c1c..46dfc759b 100644
--- a/src/Bundle/ChillMainBundle/Search/SearchApiNoQueryException.php
+++ b/src/Bundle/ChillMainBundle/Search/SearchApiNoQueryException.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Search;
use RuntimeException;
diff --git a/src/Bundle/ChillMainBundle/Search/SearchApiQuery.php b/src/Bundle/ChillMainBundle/Search/SearchApiQuery.php
index a8a623573..2fcea304d 100644
--- a/src/Bundle/ChillMainBundle/Search/SearchApiQuery.php
+++ b/src/Bundle/ChillMainBundle/Search/SearchApiQuery.php
@@ -7,9 +7,12 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Search;
use function array_push;
+use function count;
use function implode;
use function strtr;
diff --git a/src/Bundle/ChillMainBundle/Search/SearchInterface.php b/src/Bundle/ChillMainBundle/Search/SearchInterface.php
index 6df5cbae7..0c9369808 100644
--- a/src/Bundle/ChillMainBundle/Search/SearchInterface.php
+++ b/src/Bundle/ChillMainBundle/Search/SearchInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Search;
/**
diff --git a/src/Bundle/ChillMainBundle/Search/SearchProvider.php b/src/Bundle/ChillMainBundle/Search/SearchProvider.php
index ccf013f2a..61eb3fcd8 100644
--- a/src/Bundle/ChillMainBundle/Search/SearchProvider.php
+++ b/src/Bundle/ChillMainBundle/Search/SearchProvider.php
@@ -7,9 +7,13 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Search;
use function array_key_exists;
+use function chr;
+use function count;
/**
* a service which gather all search services defined into the bundles
@@ -73,7 +77,7 @@ class SearchProvider
throw new UnknowSearchNameException($name);
}
- /*
+ /**
* return search services in an array, ordered by
* the order key (defined in service definition)
* the conflicts in keys (twice the same order) are resolved
@@ -83,12 +87,11 @@ class SearchProvider
*
* @return SearchInterface[], with an int as array key
*/
-
public function getByOrder()
{
//sort the array
- uasort($this->searchServices, function (SearchInterface $a, SearchInterface $b) {
- if ($a->getOrder() == $b->getOrder()) {
+ uasort($this->searchServices, static function (SearchInterface $a, SearchInterface $b) {
+ if ($a->getOrder() === $b->getOrder()) {
return 0;
}
@@ -120,8 +123,8 @@ class SearchProvider
public function getHasAdvancedFormSearchServices()
{
//sort the array
- uasort($this->hasAdvancedFormSearchServices, function (SearchInterface $a, SearchInterface $b) {
- if ($a->getOrder() == $b->getOrder()) {
+ uasort($this->hasAdvancedFormSearchServices, static function (SearchInterface $a, SearchInterface $b) {
+ if ($a->getOrder() === $b->getOrder()) {
return 0;
}
diff --git a/src/Bundle/ChillMainBundle/Search/UnknowSearchDomainException.php b/src/Bundle/ChillMainBundle/Search/UnknowSearchDomainException.php
index a54ca8e1c..6868a53f6 100644
--- a/src/Bundle/ChillMainBundle/Search/UnknowSearchDomainException.php
+++ b/src/Bundle/ChillMainBundle/Search/UnknowSearchDomainException.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Search;
use Exception;
diff --git a/src/Bundle/ChillMainBundle/Search/UnknowSearchNameException.php b/src/Bundle/ChillMainBundle/Search/UnknowSearchNameException.php
index 8b7864a77..36ee550e0 100644
--- a/src/Bundle/ChillMainBundle/Search/UnknowSearchNameException.php
+++ b/src/Bundle/ChillMainBundle/Search/UnknowSearchNameException.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Search;
use Exception;
diff --git a/src/Bundle/ChillMainBundle/Search/Utils/ExtractDateFromPattern.php b/src/Bundle/ChillMainBundle/Search/Utils/ExtractDateFromPattern.php
index 79a61a062..058bfe070 100644
--- a/src/Bundle/ChillMainBundle/Search/Utils/ExtractDateFromPattern.php
+++ b/src/Bundle/ChillMainBundle/Search/Utils/ExtractDateFromPattern.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Search\Utils;
use DateTimeImmutable;
diff --git a/src/Bundle/ChillMainBundle/Search/Utils/ExtractPhonenumberFromPattern.php b/src/Bundle/ChillMainBundle/Search/Utils/ExtractPhonenumberFromPattern.php
index 9f88ca588..caad6d093 100644
--- a/src/Bundle/ChillMainBundle/Search/Utils/ExtractPhonenumberFromPattern.php
+++ b/src/Bundle/ChillMainBundle/Search/Utils/ExtractPhonenumberFromPattern.php
@@ -7,9 +7,12 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Search\Utils;
use LogicException;
+use function count;
use function implode;
use function preg_match;
use function str_split;
diff --git a/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php b/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php
index 6caf12a54..23c1dae6b 100644
--- a/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php
+++ b/src/Bundle/ChillMainBundle/Search/Utils/SearchExtractionResult.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Search\Utils;
class SearchExtractionResult
diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php
index ad58b058a..2cca61e9f 100644
--- a/src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php
+++ b/src/Bundle/ChillMainBundle/Security/Authorization/AbstractChillVoter.php
@@ -15,6 +15,7 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use function get_class;
use function in_array;
+use const E_USER_DEPRECATED;
/**
* Voter for Chill software.
@@ -34,8 +35,8 @@ abstract class AbstractChillVoter extends Voter implements ChillVoterInterface
// @TODO: getSupportedAttributes() should be created in here and made abstract or in ChillVoterInterface.
// @TODO: getSupportedClasses() should be created in here and made abstract or in ChillVoterInterface.
- return in_array($attribute, $this->getSupportedAttributes($attribute))
- && in_array(get_class($subject), $this->getSupportedClasses());
+ return in_array($attribute, $this->getSupportedAttributes($attribute), true)
+ && in_array(get_class($subject), $this->getSupportedClasses(), true);
}
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php
index ab8506891..de7bff9ab 100644
--- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php
+++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php
@@ -24,6 +24,7 @@ use Symfony\Component\Security\Core\User\UserInterface;
use Traversable;
use UnexpectedValueException;
use function array_merge;
+use function get_class;
/**
* Helper for authorizations.
@@ -132,7 +133,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface
break;
}
- if ($scope->getId() == $roleScope->getScope()->getId()) {
+ if ($scope->getId() === $roleScope->getScope()->getId()) {
$centers[] = $groupCenter->getCenter();
break;
diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperInterface.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperInterface.php
index 9304dab77..0e4d739f6 100644
--- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperInterface.php
+++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Security\Authorization;
use Chill\MainBundle\Entity\Center;
diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/ChillVoterInterface.php b/src/Bundle/ChillMainBundle/Security/Authorization/ChillVoterInterface.php
index 2cfdc18ae..013cac51d 100644
--- a/src/Bundle/ChillMainBundle/Security/Authorization/ChillVoterInterface.php
+++ b/src/Bundle/ChillMainBundle/Security/Authorization/ChillVoterInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Security\Authorization;
/**
diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/VoterGeneratorInterface.php b/src/Bundle/ChillMainBundle/Security/Authorization/VoterGeneratorInterface.php
index 1dec1d053..ebf35ad7e 100644
--- a/src/Bundle/ChillMainBundle/Security/Authorization/VoterGeneratorInterface.php
+++ b/src/Bundle/ChillMainBundle/Security/Authorization/VoterGeneratorInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Security\Authorization;
interface VoterGeneratorInterface
diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/VoterHelperFactoryInterface.php b/src/Bundle/ChillMainBundle/Security/Authorization/VoterHelperFactoryInterface.php
index ea0b20286..405faae60 100644
--- a/src/Bundle/ChillMainBundle/Security/Authorization/VoterHelperFactoryInterface.php
+++ b/src/Bundle/ChillMainBundle/Security/Authorization/VoterHelperFactoryInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Security\Authorization;
interface VoterHelperFactoryInterface
diff --git a/src/Bundle/ChillMainBundle/Security/ParentRoleHelper.php b/src/Bundle/ChillMainBundle/Security/ParentRoleHelper.php
index b791e7bce..137c774b2 100644
--- a/src/Bundle/ChillMainBundle/Security/ParentRoleHelper.php
+++ b/src/Bundle/ChillMainBundle/Security/ParentRoleHelper.php
@@ -7,12 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Security;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Security\Core\Role\RoleHierarchyInterface;
use function array_keys;
+use function in_array;
/**
* Helper which traverse all role to find parents.
@@ -54,7 +57,7 @@ class ParentRoleHelper
foreach ($roles as $r) {
$childRoles = $this->roleHierarchy->getReachableRoleNames([$r]);
- if (\in_array($role, $childRoles)) {
+ if (in_array($role, $childRoles, true)) {
$parentRoles[] = $r;
}
}
@@ -75,6 +78,6 @@ class ParentRoleHelper
$reachableRoles = $this->roleHierarchy
->getReachableRoleNames([$parentRole]);
- return in_array($childRole, $reachableRoles);
+ return in_array($childRole, $reachableRoles, true);
}
}
diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php
index 7f5f44777..5e183e478 100644
--- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php
+++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Security\PasswordRecover;
use Chill\MainBundle\Entity\User;
diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEventSubscriber.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEventSubscriber.php
index eec173582..3bd747428 100644
--- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEventSubscriber.php
+++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEventSubscriber.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Security\PasswordRecover;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverLocker.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverLocker.php
index 7e6b50ad0..223aa1494 100644
--- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverLocker.php
+++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverLocker.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Security\PasswordRecover;
use Chill\MainBundle\Redis\ChillRedis;
diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverVoter.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverVoter.php
index 01f091b73..40787fe74 100644
--- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverVoter.php
+++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverVoter.php
@@ -7,12 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Security\PasswordRecover;
use Chill\MainBundle\Entity\User;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
+use function in_array;
class PasswordRecoverVoter extends Voter
{
@@ -43,7 +46,7 @@ class PasswordRecoverVoter extends Voter
protected function supports($attribute, $subject): bool
{
- if (!in_array($attribute, $this->supported)) {
+ if (!in_array($attribute, $this->supported, true)) {
return false;
}
diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php
index 4baa682c7..e6f3db0e7 100644
--- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php
+++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Security\PasswordRecover;
use Chill\MainBundle\Entity\User;
diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/TokenManager.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/TokenManager.php
index 9a60c1da0..6a7f6f03e 100644
--- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/TokenManager.php
+++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/TokenManager.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Security\PasswordRecover;
use Chill\MainBundle\Entity\User;
diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverInterface.php b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverInterface.php
index a6bdbe001..2c4e1f8f8 100644
--- a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverInterface.php
+++ b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Security\Resolver;
use Chill\MainBundle\Entity\Center;
diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php
index 1dd2994ea..2dfe1ecf2 100644
--- a/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php
+++ b/src/Bundle/ChillMainBundle/Security/Resolver/CenterResolverManager.php
@@ -13,6 +13,7 @@ namespace Chill\MainBundle\Security\Resolver;
use Chill\MainBundle\Entity\Center;
use UnexpectedValueException;
+use function get_class;
use function is_array;
final class CenterResolverManager implements CenterResolverManagerInterface
diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/DefaultCenterResolver.php b/src/Bundle/ChillMainBundle/Security/Resolver/DefaultCenterResolver.php
index 40c15bde7..0da9e1151 100644
--- a/src/Bundle/ChillMainBundle/Security/Resolver/DefaultCenterResolver.php
+++ b/src/Bundle/ChillMainBundle/Security/Resolver/DefaultCenterResolver.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Security\Resolver;
use Chill\MainBundle\Entity\HasCenterInterface;
diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/DefaultScopeResolver.php b/src/Bundle/ChillMainBundle/Security/Resolver/DefaultScopeResolver.php
index e4b9021f4..b2b5e97e5 100644
--- a/src/Bundle/ChillMainBundle/Security/Resolver/DefaultScopeResolver.php
+++ b/src/Bundle/ChillMainBundle/Security/Resolver/DefaultScopeResolver.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Security\Resolver;
use Chill\MainBundle\Entity\HasScopeInterface;
diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php b/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php
index 6bd4cddc2..66bfdb4ee 100644
--- a/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php
+++ b/src/Bundle/ChillMainBundle/Security/Resolver/ResolverTwigExtension.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Security\Resolver;
use Twig\TwigFilter;
diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php
index 96321de6a..1cd03e2b7 100644
--- a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php
+++ b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverDispatcher.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Security\Resolver;
use Chill\MainBundle\Entity\Scope;
diff --git a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverInterface.php b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverInterface.php
index 1e4319ad9..2d5601ffa 100644
--- a/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverInterface.php
+++ b/src/Bundle/ChillMainBundle/Security/Resolver/ScopeResolverInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Security\Resolver;
use Chill\MainBundle\Entity\Scope;
diff --git a/src/Bundle/ChillMainBundle/Security/RoleProvider.php b/src/Bundle/ChillMainBundle/Security/RoleProvider.php
index 5a0db7239..15b7f69ff 100644
--- a/src/Bundle/ChillMainBundle/Security/RoleProvider.php
+++ b/src/Bundle/ChillMainBundle/Security/RoleProvider.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Security;
use function array_fill_keys;
@@ -106,7 +108,7 @@ class RoleProvider
}
} else {
if ($provider->getRoles() !== null) {
- $this->rolesTitlesCache = \array_merge(
+ $this->rolesTitlesCache = array_merge(
$this->rolesTitlesCache,
array_fill_keys($provider->getRoles(), null)
);
diff --git a/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php b/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php
index db9e4c2de..b25c513fd 100644
--- a/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php
+++ b/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php
@@ -42,7 +42,7 @@ class UserProvider implements UserProviderInterface
->getSingleResult();
} catch (NoResultException $e) {
throw new UsernameNotFoundException(
- sprintf('Bad credentials.'),
+ 'Bad credentials.',
0,
$e
);
diff --git a/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php b/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php
index 420520b66..758ca55b4 100644
--- a/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php
+++ b/src/Bundle/ChillMainBundle/Serializer/Model/Collection.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Serializer\Model;
use Chill\MainBundle\Pagination\PaginatorInterface;
diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php
index c5211e5a2..cbe712ee8 100644
--- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php
+++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Serializer\Normalizer;
use Chill\MainBundle\Entity\Center;
@@ -17,7 +19,7 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use function array_key_exists;
-class CenterNormalizer implements NormalizerInterface, DenormalizerInterface
+class CenterNormalizer implements DenormalizerInterface, NormalizerInterface
{
private CenterRepository $repository;
diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CollectionNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CollectionNormalizer.php
index ce2a36f09..0c80e0439 100644
--- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CollectionNormalizer.php
+++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CollectionNormalizer.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Serializer\Normalizer;
use Chill\MainBundle\Serializer\Model\Collection;
@@ -14,7 +16,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
-class CollectionNormalizer implements NormalizerInterface, NormalizerAwareInterface
+class CollectionNormalizer implements NormalizerAwareInterface, NormalizerInterface
{
use NormalizerAwareTrait;
diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php
index 4813203d7..3050ad268 100644
--- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php
+++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Serializer\Normalizer;
use DateTime;
@@ -17,6 +19,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
+use function array_key_exists;
use function is_array;
class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInterface
@@ -98,7 +101,7 @@ class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInt
if ('docgen' === $format) {
return $data instanceof DateTimeInterface || (
null === $data
- && \array_key_exists('docgen:expects', $context)
+ && array_key_exists('docgen:expects', $context)
&& (
DateTimeInterface::class === $context['docgen:expects']
|| DateTime::class === $context['docgen:expects']
diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php
index 018f99b46..f31b5d60d 100644
--- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php
+++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Serializer\Normalizer;
use LogicException;
@@ -14,6 +16,7 @@ use Symfony\Component\Serializer\Exception\RuntimeException;
use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
+use function count;
use function implode;
/**
@@ -57,7 +60,7 @@ class DiscriminatedObjectDenormalizer implements ContextAwareDenormalizerInterfa
}
if (0 === count($context[self::ALLOWED_TYPES] ?? [])) {
- throw new LogicException('The context should contains a list of
+ throw new LogicException('The context should contains a list of
allowed types');
}
diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php
index f33241cc7..aa9d12e24 100644
--- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php
+++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Serializer\Normalizer;
use Doctrine\ORM\EntityManagerInterface;
@@ -15,6 +17,7 @@ use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use function array_key_exists;
+use function count;
use function is_array;
class DoctrineExistingEntityNormalizer implements DenormalizerInterface
diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PointNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PointNormalizer.php
index e4c8a1737..c8c532802 100644
--- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PointNormalizer.php
+++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PointNormalizer.php
@@ -7,12 +7,16 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Serializer\Normalizer;
use Chill\MainBundle\Doctrine\Model\Point;
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
+use function count;
+use function is_array;
class PointNormalizer implements DenormalizerInterface
{
diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php
index 66274f058..f046cb34f 100644
--- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php
+++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Serializer\Normalizer;
use Chill\MainBundle\Entity\User;
@@ -15,7 +17,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
-class UserNormalizer implements NormalizerInterface, NormalizerAwareInterface
+class UserNormalizer implements NormalizerAwareInterface, NormalizerInterface
{
use NormalizerAwareTrait;
diff --git a/src/Bundle/ChillMainBundle/Templating/CSVCellTwig.php b/src/Bundle/ChillMainBundle/Templating/CSVCellTwig.php
index 1820d1775..6d3075d6f 100644
--- a/src/Bundle/ChillMainBundle/Templating/CSVCellTwig.php
+++ b/src/Bundle/ChillMainBundle/Templating/CSVCellTwig.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating;
use Twig\Extension\AbstractExtension;
@@ -20,21 +22,23 @@ use Twig\TwigFilter;
*/
class CSVCellTwig extends AbstractExtension
{
- /*
- * Replace into a string the char " by ""
+ /**
+ * Replace into a string the char " by "".
*
- * @param String $content The input string.
- * @return String The safe string.
+ * @param string $content The input string.
+ *
+ * @return string The safe string.
*/
public function csvCellFilter($content)
{
return str_replace('"', '""', $content);
}
- /*
+ /**
* Returns a list of filters to add to the existing list.
*
* (non-PHPdoc)
+ *
* @see Twig_Extension::getFilters()
*/
public function getFilters()
@@ -48,7 +52,7 @@ class CSVCellTwig extends AbstractExtension
];
}
- /*
+ /**
* Returns the name of the extension.
*
* @return The name of the extension.
diff --git a/src/Bundle/ChillMainBundle/Templating/ChillMarkdownRenderExtension.php b/src/Bundle/ChillMainBundle/Templating/ChillMarkdownRenderExtension.php
index c0da5c6eb..55212c64f 100644
--- a/src/Bundle/ChillMainBundle/Templating/ChillMarkdownRenderExtension.php
+++ b/src/Bundle/ChillMainBundle/Templating/ChillMarkdownRenderExtension.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating;
use Parsedown;
diff --git a/src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php b/src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php
index 9b9e5815a..4bc0cffd4 100644
--- a/src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php
+++ b/src/Bundle/ChillMainBundle/Templating/ChillTwigHelper.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating;
use DateTimeInterface;
diff --git a/src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php b/src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php
index fa65369c4..478920f05 100644
--- a/src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php
+++ b/src/Bundle/ChillMainBundle/Templating/ChillTwigRoutingHelper.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating;
use Symfony\Bridge\Twig\Extension\RoutingExtension;
diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/AbstractChillEntityRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/AbstractChillEntityRender.php
index 1ddd272c9..d82b2885a 100644
--- a/src/Bundle/ChillMainBundle/Templating/Entity/AbstractChillEntityRender.php
+++ b/src/Bundle/ChillMainBundle/Templating/Entity/AbstractChillEntityRender.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating\Entity;
abstract class AbstractChillEntityRender implements ChillEntityRenderInterface
diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php
index 2e3a80219..2a29fb2f3 100644
--- a/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php
+++ b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating\Entity;
use Chill\MainBundle\Entity\Address;
diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRender.php
index fc543ab3f..87a15955a 100644
--- a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRender.php
+++ b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRender.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating\Entity;
/**
diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php
index 2d7e3bec9..e1eae3884 100644
--- a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php
+++ b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderExtension.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating\Entity;
use Twig\Extension\AbstractExtension;
diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderInterface.php b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderInterface.php
index d570ddd22..d55b8bfd7 100644
--- a/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderInterface.php
+++ b/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating\Entity;
/**
diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php
index 5e5f24eb3..a6285d26b 100644
--- a/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php
+++ b/src/Bundle/ChillMainBundle/Templating/Entity/CommentRender.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating\Entity;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/CompilerPass.php b/src/Bundle/ChillMainBundle/Templating/Entity/CompilerPass.php
index 9f2af4139..38f6284ca 100644
--- a/src/Bundle/ChillMainBundle/Templating/Entity/CompilerPass.php
+++ b/src/Bundle/ChillMainBundle/Templating/Entity/CompilerPass.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating\Entity;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php
index a91b9bb69..9247b8ffb 100644
--- a/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php
+++ b/src/Bundle/ChillMainBundle/Templating/Entity/UserRender.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating\Entity;
use Chill\MainBundle\Entity\User;
diff --git a/src/Bundle/ChillMainBundle/Templating/Events/DelegatedBlockRenderingEvent.php b/src/Bundle/ChillMainBundle/Templating/Events/DelegatedBlockRenderingEvent.php
index f5ba84198..965c80fda 100644
--- a/src/Bundle/ChillMainBundle/Templating/Events/DelegatedBlockRenderingEvent.php
+++ b/src/Bundle/ChillMainBundle/Templating/Events/DelegatedBlockRenderingEvent.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating\Events;
use ArrayAccess;
diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php
index 66ad3aa39..82b5f8295 100644
--- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php
+++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating\Listing;
use Chill\MainBundle\Form\Type\Listing\FilterOrderType;
@@ -14,6 +16,7 @@ use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use function array_merge;
+use function count;
class FilterOrderHelper
{
diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php
index 9ce2c41cd..9e6cb813c 100644
--- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php
+++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating\Listing;
use Symfony\Component\Form\FormFactoryInterface;
diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php
index 72fed8ae6..fd6b4622d 100644
--- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php
+++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating\Listing;
use Symfony\Component\Form\FormFactoryInterface;
diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactoryInterface.php b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactoryInterface.php
index bd90b2bd8..223e2d568 100644
--- a/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactoryInterface.php
+++ b/src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactoryInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating\Listing;
interface FilterOrderHelperFactoryInterface
diff --git a/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php b/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php
index 8ff545b1a..15e570009 100644
--- a/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php
+++ b/src/Bundle/ChillMainBundle/Templating/Listing/Templating.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating\Listing;
use Twig\Environment;
diff --git a/src/Bundle/ChillMainBundle/Templating/TranslatableStringHelper.php b/src/Bundle/ChillMainBundle/Templating/TranslatableStringHelper.php
index 1673ce386..5da53f515 100644
--- a/src/Bundle/ChillMainBundle/Templating/TranslatableStringHelper.php
+++ b/src/Bundle/ChillMainBundle/Templating/TranslatableStringHelper.php
@@ -13,6 +13,7 @@ namespace Chill\MainBundle\Templating;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Contracts\Translation\TranslatorInterface;
+use function array_key_exists;
final class TranslatableStringHelper implements TranslatableStringHelperInterface
{
diff --git a/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php b/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php
index 39be0150b..6f614f93d 100644
--- a/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php
+++ b/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
@@ -30,10 +32,11 @@ class TranslatableStringTwig extends AbstractExtension
$this->helper = $translatableStringHelper;
}
- /*
+ /**
* Returns a list of filters to add to the existing list.
*
* (non-PHPdoc)
+ *
* @see Twig_Extension::getFilters()
*/
public function getFilters()
@@ -45,7 +48,7 @@ class TranslatableStringTwig extends AbstractExtension
), ];
}
- /*
+ /**
* Returns the name of the extension.
*
* @return The name of the extension.
diff --git a/src/Bundle/ChillMainBundle/Templating/UI/CountNotificationUser.php b/src/Bundle/ChillMainBundle/Templating/UI/CountNotificationUser.php
index 2440aaea2..80dde8fa1 100644
--- a/src/Bundle/ChillMainBundle/Templating/UI/CountNotificationUser.php
+++ b/src/Bundle/ChillMainBundle/Templating/UI/CountNotificationUser.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating\UI;
use Chill\MainBundle\Entity\User;
diff --git a/src/Bundle/ChillMainBundle/Templating/UI/NotificationCounterInterface.php b/src/Bundle/ChillMainBundle/Templating/UI/NotificationCounterInterface.php
index 1ab8e86d4..528903cbf 100644
--- a/src/Bundle/ChillMainBundle/Templating/UI/NotificationCounterInterface.php
+++ b/src/Bundle/ChillMainBundle/Templating/UI/NotificationCounterInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating\UI;
use Symfony\Component\Security\Core\User\UserInterface;
diff --git a/src/Bundle/ChillMainBundle/Templating/Widget/WidgetInterface.php b/src/Bundle/ChillMainBundle/Templating/Widget/WidgetInterface.php
index b378a2de1..16f33057d 100644
--- a/src/Bundle/ChillMainBundle/Templating/Widget/WidgetInterface.php
+++ b/src/Bundle/ChillMainBundle/Templating/Widget/WidgetInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating\Widget;
use Twig\Environment;
diff --git a/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php b/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php
index 8f181207c..b8b751b81 100644
--- a/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php
+++ b/src/Bundle/ChillMainBundle/Templating/Widget/WidgetRenderingTwig.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Templating\Widget;
use Chill\MainBundle\Templating\Events\DelegatedBlockRenderingEvent;
@@ -14,6 +16,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Twig\Environment;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
+use function array_key_exists;
use function ksort;
/**
@@ -114,7 +117,7 @@ class WidgetRenderingTwig extends AbstractExtension
$content = '';
foreach ($this->getWidgetsArraysOrdered($block) as $a) {
- /* @var $widget Widget\WidgetInterface */
+ /** @var Widget\WidgetInterface $widget */
$widget = $a[0];
$config = $a[1];
diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php
index eb445faf5..f5b26b353 100644
--- a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php
+++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php
@@ -7,12 +7,19 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Test\Export;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\QueryBuilder;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Traversable;
+use function call_user_func;
+use function count;
+use function is_array;
+use function is_callable;
+use function is_string;
/**
* Helper which creates a set of test for aggregators.
@@ -109,7 +116,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase
$this->assertGreaterThanOrEqual(
$nbOfFrom,
$query->getDQLPart('from') !== null ? count($query->getDQLPart('from')) : 0,
- "Test that there are equal or more 'from' clause after that the filter has
+ "Test that there are equal or more 'from' clause after that the filter has
altered the query"
);
$this->assertGreaterThanOrEqual(
diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php
index 72db44dac..99e9779f1 100644
--- a/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php
+++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Test\Export;
use Chill\MainBundle\Test\PrepareClientTrait;
@@ -17,6 +19,11 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Role\Role;
use Traversable;
+use function call_user_func;
+use function count;
+use function is_array;
+use function is_callable;
+use function is_string;
/**
* This class provide a set of tests for exports.
@@ -325,7 +332,7 @@ abstract class AbstractExportTest extends WebTestCase
*/
public function testListExportPage()
{
- /* @var $client \Symfony\Component\BrowserKit\Client */
+ /** @var \Symfony\Component\BrowserKit\Client $client */
$client = $this->getClient();
$export = $this->getExport();
$prophet = new \Prophecy\Prophet();
diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php
index 2c12b89df..78cf0083a 100644
--- a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php
+++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php
@@ -7,11 +7,17 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Test\Export;
use Doctrine\ORM\QueryBuilder;
use Exception;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
+use function count;
+use function get_class;
+use function is_array;
+use function is_string;
/**
* Helper to test filters.
@@ -99,7 +105,7 @@ abstract class AbstractFilterTest extends KernelTestCase
$this->assertGreaterThanOrEqual(
$nbOfFrom,
$query->getDQLPart('from') !== null ? count($query->getDQLPart('from')) : 0,
- "Test that there are equal or more 'from' clause after that the filter has
+ "Test that there are equal or more 'from' clause after that the filter has
altered the query"
);
$this->assertGreaterThanOrEqual(
diff --git a/src/Bundle/ChillMainBundle/Test/PrepareCenterTrait.php b/src/Bundle/ChillMainBundle/Test/PrepareCenterTrait.php
index 8c8bb96c5..9e4d6ea68 100644
--- a/src/Bundle/ChillMainBundle/Test/PrepareCenterTrait.php
+++ b/src/Bundle/ChillMainBundle/Test/PrepareCenterTrait.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Test;
/**
diff --git a/src/Bundle/ChillMainBundle/Test/PrepareCircleTrait.php b/src/Bundle/ChillMainBundle/Test/PrepareCircleTrait.php
index eb9d0d7ac..3aa3ebd11 100644
--- a/src/Bundle/ChillMainBundle/Test/PrepareCircleTrait.php
+++ b/src/Bundle/ChillMainBundle/Test/PrepareCircleTrait.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Test;
/**
diff --git a/src/Bundle/ChillMainBundle/Test/PrepareClientTrait.php b/src/Bundle/ChillMainBundle/Test/PrepareClientTrait.php
index 799b9e617..213eaed60 100644
--- a/src/Bundle/ChillMainBundle/Test/PrepareClientTrait.php
+++ b/src/Bundle/ChillMainBundle/Test/PrepareClientTrait.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Test;
use LogicException;
diff --git a/src/Bundle/ChillMainBundle/Test/PrepareScopeTrait.php b/src/Bundle/ChillMainBundle/Test/PrepareScopeTrait.php
index 7ab4f7323..286322f5e 100644
--- a/src/Bundle/ChillMainBundle/Test/PrepareScopeTrait.php
+++ b/src/Bundle/ChillMainBundle/Test/PrepareScopeTrait.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Test;
/**
diff --git a/src/Bundle/ChillMainBundle/Test/PrepareUserTrait.php b/src/Bundle/ChillMainBundle/Test/PrepareUserTrait.php
index 27af36491..662438a98 100644
--- a/src/Bundle/ChillMainBundle/Test/PrepareUserTrait.php
+++ b/src/Bundle/ChillMainBundle/Test/PrepareUserTrait.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Test;
use Chill\MainBundle\Entity\GroupCenter;
diff --git a/src/Bundle/ChillMainBundle/Test/ProphecyTrait.php b/src/Bundle/ChillMainBundle/Test/ProphecyTrait.php
index cf32299d6..a25624719 100644
--- a/src/Bundle/ChillMainBundle/Test/ProphecyTrait.php
+++ b/src/Bundle/ChillMainBundle/Test/ProphecyTrait.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Test;
/**
diff --git a/src/Bundle/ChillMainBundle/Tests/Authorization/ParentRoleHelperTest.php b/src/Bundle/ChillMainBundle/Tests/Authorization/ParentRoleHelperTest.php
index 1dc2fedcf..de3b95a31 100644
--- a/src/Bundle/ChillMainBundle/Tests/Authorization/ParentRoleHelperTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Authorization/ParentRoleHelperTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Security\Authorization;
use Chill\MainBundle\Security\ParentRoleHelper;
@@ -17,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
* @internal
* @coversNothing
*/
-class ParentRoleHelperTest extends KernelTestCase
+final class ParentRoleHelperTest extends KernelTestCase
{
private ParentRoleHelper $parentRoleHelper;
diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/AddressControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/AddressControllerTest.php
index 81f46838e..b36a655c5 100644
--- a/src/Bundle/ChillMainBundle/Tests/Controller/AddressControllerTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Controller/AddressControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Controller;
use Chill\MainBundle\Entity\Address;
@@ -18,7 +20,7 @@ use Symfony\Bundle\FrameworkBundle\KernelBrowser;
* @internal
* @coversNothing
*/
-class AddressControllerTest extends \Symfony\Bundle\FrameworkBundle\Test\WebTestCase
+final class AddressControllerTest extends \Symfony\Bundle\FrameworkBundle\Test\WebTestCase
{
use PrepareClientTrait;
diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/CenterControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/CenterControllerTest.php
index dd8074e4d..981bb3094 100644
--- a/src/Bundle/ChillMainBundle/Tests/Controller/CenterControllerTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Controller/CenterControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -15,12 +17,12 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class CenterControllerTest extends WebTestCase
+final class CenterControllerTest extends WebTestCase
{
public function testCompleteScenario()
{
// Create a new client to browse the application
- $client = static::createClient([], [
+ $client = self::createClient([], [
'PHP_AUTH_USER' => 'admin',
'PHP_AUTH_PW' => 'password',
'HTTP_ACCEPT_LANGUAGE' => 'fr_FR',
diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/ExportControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/ExportControllerTest.php
index 3f85c7d2e..33dbcc4ee 100644
--- a/src/Bundle/ChillMainBundle/Tests/Controller/ExportControllerTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Controller/ExportControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -17,11 +19,11 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class ExportControllerTest extends WebTestCase
+final class ExportControllerTest extends WebTestCase
{
public function testIndex()
{
- $client = static::createClient([], [
+ $client = self::createClient([], [
'PHP_AUTH_USER' => 'center a_social',
'PHP_AUTH_PW' => 'password',
'HTTP_ACCEPT_LANGUAGE' => 'fr_FR',
diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/LoginControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/LoginControllerTest.php
index 38a9de6a0..bed40b372 100644
--- a/src/Bundle/ChillMainBundle/Tests/Controller/LoginControllerTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Controller/LoginControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -16,11 +18,11 @@ use Symfony\Component\HttpFoundation\Response;
* @internal
* @coversNothing
*/
-class LoginControllerTest extends WebTestCase
+final class LoginControllerTest extends WebTestCase
{
public function testLogin()
{
- $client = static::createClient();
+ $client = self::createClient();
//load login page and submit form
$crawler = $client->request('GET', '/login');
diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/PermissionApiControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/PermissionApiControllerTest.php
index f267421bf..aec392045 100644
--- a/src/Bundle/ChillMainBundle/Tests/Controller/PermissionApiControllerTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Controller/PermissionApiControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Controller;
use Chill\MainBundle\Test\PrepareClientTrait;
@@ -17,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class PermissionApiControllerTest extends WebTestCase
+final class PermissionApiControllerTest extends WebTestCase
{
use PrepareClientTrait;
diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/PermissionsGroupControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/PermissionsGroupControllerTest.php
index aa64a8c91..f27eaa7a7 100644
--- a/src/Bundle/ChillMainBundle/Tests/Controller/PermissionsGroupControllerTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Controller/PermissionsGroupControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -15,7 +17,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class PermissionsGroupControllerTest extends WebTestCase
+final class PermissionsGroupControllerTest extends WebTestCase
{
public function testEmpty()
{
diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/ScopeControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/ScopeControllerTest.php
index 0c848d9ac..806153220 100644
--- a/src/Bundle/ChillMainBundle/Tests/Controller/ScopeControllerTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Controller/ScopeControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -15,12 +17,12 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class ScopeControllerTest extends WebTestCase
+final class ScopeControllerTest extends WebTestCase
{
public function testCompleteScenario()
{
// Create a new client to browse the application
- $client = static::createClient([], [
+ $client = self::createClient([], [
'PHP_AUTH_USER' => 'admin',
'PHP_AUTH_PW' => 'password',
'HTTP_ACCEPT_LANGUAGE' => 'fr_FR',
diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/SearchApiControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/SearchApiControllerTest.php
index 17ef616b0..a2cf41951 100644
--- a/src/Bundle/ChillMainBundle/Tests/Controller/SearchApiControllerTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Controller/SearchApiControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Bundle\ChillMainBundle\Tests\Controller;
use Chill\MainBundle\Test\PrepareClientTrait;
@@ -17,7 +19,7 @@ use Symfony\Component\HttpFoundation\Request;
* @internal
* @coversNothing
*/
-class SearchApiControllerTest extends WebTestCase
+final class SearchApiControllerTest extends WebTestCase
{
use PrepareClientTrait;
diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/SearchControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/SearchControllerTest.php
index cda4c18e2..4e101e370 100644
--- a/src/Bundle/ChillMainBundle/Tests/Controller/SearchControllerTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Controller/SearchControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -17,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
-class SearchControllerTest extends WebTestCase
+final class SearchControllerTest extends WebTestCase
{
public function testDomainUnknow()
{
@@ -90,7 +92,7 @@ class SearchControllerTest extends WebTestCase
private function getAuthenticatedClient()
{
- return static::createClient([], [
+ return self::createClient([], [
'PHP_AUTH_USER' => 'center b_social',
'PHP_AUTH_PW' => 'password',
]);
diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/UserApiControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/UserApiControllerTest.php
index 333ab2e19..813e9bc40 100644
--- a/src/Bundle/ChillMainBundle/Tests/Controller/UserApiControllerTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Controller/UserApiControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Controller;
use Chill\MainBundle\Test\PrepareClientTrait;
@@ -19,7 +21,7 @@ use function json_decode;
* @internal
* @coversNothing
*/
-class UserApiControllerTest extends WebTestCase
+final class UserApiControllerTest extends WebTestCase
{
use PrepareClientTrait;
diff --git a/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php b/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php
index e3ac7337e..00bec29f6 100644
--- a/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Controller/UserControllerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Controller;
use Chill\MainBundle\Entity\User;
@@ -18,7 +20,7 @@ use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
* @internal
* @coversNothing
*/
-class UserControllerTest extends WebTestCase
+final class UserControllerTest extends WebTestCase
{
private $client;
@@ -28,7 +30,7 @@ class UserControllerTest extends WebTestCase
{
self::bootKernel();
- $this->client = static::createClient([], [
+ $this->client = self::createClient([], [
'PHP_AUTH_USER' => 'admin',
'PHP_AUTH_PW' => 'password',
'HTTP_ACCEPT_LANGUAGE' => 'fr_FR',
@@ -157,7 +159,7 @@ class UserControllerTest extends WebTestCase
protected function isPasswordValid($username, $password)
{
- /* @var $passwordEncoder \Symfony\Component\Security\Core\Encoder\UserPasswordEncoder */
+ /** @var \Symfony\Component\Security\Core\Encoder\UserPasswordEncoder $passwordEncoder */
$passwordEncoder = self::$container
->get(UserPasswordEncoderInterface::class);
diff --git a/src/Bundle/ChillMainBundle/Tests/Doctrine/Model/PointTest.php b/src/Bundle/ChillMainBundle/Tests/Doctrine/Model/PointTest.php
index 045397ecc..bcb5b2d26 100644
--- a/src/Bundle/ChillMainBundle/Tests/Doctrine/Model/PointTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Doctrine/Model/PointTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Doctrine\Model;
use Chill\MainBundle\Doctrine\Model\Point;
@@ -18,7 +20,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
* @internal
* @coversNothing
*/
-class ExportControllerTest extends KernelTestCase
+final class PointTest extends KernelTestCase
{
public function testFromArrayGeoJson()
{
diff --git a/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php
index 3f4edc17d..645dff22e 100644
--- a/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Export;
use Chill\MainBundle\Export\AggregatorInterface;
@@ -21,6 +23,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Security\Core\Role\Role;
+use function count;
/**
* Test the export manager.
@@ -28,11 +31,11 @@ use Symfony\Component\Security\Core\Role\Role;
* @internal
* @coversNothing
*/
-class ExportManagerTest extends KernelTestCase
+final class ExportManagerTest extends KernelTestCase
{
use \Chill\MainBundle\Test\PrepareCenterTrait;
- use \Chill\MainBundle\Test\PrepareUserTrait;
use \Chill\MainBundle\Test\PrepareScopeTrait;
+ use \Chill\MainBundle\Test\PrepareUserTrait;
/**
* @var Prophecy\Prophet
@@ -229,7 +232,7 @@ class ExportManagerTest extends KernelTestCase
Argument::Type('array'),
Argument::is(['a' => 'b'])
)
- ->will(function () use ($em) {
+ ->will(static function () use ($em) {
$qb = $em->createQueryBuilder();
return $qb->addSelect('COUNT(user.id) as export')
@@ -253,7 +256,7 @@ class ExportManagerTest extends KernelTestCase
Argument::is([0, 1]),
Argument::Type('array')
)
- ->willReturn(function ($value) {
+ ->willReturn(static function ($value) {
switch ($value) {
case 0:
case 1:
@@ -293,7 +296,7 @@ class ExportManagerTest extends KernelTestCase
Argument::is(['cat a', 'cat b']),
Argument::is([])
)
- ->willReturn(function ($value) {
+ ->willReturn(static function ($value) {
switch ($value) {
case '_header': return 'foo_header';
diff --git a/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php b/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php
index 12a940d98..55f9b64c5 100644
--- a/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Form\Type;
use Chill\MainBundle\Entity\GroupCenter;
@@ -19,7 +21,7 @@ use Symfony\Component\Form\Test\TypeTestCase;
* @internal
* @coversNothing
*/
-class CenterTypeTest extends TypeTestCase
+final class PickCenterTypeTest extends TypeTestCase
{
/**
* Test that a user which can reach multiple center
diff --git a/src/Bundle/ChillMainBundle/Tests/Pagination/PageTest.php b/src/Bundle/ChillMainBundle/Tests/Pagination/PageTest.php
index 70568c8ac..c527a1f6a 100644
--- a/src/Bundle/ChillMainBundle/Tests/Pagination/PageTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Pagination/PageTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Pagination;
use Chill\MainBundle\Pagination\Page;
@@ -19,7 +21,7 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
* @internal
* @coversNothing
*/
-class PageTest extends KernelTestCase
+final class PageTest extends KernelTestCase
{
protected $paginator;
diff --git a/src/Bundle/ChillMainBundle/Tests/Pagination/PaginatorTest.php b/src/Bundle/ChillMainBundle/Tests/Pagination/PaginatorTest.php
index 9d35fc004..219669825 100644
--- a/src/Bundle/ChillMainBundle/Tests/Pagination/PaginatorTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Pagination/PaginatorTest.php
@@ -7,11 +7,14 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Pagination;
use Chill\MainBundle\Pagination\Paginator;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
+use function count;
/**
* Test the paginator class.
@@ -19,7 +22,7 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
* @internal
* @coversNothing
*/
-class PaginatorTest extends KernelTestCase
+final class PaginatorTest extends KernelTestCase
{
protected $paginator;
diff --git a/src/Bundle/ChillMainBundle/Tests/Routing/Loader/RouteLoaderTest.php b/src/Bundle/ChillMainBundle/Tests/Routing/Loader/RouteLoaderTest.php
index ba400dfdf..ff8ee423e 100644
--- a/src/Bundle/ChillMainBundle/Tests/Routing/Loader/RouteLoaderTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Routing/Loader/RouteLoaderTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Routing\Loader;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
@@ -17,14 +19,14 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
* @internal
* @coversNothing
*/
-class RouteLoaderTest extends KernelTestCase
+final class RouteLoaderTest extends KernelTestCase
{
private $router;
public function setUp()
{
- static::bootKernel();
- $this->router = static::$kernel->getContainer()->get('router');
+ self::bootKernel();
+ $this->router = self::$kernel->getContainer()->get('router');
}
/**
diff --git a/src/Bundle/ChillMainBundle/Tests/Search/AbstractSearchTest.php b/src/Bundle/ChillMainBundle/Tests/Search/AbstractSearchTest.php
index a39dc0738..c0c3b176a 100644
--- a/src/Bundle/ChillMainBundle/Tests/Search/AbstractSearchTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Search/AbstractSearchTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Search;
/**
@@ -15,7 +17,7 @@ namespace Chill\MainBundle\Tests\Search;
* @internal
* @coversNothing
*/
-class AbstractSearchTest extends \PHPUnit\Framework\TestCase
+final class AbstractSearchTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Chill\MainBundle\Search\AbstractSearch
diff --git a/src/Bundle/ChillMainBundle/Tests/Search/SearchApiQueryTest.php b/src/Bundle/ChillMainBundle/Tests/Search/SearchApiQueryTest.php
index 5adcb0965..339145d9f 100644
--- a/src/Bundle/ChillMainBundle/Tests/Search/SearchApiQueryTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Search/SearchApiQueryTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Search;
use Chill\MainBundle\Search\SearchApiQuery;
@@ -17,7 +19,7 @@ use function is_string;
* @internal
* @coversNothing
*/
-class SearchApiQueryTest extends TestCase
+final class SearchApiQueryTest extends TestCase
{
public function testBuildParams()
{
diff --git a/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php b/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php
index b2b64c904..3bbc2b94b 100644
--- a/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Test\Search;
use Chill\MainBundle\Search\SearchInterface;
@@ -17,7 +19,7 @@ use PHPUnit\Framework\TestCase;
* @internal
* @coversNothing
*/
-class SearchProviderTest extends TestCase
+final class SearchProviderTest extends TestCase
{
/**
* @var SearchProvider
diff --git a/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractDateFromPatternTest.php b/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractDateFromPatternTest.php
index 1fe8b7c01..310fac60e 100644
--- a/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractDateFromPatternTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractDateFromPatternTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Search\Utils;
use Chill\MainBundle\Search\Utils\ExtractDateFromPattern;
@@ -18,7 +20,7 @@ use function array_map;
* @internal
* @coversNothing
*/
-class ExtractDateFromPatternTest extends TestCase
+final class ExtractDateFromPatternTest extends TestCase
{
public function provideSubjects()
{
@@ -50,7 +52,7 @@ class ExtractDateFromPatternTest extends TestCase
$this->assertContainsOnlyInstancesOf(DateTimeImmutable::class, $result->getFound());
$dates = array_map(
- function (DateTimeImmutable $d) {
+ static function (DateTimeImmutable $d) {
return $d->format('Y-m-d');
},
$result->getFound()
diff --git a/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractPhonenumberFromPatternTest.php b/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractPhonenumberFromPatternTest.php
index fedd43f5b..f792c0a04 100644
--- a/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractPhonenumberFromPatternTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Search/Utils/ExtractPhonenumberFromPatternTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Search\Utils;
use Chill\MainBundle\Search\Utils\ExtractPhonenumberFromPattern;
@@ -16,7 +18,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
* @internal
* @coversNothing
*/
-class ExtractPhonenumberFromPatternTest extends KernelTestCase
+final class ExtractPhonenumberFromPatternTest extends KernelTestCase
{
public function provideData()
{
diff --git a/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php b/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php
index 80a7af66a..0046b5a74 100644
--- a/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Security\Authorization;
use Chill\MainBundle\Entity\Center;
@@ -23,12 +25,13 @@ use Chill\MainBundle\Test\ProphecyTrait;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Security\Core\Role\Role;
use function array_map;
+use function in_array;
/**
* @internal
* @coversNothing
*/
-class AuthorizationHelperTest extends KernelTestCase
+final class AuthorizationHelperTest extends KernelTestCase
{
use PrepareCenterTrait;
use PrepareScopeTrait;
@@ -37,7 +40,7 @@ class AuthorizationHelperTest extends KernelTestCase
public function setUp()
{
- static::bootKernel();
+ self::bootKernel();
}
public function dataProvider_getReachableCenters()
@@ -74,36 +77,36 @@ class AuthorizationHelperTest extends KernelTestCase
true,
in_array($centerA, $ah->getReachableCenters(
$userA,
- new Role('CHILL_ROLE_1'),
+ 'CHILL_ROLE_1',
null
- )),
+ ), true),
'center A should be available for userA, with role 1 ',
],
[
true,
in_array($centerA, $ah->getReachableCenters(
$userA,
- new Role('CHILL_ROLE_2'),
+ 'CHILL_ROLE_2',
null
- )),
+ ), true),
'center A should be available for userA, with role 2 ',
],
[
true,
in_array($centerB, $ah->getReachableCenters(
$userA,
- new Role('CHILL_ROLE_2'),
+ 'CHILL_ROLE_2',
null
- )),
+ ), true),
'center A should be available for userA, with role 2 ',
],
[
false,
in_array($centerB, $ah->getReachableCenters(
$userA,
- new Role('CHILL_ROLE_1'),
+ 'CHILL_ROLE_1',
null
- )),
+ ), true),
'center B should NOT be available for userA, with role 1 ',
],
// with scope
@@ -111,27 +114,27 @@ class AuthorizationHelperTest extends KernelTestCase
true,
in_array($centerA, $ah->getReachableCenters(
$userA,
- new Role('CHILL_ROLE_1'),
+ 'CHILL_ROLE_1',
$scopeB
- )),
+ ), true),
'center A should be available for userA, with role 1, scopeC ',
],
[
false,
in_array($centerA, $ah->getReachableCenters(
$userA,
- new Role('CHILL_ROLE_2'),
+ 'CHILL_ROLE_2',
$scopeC
- )),
+ ), true),
'center A should NOT be available for userA, with role 2, scopeA ',
],
[
true,
in_array($centerB, $ah->getReachableCenters(
$userA,
- new Role('CHILL_ROLE_2'),
+ 'CHILL_ROLE_2',
$scopeA
- )),
+ ), true),
'center B should be available for userA, with role 2, scopeA ',
],
];
@@ -168,7 +171,7 @@ class AuthorizationHelperTest extends KernelTestCase
true,
$scopeA,
$userA,
- new Role('CHILL_ROLE_2'),
+ 'CHILL_ROLE_2',
$centerA,
'Assert that a scope is found within accessible scopes',
],
@@ -176,7 +179,7 @@ class AuthorizationHelperTest extends KernelTestCase
false,
$scopeB,
$userA,
- new Role('CHILL_ROLE_2'),
+ 'CHILL_ROLE_2',
$centerA,
'Assert that a scope not reachable is NOT found within accessible scopes',
],
@@ -184,7 +187,7 @@ class AuthorizationHelperTest extends KernelTestCase
false,
$scopeB,
$userA,
- new Role('CHILL_ROLE_1'),
+ 'CHILL_ROLE_1',
$centerB,
'Assert that a scope not reachable is not found within accessible scopes.'
. ' Trying on filter centering',
@@ -194,18 +197,18 @@ class AuthorizationHelperTest extends KernelTestCase
public function testFindUsersReaching()
{
- $centerA = static::$kernel->getContainer()
+ $centerA = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository(Center::class)
->findOneByName('Center A');
$users = $this->getAuthorizationHelper()
->findUsersReaching(
- new Role('CHILL_PERSON_SEE'),
+ 'CHILL_PERSON_SEE',
$centerA
);
- $usernames = array_map(function (User $u) { return $u->getUsername(); }, $users);
+ $usernames = array_map(static function (User $u) { return $u->getUsername(); }, $users);
$this->assertContains('center a_social', $usernames);
}
@@ -253,7 +256,7 @@ class AuthorizationHelperTest extends KernelTestCase
$this->assertEquals(
$expectedResult,
- in_array($testedScope, $reachableScopes),
+ in_array($testedScope, $reachableScopes, true),
$message
);
}
@@ -576,7 +579,7 @@ class AuthorizationHelperTest extends KernelTestCase
*/
private function getAuthorizationHelper()
{
- return static::$container
+ return self::$container
->get('chill.main.security.authorization.helper');
}
}
diff --git a/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php
index 7c6ecd565..7083cfdc4 100644
--- a/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\PasswordRecover;
use Chill\MainBundle\Entity\User;
@@ -19,7 +21,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
* @internal
* @coversNothing
*/
-class TokenManagerTest extends KernelTestCase
+final class TokenManagerTest extends KernelTestCase
{
protected $tokenManager;
diff --git a/src/Bundle/ChillMainBundle/Tests/Security/Resolver/CenterResolverDispatcherTest.php b/src/Bundle/ChillMainBundle/Tests/Security/Resolver/CenterResolverDispatcherTest.php
index 2e020ab9a..80b01a170 100644
--- a/src/Bundle/ChillMainBundle/Tests/Security/Resolver/CenterResolverDispatcherTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Security/Resolver/CenterResolverDispatcherTest.php
@@ -20,7 +20,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
* @internal
* @coversNothing
*/
-class CenterResolverDispatcherTest extends KernelTestCase
+final class CenterResolverDispatcherTest extends KernelTestCase
{
private CenterResolverDispatcherInterface $dispatcher;
diff --git a/src/Bundle/ChillMainBundle/Tests/Security/Resolver/DefaultScopeResolverTest.php b/src/Bundle/ChillMainBundle/Tests/Security/Resolver/DefaultScopeResolverTest.php
index d7063815a..32c07b04e 100644
--- a/src/Bundle/ChillMainBundle/Tests/Security/Resolver/DefaultScopeResolverTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Security/Resolver/DefaultScopeResolverTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Security\Resolver;
use Chill\MainBundle\Entity\HasScopeInterface;
@@ -19,7 +21,7 @@ use PHPUnit\Framework\TestCase;
* @internal
* @coversNothing
*/
-class DefaultScopeResolverTest extends TestCase
+final class DefaultScopeResolverTest extends TestCase
{
private DefaultScopeResolver $scopeResolver;
diff --git a/src/Bundle/ChillMainBundle/Tests/Security/Resolver/ScopeResolverDispatcherTest.php b/src/Bundle/ChillMainBundle/Tests/Security/Resolver/ScopeResolverDispatcherTest.php
index 570138aea..320d2e326 100644
--- a/src/Bundle/ChillMainBundle/Tests/Security/Resolver/ScopeResolverDispatcherTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Security/Resolver/ScopeResolverDispatcherTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Security\Resolver;
use Chill\MainBundle\Entity\HasScopeInterface;
@@ -20,7 +22,7 @@ use PHPUnit\Framework\TestCase;
* @internal
* @coversNothing
*/
-class DefaultScopeResolverDispatcherTest extends TestCase
+final class ScopeResolverDispatcherTest extends TestCase
{
private ScopeResolverDispatcher $scopeResolverDispatcher;
diff --git a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DateNormalizerTest.php b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DateNormalizerTest.php
index 4fa58b782..fc9612299 100644
--- a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DateNormalizerTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DateNormalizerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Serializer\Normalizer;
use Chill\MainBundle\Serializer\Normalizer\DateNormalizer;
@@ -24,7 +26,7 @@ use Symfony\Component\HttpFoundation\RequestStack;
* @internal
* @coversNothing
*/
-class DateNormalizerTest extends KernelTestCase
+final class DateNormalizerTest extends KernelTestCase
{
private Prophet $prophet;
diff --git a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DoctrineExistingEntityNormalizerTest.php b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DoctrineExistingEntityNormalizerTest.php
index 57b4d44b7..b45b2c21d 100644
--- a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DoctrineExistingEntityNormalizerTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/DoctrineExistingEntityNormalizerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Serializer\Normalizer;
use Chill\MainBundle\Entity\User;
@@ -19,7 +21,7 @@ use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
* @internal
* @coversNothing
*/
-class DoctrineExistingEntityNormalizerTest extends KernelTestCase
+final class DoctrineExistingEntityNormalizerTest extends KernelTestCase
{
protected DoctrineExistingEntityNormalizer $normalizer;
diff --git a/src/Bundle/ChillMainBundle/Tests/Services/MenuComposerTest.php b/src/Bundle/ChillMainBundle/Tests/Services/MenuComposerTest.php
index d639224c6..bb98b074d 100644
--- a/src/Bundle/ChillMainBundle/Tests/Services/MenuComposerTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Services/MenuComposerTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Services;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
@@ -18,7 +20,7 @@ use Symfony\Component\Routing\RouteCollection;
* @internal
* @coversNothing
*/
-class MenuComposerTest extends KernelTestCase
+final class MenuComposerTest extends KernelTestCase
{
/**
* @var \Symfony\Bundle\FrameworkBundle\Routing\DelegatingLoader;
@@ -33,7 +35,7 @@ class MenuComposerTest extends KernelTestCase
public function setUp()
{
self::bootKernel(['environment' => 'test']);
- $this->menuComposer = static::$container
+ $this->menuComposer = self::$container
->get('chill.main.menu_composer');
}
diff --git a/src/Bundle/ChillMainBundle/Tests/Templating/ChillMarkdownRenderExtensionTest.php b/src/Bundle/ChillMainBundle/Tests/Templating/ChillMarkdownRenderExtensionTest.php
index 2ba1d03ec..89edc17d6 100644
--- a/src/Bundle/ChillMainBundle/Tests/Templating/ChillMarkdownRenderExtensionTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Templating/ChillMarkdownRenderExtensionTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Templating;
use Chill\MainBundle\Templating\ChillMarkdownRenderExtension;
@@ -20,7 +22,7 @@ use PHPUnit\Framework\TestCase;
* is safe.
* @coversNothing
*/
-class ChillMarkdownRenderExtensionTest extends TestCase
+final class ChillMarkdownRenderExtensionTest extends TestCase
{
private const SIMPLE_HTML = <<<'HTML'
test
diff --git a/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php b/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php
index 2873c04e3..c866224e3 100644
--- a/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Templating\Entity;
use Chill\MainBundle\Entity\Address;
@@ -21,7 +23,7 @@ use Symfony\Component\Templating\EngineInterface;
* @internal
* @coversNothing
*/
-class AddressRenderTest extends KernelTestCase
+final class AddressRenderTest extends KernelTestCase
{
protected function setUp()
{
diff --git a/src/Bundle/ChillMainBundle/Tests/TestHelper.php b/src/Bundle/ChillMainBundle/Tests/TestHelper.php
index 4c009ae83..205474685 100644
--- a/src/Bundle/ChillMainBundle/Tests/TestHelper.php
+++ b/src/Bundle/ChillMainBundle/Tests/TestHelper.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests;
use Symfony\Component\BrowserKit\Client;
diff --git a/src/Bundle/ChillMainBundle/Tests/Util/CountriesInfoTest.php b/src/Bundle/ChillMainBundle/Tests/Util/CountriesInfoTest.php
index 7a2209114..6fd0facd4 100644
--- a/src/Bundle/ChillMainBundle/Tests/Util/CountriesInfoTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Util/CountriesInfoTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Util;
use Chill\MainBundle\Util\CountriesInfo;
@@ -18,7 +20,7 @@ use PHPUnit\Framework\TestCase;
* @internal
* @coversNothing
*/
-class CountriesInfoTest extends TestCase
+final class CountriesInfoTest extends TestCase
{
public function getGetContinentsCodes()
{
diff --git a/src/Bundle/ChillMainBundle/Tests/Util/DateRangeCoveringTest.php b/src/Bundle/ChillMainBundle/Tests/Util/DateRangeCoveringTest.php
index b02e2ea3e..694677a8f 100644
--- a/src/Bundle/ChillMainBundle/Tests/Util/DateRangeCoveringTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Util/DateRangeCoveringTest.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Tests\Util;
use Chill\MainBundle\Util\DateRangeCovering;
@@ -19,7 +21,7 @@ use function usort;
* @internal
* @coversNothing
*/
-class DateRangeCoveringTest extends TestCase
+final class DateRangeCoveringTest extends TestCase
{
public function testCoveringWithMinCover1()
{
@@ -77,7 +79,7 @@ class DateRangeCoveringTest extends TestCase
$intersections = $cover->getIntersections();
// sort the intersections to compare them in expected order
- usort($intersections, function ($a, $b) {
+ usort($intersections, static function ($a, $b) {
if ($a[0] === $b[0]) {
return $a[1] <=> $b[1];
}
diff --git a/src/Bundle/ChillMainBundle/Tests/bootstrap.php b/src/Bundle/ChillMainBundle/Tests/bootstrap.php
index 0eb126c4f..d4e1e46fa 100644
--- a/src/Bundle/ChillMainBundle/Tests/bootstrap.php
+++ b/src/Bundle/ChillMainBundle/Tests/bootstrap.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
if (!is_file($autoloadFile = __DIR__ . '/../vendor/autoload.php')) {
throw new \LogicException('Could not find autoload.php in vendor/. Did you run "composer install --dev"?');
}
diff --git a/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php b/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php
index 644bfdf9b..c36751960 100644
--- a/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php
+++ b/src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Timeline;
use DateTime;
@@ -16,6 +18,8 @@ use Doctrine\ORM\Query;
use Doctrine\ORM\Query\ResultSetMapping;
use LogicException;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
+use function array_key_exists;
+use function is_string;
/**
* Build timeline.
diff --git a/src/Bundle/ChillMainBundle/Timeline/TimelineProviderInterface.php b/src/Bundle/ChillMainBundle/Timeline/TimelineProviderInterface.php
index dda0a2a32..98c812ef2 100644
--- a/src/Bundle/ChillMainBundle/Timeline/TimelineProviderInterface.php
+++ b/src/Bundle/ChillMainBundle/Timeline/TimelineProviderInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Timeline;
use LogicException;
diff --git a/src/Bundle/ChillMainBundle/Timeline/TimelineSingleQuery.php b/src/Bundle/ChillMainBundle/Timeline/TimelineSingleQuery.php
index 42f8cd192..23e60ef97 100644
--- a/src/Bundle/ChillMainBundle/Timeline/TimelineSingleQuery.php
+++ b/src/Bundle/ChillMainBundle/Timeline/TimelineSingleQuery.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Timeline;
use function strtr;
diff --git a/src/Bundle/ChillMainBundle/Util/CountriesInfo.php b/src/Bundle/ChillMainBundle/Util/CountriesInfo.php
index 5577e4543..05089a04f 100644
--- a/src/Bundle/ChillMainBundle/Util/CountriesInfo.php
+++ b/src/Bundle/ChillMainBundle/Util/CountriesInfo.php
@@ -7,9 +7,12 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Util;
use UnexpectedValueException;
+use function array_key_exists;
/**
* Get information about countries.
@@ -359,7 +362,7 @@ class CountriesInfo
if (null === self::$cacheCountriesCodeByContinent) {
$data = self::getArrayCountriesData();
- array_walk($data, function ($item, $key) {
+ array_walk($data, static function ($item, $key) {
self::$cacheCountriesCodeByContinent[$item[0]][] = $item[1];
});
}
diff --git a/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php b/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php
index d0165b302..07f8b14ff 100644
--- a/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php
+++ b/src/Bundle/ChillMainBundle/Util/DateRangeCovering.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Util;
use DateTimeImmutable;
@@ -20,7 +22,9 @@ use function array_key_exists;
use function array_merge;
use function array_unique;
use function array_values;
+use function count;
use function ksort;
+use const PHP_INT_MAX;
/**
* Utilities to compare date periods.
diff --git a/src/Bundle/ChillMainBundle/Validation/Constraint/PhonenumberConstraint.php b/src/Bundle/ChillMainBundle/Validation/Constraint/PhonenumberConstraint.php
index 86a53412c..27fbe2f50 100644
--- a/src/Bundle/ChillMainBundle/Validation/Constraint/PhonenumberConstraint.php
+++ b/src/Bundle/ChillMainBundle/Validation/Constraint/PhonenumberConstraint.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Validation\Constraint;
use Symfony\Component\Validator\Constraint;
diff --git a/src/Bundle/ChillMainBundle/Validation/Constraint/RoleScopeScopePresenceConstraint.php b/src/Bundle/ChillMainBundle/Validation/Constraint/RoleScopeScopePresenceConstraint.php
index 4e576db74..fe61d4655 100644
--- a/src/Bundle/ChillMainBundle/Validation/Constraint/RoleScopeScopePresenceConstraint.php
+++ b/src/Bundle/ChillMainBundle/Validation/Constraint/RoleScopeScopePresenceConstraint.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Validation\Constraint;
use Symfony\Component\Validator\Constraint;
diff --git a/src/Bundle/ChillMainBundle/Validation/Constraint/UserUniqueEmailAndUsernameConstraint.php b/src/Bundle/ChillMainBundle/Validation/Constraint/UserUniqueEmailAndUsernameConstraint.php
index 3944d3ac2..4b2a5d5b4 100644
--- a/src/Bundle/ChillMainBundle/Validation/Constraint/UserUniqueEmailAndUsernameConstraint.php
+++ b/src/Bundle/ChillMainBundle/Validation/Constraint/UserUniqueEmailAndUsernameConstraint.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Validation\Constraint;
use Chill\MainBundle\Validation\Validator\UserUniqueEmailAndUsername;
diff --git a/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php b/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php
index 09c03f3ef..20abb8907 100644
--- a/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php
+++ b/src/Bundle/ChillMainBundle/Validation/Validator/RoleScopeScopePresence.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Validation\Validator;
use Chill\MainBundle\Entity\RoleScope;
@@ -17,6 +19,7 @@ use RuntimeException;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
+use function in_array;
class RoleScopeScopePresence extends ConstraintValidator
{
@@ -59,7 +62,7 @@ class RoleScopeScopePresence extends ConstraintValidator
//if the role scope should have a scope
if (
- !in_array($value->getRole(), $this->roleProvider->getRolesWithoutScopes())
+ !in_array($value->getRole(), $this->roleProvider->getRolesWithoutScopes(), true)
&& $value->getScope() === null
) {
$this->context->buildViolation($constraint->messagePresenceRequired)
@@ -68,8 +71,8 @@ class RoleScopeScopePresence extends ConstraintValidator
$this->logger->debug('the role scope should have a scope, but scope is null. Violation build.');
} elseif // if the scope should be null
(
- in_array($value->getRole(), $this->roleProvider->getRolesWithoutScopes())
- && !is_null($value->getScope())
+ in_array($value->getRole(), $this->roleProvider->getRolesWithoutScopes(), true)
+ && null !== $value->getScope()
) {
$this->context->buildViolation($constraint->messageNullRequired)
->setParameter('%role%', $this->translator->trans($value->getRole()))
diff --git a/src/Bundle/ChillMainBundle/Validation/Validator/UserUniqueEmailAndUsername.php b/src/Bundle/ChillMainBundle/Validation/Validator/UserUniqueEmailAndUsername.php
index 3d38889d9..4ece73852 100644
--- a/src/Bundle/ChillMainBundle/Validation/Validator/UserUniqueEmailAndUsername.php
+++ b/src/Bundle/ChillMainBundle/Validation/Validator/UserUniqueEmailAndUsername.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Validation\Validator;
use Chill\MainBundle\Entity\User;
diff --git a/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php b/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php
index d5346090e..5f2a5bf14 100644
--- a/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php
+++ b/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Validation\Validator;
use Chill\MainBundle\Phonenumber\PhonenumberHelper;
diff --git a/src/Bundle/ChillMainBundle/Validator/Constraints/Entity/UserCircleConsistency.php b/src/Bundle/ChillMainBundle/Validator/Constraints/Entity/UserCircleConsistency.php
index 181f32c81..8b405db6a 100644
--- a/src/Bundle/ChillMainBundle/Validator/Constraints/Entity/UserCircleConsistency.php
+++ b/src/Bundle/ChillMainBundle/Validator/Constraints/Entity/UserCircleConsistency.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Validator\Constraints\Entity;
use Symfony\Component\Validator\Constraint;
diff --git a/src/Bundle/ChillMainBundle/Validator/Constraints/Entity/UserCircleConsistencyValidator.php b/src/Bundle/ChillMainBundle/Validator/Constraints/Entity/UserCircleConsistencyValidator.php
index 3c8652fed..5cc283d95 100644
--- a/src/Bundle/ChillMainBundle/Validator/Constraints/Entity/UserCircleConsistencyValidator.php
+++ b/src/Bundle/ChillMainBundle/Validator/Constraints/Entity/UserCircleConsistencyValidator.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Validator\Constraints\Entity;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
@@ -32,7 +34,7 @@ class UserCircleConsistencyValidator extends ConstraintValidator
*/
public function validate($value, Constraint $constraint)
{
- /* @var $user \Chill\MainBundle\Entity\User */
+ /** @var \Chill\MainBundle\Entity\User $user */
$user = call_user_func([$value, $constraint->getUserFunction]);
if (null === $user) {
diff --git a/src/Bundle/ChillMainBundle/Validator/Constraints/Export/ExportElementConstraint.php b/src/Bundle/ChillMainBundle/Validator/Constraints/Export/ExportElementConstraint.php
index f2be41ddb..88378e9ce 100644
--- a/src/Bundle/ChillMainBundle/Validator/Constraints/Export/ExportElementConstraint.php
+++ b/src/Bundle/ChillMainBundle/Validator/Constraints/Export/ExportElementConstraint.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Validator\Constraints\Export;
use Symfony\Component\Validator\Constraint;
diff --git a/src/Bundle/ChillMainBundle/Validator/Constraints/Export/ExportElementConstraintValidator.php b/src/Bundle/ChillMainBundle/Validator/Constraints/Export/ExportElementConstraintValidator.php
index af1fb68f6..f395008d7 100644
--- a/src/Bundle/ChillMainBundle/Validator/Constraints/Export/ExportElementConstraintValidator.php
+++ b/src/Bundle/ChillMainBundle/Validator/Constraints/Export/ExportElementConstraintValidator.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\MainBundle\Validator\Constraints\Export;
use Chill\MainBundle\Export\ExportElementValidatedInterface;
diff --git a/src/Bundle/ChillMainBundle/migrations/Version20141128194409.php b/src/Bundle/ChillMainBundle/migrations/Version20141128194409.php
index 900712c0d..37de9c102 100644
--- a/src/Bundle/ChillMainBundle/migrations/Version20141128194409.php
+++ b/src/Bundle/ChillMainBundle/migrations/Version20141128194409.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\Migrations\Main;
use Doctrine\DBAL\Schema\Schema;
diff --git a/src/Bundle/ChillMainBundle/migrations/Version20150821105642.php b/src/Bundle/ChillMainBundle/migrations/Version20150821105642.php
index 846922d8f..910a6b028 100644
--- a/src/Bundle/ChillMainBundle/migrations/Version20150821105642.php
+++ b/src/Bundle/ChillMainBundle/migrations/Version20150821105642.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\Migrations\Main;
use Doctrine\DBAL\Schema\Schema;
@@ -14,6 +16,7 @@ use Doctrine\Migrations\AbstractMigration;
use Doctrine\ORM\Query\ResultSetMapping;
use RuntimeException;
use Symfony\Component\DependencyInjection\ContainerInterface;
+use function count;
/**
* Migrate association from
@@ -32,7 +35,7 @@ class Version20150821105642 extends AbstractMigration implements \Symfony\Compon
public function down(Schema $schema): void
{
- $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
+ $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE group_centers DROP CONSTRAINT FK_A14D8F3D447BBB3B');
$this->addSql('DROP INDEX IDX_A14D8F3D447BBB3B');
@@ -134,7 +137,7 @@ class Version20150821105642 extends AbstractMigration implements \Symfony\Compon
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
- $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
+ $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE group_centers ADD permissionsGroup_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE group_centers ADD CONSTRAINT FK_A14D8F3D447BBB3B FOREIGN KEY (permissionsGroup_id) REFERENCES permission_groups (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
diff --git a/src/Bundle/ChillMainBundle/migrations/Version20150821122935.php b/src/Bundle/ChillMainBundle/migrations/Version20150821122935.php
index dce99a7a2..500ac9de4 100644
--- a/src/Bundle/ChillMainBundle/migrations/Version20150821122935.php
+++ b/src/Bundle/ChillMainBundle/migrations/Version20150821122935.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\Migrations\Main;
use Doctrine\DBAL\Schema\Schema;
diff --git a/src/Bundle/ChillMainBundle/migrations/Version20160310122322.php b/src/Bundle/ChillMainBundle/migrations/Version20160310122322.php
index 100be7151..d1a8a31d1 100644
--- a/src/Bundle/ChillMainBundle/migrations/Version20160310122322.php
+++ b/src/Bundle/ChillMainBundle/migrations/Version20160310122322.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\Migrations\Main;
use Doctrine\DBAL\Schema\Schema;
@@ -19,7 +21,7 @@ class Version20160310122322 extends AbstractMigration
{
public function down(Schema $schema): void
{
- $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
+ $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE chill_main_address '
. 'DROP CONSTRAINT FK_165051F6EECBFDF1');
@@ -31,7 +33,7 @@ class Version20160310122322 extends AbstractMigration
public function up(Schema $schema): void
{
- $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
+ $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE SEQUENCE chill_main_address_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE chill_main_postal_code_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
diff --git a/src/Bundle/ChillMainBundle/migrations/Version20180709181423.php b/src/Bundle/ChillMainBundle/migrations/Version20180709181423.php
index fe1b65a30..7771756a7 100644
--- a/src/Bundle/ChillMainBundle/migrations/Version20180709181423.php
+++ b/src/Bundle/ChillMainBundle/migrations/Version20180709181423.php
@@ -68,7 +68,7 @@ final class Version20180709181423 extends AbstractMigration
CREATE TRIGGER canonicalize_user_on_update
AFTER UPDATE
ON users
- FOR EACH ROW
+ FOR EACH ROW
EXECUTE PROCEDURE canonicalize_user_on_update();
SQL
);
@@ -91,7 +91,7 @@ final class Version20180709181423 extends AbstractMigration
CREATE TRIGGER canonicalize_user_on_insert
AFTER INSERT
ON users
- FOR EACH ROW
+ FOR EACH ROW
EXECUTE PROCEDURE canonicalize_user_on_insert();
SQL
);
diff --git a/src/Bundle/ChillMainBundle/migrations/Version20180911093642.php b/src/Bundle/ChillMainBundle/migrations/Version20180911093642.php
index 7582acdf5..86e5585e3 100644
--- a/src/Bundle/ChillMainBundle/migrations/Version20180911093642.php
+++ b/src/Bundle/ChillMainBundle/migrations/Version20180911093642.php
@@ -28,7 +28,7 @@ final class Version20180911093642 extends AbstractMigration
CREATE TRIGGER canonicalize_user_on_update
AFTER UPDATE
ON users
- FOR EACH ROW
+ FOR EACH ROW
EXECUTE PROCEDURE canonicalize_user_on_update();
SQL
);
@@ -43,7 +43,7 @@ final class Version20180911093642 extends AbstractMigration
CREATE TRIGGER canonicalize_user_on_update
AFTER UPDATE
ON users
- FOR EACH ROW
+ FOR EACH ROW
WHEN (pg_trigger_depth() = 0)
EXECUTE PROCEDURE canonicalize_user_on_update();
SQL
diff --git a/src/Bundle/ChillMainBundle/migrations/Version20211123093355.php b/src/Bundle/ChillMainBundle/migrations/Version20211123093355.php
new file mode 100644
index 000000000..b6618d25e
--- /dev/null
+++ b/src/Bundle/ChillMainBundle/migrations/Version20211123093355.php
@@ -0,0 +1,38 @@
+addSql('DROP INDEX UNIQ_A459B5CADD3E4105');
+ $this->addSql('ALTER TABLE chill_main_location_type DROP defaultFor');
+ }
+
+ public function getDescription(): string
+ {
+ return 'Add defaultFor to LocationType';
+ }
+
+ public function up(Schema $schema): void
+ {
+ $this->addSql('ALTER TABLE chill_main_location_type ADD defaultFor VARCHAR(32) DEFAULT NULL');
+ $this->addSql('CREATE UNIQUE INDEX UNIQ_A459B5CADD3E4105 ON chill_main_location_type (defaultFor)');
+ }
+}
diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml
index 210227fbe..78363d080 100644
--- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml
+++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml
@@ -212,9 +212,14 @@ Location type: Type de localisation
Phonenumber1: Numéro de téléphone
Phonenumber2: Autre numéro de téléphone
Configure location and location type: Configuration des localisations
+Default for: Type de localisation par défaut pour
+none: aucun
+person: usager
+thirdparty: tiers
# circles / scopes
Choose the circle: Choisir le cercle
+Scopes: Services
#export
diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodLinkedWithSocialIssuesEntityInterface.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodLinkedWithSocialIssuesEntityInterface.php
index c281ff087..566e05440 100644
--- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodLinkedWithSocialIssuesEntityInterface.php
+++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodLinkedWithSocialIssuesEntityInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodSocialIssueConsistencyEntityListener.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodSocialIssueConsistencyEntityListener.php
index 007e445d9..05d25104e 100644
--- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodSocialIssueConsistencyEntityListener.php
+++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/SocialIssueConsistency/AccompanyingPeriodSocialIssueConsistencyEntityListener.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Suggestion/ReferralsSuggestion.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Suggestion/ReferralsSuggestion.php
index 7f484d807..552a7a879 100644
--- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Suggestion/ReferralsSuggestion.php
+++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Suggestion/ReferralsSuggestion.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\AccompanyingPeriod\Suggestion;
use Chill\MainBundle\Entity\User;
diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Suggestion/ReferralsSuggestionInterface.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Suggestion/ReferralsSuggestionInterface.php
index 84c0f90cc..2abf4ce40 100644
--- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Suggestion/ReferralsSuggestionInterface.php
+++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Suggestion/ReferralsSuggestionInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\AccompanyingPeriod\Suggestion;
use Chill\MainBundle\Entity\User;
diff --git a/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php b/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php
index da0071b09..92306dd05 100644
--- a/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php
+++ b/src/Bundle/ChillPersonBundle/Actions/ActionEvent.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Actions;
use Symfony\Component\EventDispatcher\Event;
diff --git a/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php b/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php
index afd844610..930b96e07 100644
--- a/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php
+++ b/src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Actions\Remove;
use Chill\PersonBundle\Actions\ActionEvent;
@@ -82,7 +84,7 @@ class PersonMove
foreach ($metadata->getAssociationMappings() as $field => $mapping) {
if (Person::class === $mapping['targetEntity']) {
- if (in_array($metadata->getName(), $toDelete)) {
+ if (in_array($metadata->getName(), $toDelete, true)) {
$sql = $this->createDeleteSQL($metadata, $from, $field);
$event = new ActionEvent(
$from->getId(),
@@ -127,7 +129,7 @@ class PersonMove
$conditions[] = sprintf('%s = %d', $columns['name'], $from->getId());
}
- return \sprintf(
+ return sprintf(
'DELETE FROM %s WHERE %s',
$this->getTableName($metadata),
implode(' AND ', $conditions)
@@ -151,7 +153,7 @@ class PersonMove
$conditions[] = sprintf('%s = %d', $columns['name'], $from->getId());
}
- return \sprintf(
+ return sprintf(
'UPDATE %s SET %s WHERE %s',
$this->getTableName($metadata),
implode(' ', $sets),
diff --git a/src/Bundle/ChillPersonBundle/CRUD/Controller/EntityPersonCRUDController.php b/src/Bundle/ChillPersonBundle/CRUD/Controller/EntityPersonCRUDController.php
index d3c9669e0..d3de0bd3d 100644
--- a/src/Bundle/ChillPersonBundle/CRUD/Controller/EntityPersonCRUDController.php
+++ b/src/Bundle/ChillPersonBundle/CRUD/Controller/EntityPersonCRUDController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\CRUD\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
diff --git a/src/Bundle/ChillPersonBundle/ChillPersonBundle.php b/src/Bundle/ChillPersonBundle/ChillPersonBundle.php
index 6041fa7ed..4e73d2137 100644
--- a/src/Bundle/ChillPersonBundle/ChillPersonBundle.php
+++ b/src/Bundle/ChillPersonBundle/ChillPersonBundle.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle;
use Chill\PersonBundle\DependencyInjection\CompilerPass\AccompanyingPeriodTimelineCompilerPass;
diff --git a/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php b/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php
index d45522871..3af14fb0b 100644
--- a/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php
+++ b/src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Command;
use Chill\PersonBundle\Actions\Remove\PersonMove;
diff --git a/src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php b/src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
index e0ba03194..d3500acd6 100644
--- a/src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
+++ b/src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Command;
use Chill\CustomFieldsBundle\Service\CustomFieldProvider;
@@ -38,8 +40,14 @@ use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\FormFactoryInterface;
use function array_key_exists;
+use function count;
use function file_get_contents;
+use function get_class;
+use function in_array;
+use function is_array;
use function json_decode;
+use const JSON_PRETTY_PRINT;
+use const LC_TIME;
final class ImportPeopleFromCSVCommand extends Command
{
@@ -267,7 +275,7 @@ final class ImportPeopleFromCSVCommand extends Command
protected function createPerson(array $row, array $headers): Person
{
// trying to get the opening date
- $openingDateString = trim($row[array_search('opening_date', $headers)]);
+ $openingDateString = trim($row[array_search('opening_date', $headers, true)]);
$openingDate = $this->processDate($openingDateString, $this->input->getOption('opening_date_format'));
// @TODO: Fix the constructor parameter, $openingDate does not exists.
@@ -352,7 +360,7 @@ final class ImportPeopleFromCSVCommand extends Command
}
// handle address
- if (\in_array('postalcode', $headers)) {
+ if (in_array('postalcode', $headers, true)) {
if (!empty($postalCodeValue)) {
$address = new Address();
$postalCode = $this->guessPostalCode($postalCodeValue, $localityValue ?? '');
@@ -363,7 +371,7 @@ final class ImportPeopleFromCSVCommand extends Command
$address->setPostcode($postalCode);
- if (\in_array('street1', $headers)) {
+ if (in_array('street1', $headers, true)) {
$address->setStreetAddress1($street1Value);
}
$address->setValidFrom(new DateTime('today'));
@@ -475,7 +483,7 @@ final class ImportPeopleFromCSVCommand extends Command
return $this->em->getRepository(Center::class)->find($this->input->getOption('force-center'));
}
- $columnCenter = array_search('center', $headers);
+ $columnCenter = array_search('center', $headers, true);
$centerName = trim($row[$columnCenter]);
try {
@@ -516,13 +524,13 @@ final class ImportPeopleFromCSVCommand extends Command
->getResult();
if (count($centers) > 1) {
- if (\strtolower($centers[0]->getName()) === \strtolower($centerName)) {
+ if (strtolower($centers[0]->getName()) === strtolower($centerName)) {
return $centers[0];
}
}
$centersByName = [];
- $names = \array_map(function (Center $c) use (&$centersByName) {
+ $names = array_map(static function (Center $c) use (&$centersByName) {
$n = $c->getName();
$centersByName[$n] = $c;
@@ -605,7 +613,7 @@ final class ImportPeopleFromCSVCommand extends Command
}
$postalCodeByName = [];
- $names = \array_map(function (PostalCode $pc) use (&$postalCodeByName) {
+ $names = array_map(static function (PostalCode $pc) use (&$postalCodeByName) {
$n = $pc->getName();
$postalCodeByName[$n] = $pc;
@@ -693,7 +701,7 @@ final class ImportPeopleFromCSVCommand extends Command
protected function matchColumnToCustomField($row)
{
$cfMappingsOptions = $this->input->getOption('custom-field');
- /* @var $em \Doctrine\Persistence\ObjectManager */
+ /** @var \Doctrine\Persistence\ObjectManager $em */
$em = $this->em;
foreach ($cfMappingsOptions as $cfMappingStringOption) {
@@ -767,9 +775,9 @@ final class ImportPeopleFromCSVCommand extends Command
. 'have the right to read it.');
}
- $resource = fopen($filename, 'r');
+ $resource = fopen($filename, 'rb');
- if (false == $resource) {
+ if (false === $resource) {
throw new RuntimeException("The file '{$filename}' could not be opened.");
}
@@ -855,7 +863,7 @@ final class ImportPeopleFromCSVCommand extends Command
if (!isset($this->cacheAnswersMapping[$cf->getSlug()][$value])) {
// try to find the answer (with array_keys and a search value
$values = array_keys(
- array_map(function ($label) { return trim(strtolower($label)); }, $answers),
+ array_map(static function ($label) { return trim(strtolower($label)); }, $answers),
trim(strtolower($value)),
true
);
@@ -864,7 +872,7 @@ final class ImportPeopleFromCSVCommand extends Command
// we could guess an answer !
$this->logger->info('This question accept multiple answers');
$this->cacheAnswersMapping[$cf->getSlug()][$value] =
- false == $view->vars['multiple'] ? $values[0] : [$values[0]];
+ false === $view->vars['multiple'] ? $values[0] : [$values[0]];
$this->logger->info(sprintf(
"Guessed that value '%s' match with key '%s' "
. 'because the CSV and the label are equals.',
@@ -877,7 +885,7 @@ final class ImportPeopleFromCSVCommand extends Command
$this->output->writeln($this->helper->localize($cf->getName()));
// printing the possible answers
- /* @var $table \Symfony\Component\Console\Helper\Table */
+ /** @var \Symfony\Component\Console\Helper\Table $table */
$table = new Table($this->output);
$table->setHeaders(['#', 'label', 'value']);
$i = 0;
@@ -954,7 +962,7 @@ final class ImportPeopleFromCSVCommand extends Command
}
// we skip if the opening date is now (or after yesterday)
- /* @var $period \Chill\PersonBundle\Entity\AccompanyingPeriod */
+ /** @var \Chill\PersonBundle\Entity\AccompanyingPeriod $period */
$period = $person->getCurrentAccompanyingPeriod();
if ($period->getOpeningDate() > new DateTime('yesterday')) {
@@ -1037,11 +1045,11 @@ final class ImportPeopleFromCSVCommand extends Command
*/
protected function processingCustomFields(Person $person, $row)
{
- /* @var $cfProvider \Chill\CustomFieldsBundle\Service\CustomFieldProvider */
+ /** @var \Chill\CustomFieldsBundle\Service\CustomFieldProvider $cfProvider */
$cfProvider = $this->customFieldProvider;
$cfData = [];
- /* @var $$customField \Chill\CustomFieldsBundle\Entity\CustomField */
+ /** @var \Chill\CustomFieldsBundle\Entity\CustomField $$customField */
foreach ($this->customFieldMapping as $rowNumber => $customField) {
$builder = $this->formFactory->createBuilder();
$cfProvider->getCustomFieldByType($customField->getType())
@@ -1091,8 +1099,8 @@ final class ImportPeopleFromCSVCommand extends Command
foreach ($firstRow as $key => $content) {
$content = trim($content);
- if (in_array($content, $matchedColumnHeaders)) {
- $information = array_search($content, $matchedColumnHeaders);
+ if (in_array($content, $matchedColumnHeaders, true)) {
+ $information = array_search($content, $matchedColumnHeaders, true);
$headers[$key] = $information;
$this->logger->notice("Matched {$information} on column {$key} (displayed in the file as '{$content}')");
} else {
@@ -1139,7 +1147,7 @@ final class ImportPeopleFromCSVCommand extends Command
{
$answers = [];
- /* @var $choice \Symfony\Component\Form\ChoiceList\View\ChoiceView */
+ /** @var \Symfony\Component\Form\ChoiceList\View\ChoiceView $choice */
foreach ($choices as $choice) {
if ($choice instanceof \Symfony\Component\Form\ChoiceList\View\ChoiceView) {
$answers[$choice->value] = $choice->label;
diff --git a/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php b/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php
index dfbce37a7..ae291067b 100644
--- a/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php
+++ b/src/Bundle/ChillPersonBundle/Config/ConfigPersonAltNamesHelper.php
@@ -7,8 +7,12 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Config;
+use function count;
+
/**
* Give help to interact with the config for alt names.
*/
diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php
index 7c19864bd..43276c949 100644
--- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
@@ -35,6 +37,7 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Symfony\Component\Workflow\Registry;
use function array_values;
+use function count;
final class AccompanyingCourseApiController extends ApiController
{
@@ -249,6 +252,22 @@ final class AccompanyingCourseApiController extends ApiController
);
}
+ /**
+ * @Route("/api/1.0/person/accompanying-course/{id}/confidential.json", name="chill_api_person_accompanying_period_confidential")
+ * @ParamConverter("accompanyingCourse", options={"id": "id"})
+ */
+ public function toggleConfidentialApi(AccompanyingPeriod $accompanyingCourse, Request $request)
+ {
+ if ($request->getMethod() === 'POST') {
+ $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::TOGGLE_CONFIDENTIAL, $accompanyingCourse);
+
+ $accompanyingCourse->setConfidential(!$accompanyingCourse->isConfidential());
+ $this->getDoctrine()->getManager()->flush();
+ }
+
+ return $this->json($accompanyingCourse->isConfidential(), Response::HTTP_OK, [], ['groups' => ['read']]);
+ }
+
public function workApi($id, Request $request, string $_format): Response
{
return $this->addRemoveSomething(
diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php
index 7af13ccd4..7d0e841cf 100644
--- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\ActivityBundle\Entity\Activity;
diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php
index 5383305ce..95cbaf023 100644
--- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkApiController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php
index bb85036a9..1da7424bf 100644
--- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\Pagination\PaginatorFactory;
diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php
index 55b18381e..bfc85a5b3 100644
--- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
@@ -26,6 +28,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Validator\ConstraintViolationListInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use function array_filter;
+use function count;
/**
* Class AccompanyingPeriodController.
@@ -318,10 +321,10 @@ class AccompanyingPeriodController extends AbstractController
/** @var Person $person */
$person = $this->_getPerson($person_id);
- /* @var $period AccompanyingPeriod */
+ /** @var AccompanyingPeriod $period */
$period = array_filter(
$person->getAccompanyingPeriods(),
- function (AccompanyingPeriod $p) use ($period_id) {
+ static function (AccompanyingPeriod $p) use ($period_id) {
return $p->getId() === ($period_id);
}
)[0] ?? null;
diff --git a/src/Bundle/ChillPersonBundle/Controller/AdminClosingMotiveController.php b/src/Bundle/ChillPersonBundle/Controller/AdminClosingMotiveController.php
index ac3ef7506..9eee2c4a0 100644
--- a/src/Bundle/ChillPersonBundle/Controller/AdminClosingMotiveController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/AdminClosingMotiveController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
diff --git a/src/Bundle/ChillPersonBundle/Controller/AdminController.php b/src/Bundle/ChillPersonBundle/Controller/AdminController.php
index 4496fc5a8..9d16bdc13 100644
--- a/src/Bundle/ChillPersonBundle/Controller/AdminController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/AdminController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
diff --git a/src/Bundle/ChillPersonBundle/Controller/AdminMaritalStatusController.php b/src/Bundle/ChillPersonBundle/Controller/AdminMaritalStatusController.php
index 4f0402402..d27ebe2e8 100644
--- a/src/Bundle/ChillPersonBundle/Controller/AdminMaritalStatusController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/AdminMaritalStatusController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php
index fcad908a5..62f4fc68f 100644
--- a/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
@@ -106,7 +108,7 @@ class HouseholdApiController extends ApiController
$actual = $household->getCurrentAddress();
if (null !== $actual) {
- $addresses = array_filter($addresses, fn ($a) => $a !== $actual);
+ $addresses = array_filter($addresses, static fn ($a) => $a !== $actual);
}
return $this->json(
@@ -141,7 +143,7 @@ class HouseholdApiController extends ApiController
foreach ($allHouseholds as $h) {
if ($h !== $currentHouseholdPerson) {
- array_push($households, $h);
+ $households[] = $h;
}
}
diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php
index 6bba9223d..6ce73d508 100644
--- a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\Entity\Address;
@@ -23,6 +25,8 @@ use Symfony\Component\Security\Core\Security;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Component\Translation\TranslatorInterface;
+use function array_key_exists;
+use function count;
/**
* @Route("/{_locale}/person/household")
@@ -144,7 +148,7 @@ class HouseholdController extends AbstractController
$cond = true;
for ($i = 0; count($addresses) - 1 > $i; ++$i) {
- if ($addresses[$i]->getValidFrom() != $addresses[$i + 1]->getValidTo()) {
+ if ($addresses[$i]->getValidFrom() !== $addresses[$i + 1]->getValidTo()) {
$cond = false;
}
}
@@ -192,7 +196,7 @@ class HouseholdController extends AbstractController
$form->handleRequest($request);
- if ($form->isSubmitted() and $form->isValid()) {
+ if ($form->isSubmitted() && $form->isValid()) {
$this->getDoctrine()->getManager()->flush();
$this->addFlash('success', $this->translator->trans('household.data_saved'));
diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php
index 01f72ceb1..802f9fd6c 100644
--- a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
@@ -25,6 +27,7 @@ use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Serializer\Exception;
use Symfony\Component\Translation\TranslatorInterface;
+use function count;
class HouseholdMemberController extends ApiController
{
@@ -183,7 +186,7 @@ class HouseholdMemberController extends ApiController
$_format,
['groups' => ['read']]
);
- } catch (Exception\InvalidArgumentException | Exception\UnexpectedValueException $e) {
+ } catch (Exception\InvalidArgumentException|Exception\UnexpectedValueException $e) {
throw new BadRequestException("Deserialization error: {$e->getMessage()}", 45896, $e);
}
diff --git a/src/Bundle/ChillPersonBundle/Controller/OpeningApiController.php b/src/Bundle/ChillPersonBundle/Controller/OpeningApiController.php
index 78f85b952..e62c0c123 100644
--- a/src/Bundle/ChillPersonBundle/Controller/OpeningApiController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/OpeningApiController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php
index 684a04b0d..d387ff737 100644
--- a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\Entity\Address;
@@ -16,6 +18,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Validator\Validator\ValidatorInterface;
+use function count;
/**
* Class PersonAddressController
@@ -190,7 +193,7 @@ class PersonAddressController extends AbstractController
$form = $this->createEditForm($person, $address);
$form->handleRequest($request);
- if ($form->isSubmitted() and $form->isValid()) {
+ if ($form->isSubmitted() && $form->isValid()) {
$validatePersonErrors = $this->validatePerson($person);
if (count($validatePersonErrors) !== 0) {
diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php
index 61da76c18..23f6ec95d 100644
--- a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
@@ -62,7 +64,7 @@ class PersonApiController extends ApiController
$actual = $person->getCurrentHouseholdAddress();
if (null !== $actual) {
- $addresses = array_filter($addresses, fn ($a) => $a !== $actual);
+ $addresses = array_filter($addresses, static fn ($a) => $a !== $actual);
}
return $this->json(array_values($addresses), Response::HTTP_OK, [], ['groups' => ['read']]);
diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonController.php b/src/Bundle/ChillPersonBundle/Controller/PersonController.php
index 82ab0a30f..6247b92bb 100644
--- a/src/Bundle/ChillPersonBundle/Controller/PersonController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/PersonController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
@@ -30,6 +32,7 @@ use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
+use function count;
use function hash;
use function implode;
use function in_array;
@@ -360,7 +363,7 @@ final class PersonController extends AbstractController
$ignoredFields = ['form_status', '_token'];
foreach ($request->request->all()[$form->getName()] as $field => $value) {
- if (in_array($field, $ignoredFields)) {
+ if (in_array($field, $ignoredFields, true)) {
continue;
}
$fields[$field] = is_array($value) ?
diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php
index d1d9338aa..0b3f36b1c 100644
--- a/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/PersonDuplicateController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\ActivityBundle\Entity\Activity;
@@ -27,6 +29,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Translation\TranslatorInterface;
+use function count;
class PersonDuplicateController extends Controller
{
diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php
index 398d352d7..d154c8e2e 100644
--- a/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/SocialIssueApiController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminEvaluationController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminEvaluationController.php
index 272ef02e4..8105066e9 100644
--- a/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminEvaluationController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminEvaluationController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller\SocialWork;
use Chill\MainBundle\CRUD\Controller\CRUDController;
diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminGoalController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminGoalController.php
index 14225f812..149d3c372 100644
--- a/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminGoalController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminGoalController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller\SocialWork;
use Chill\MainBundle\CRUD\Controller\CRUDController;
diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminResultController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminResultController.php
index 2500d87cd..98ea9592a 100644
--- a/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminResultController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminResultController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller\SocialWork;
use Chill\MainBundle\CRUD\Controller\CRUDController;
diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminSocialActionController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminSocialActionController.php
index d83fe2c1f..c254f8178 100644
--- a/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminSocialActionController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminSocialActionController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller\SocialWork;
use Chill\MainBundle\CRUD\Controller\CRUDController;
diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminSocialIssueController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminSocialIssueController.php
index b07c95c95..f783ab182 100644
--- a/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminSocialIssueController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/SocialWork/AdminSocialIssueController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller\SocialWork;
use Chill\MainBundle\CRUD\Controller\CRUDController;
diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php
index 019dff4d7..98b40311d 100644
--- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkEvaluationApiController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\Pagination\PaginatorFactory;
diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php
index 575d493ee..a9d1238da 100644
--- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkGoalApiController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php
index 17d7181c5..3ce3848fd 100644
--- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkResultApiController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
diff --git a/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php b/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php
index 8a607f111..24c1c6645 100644
--- a/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
@@ -15,6 +17,7 @@ use Chill\MainBundle\Serializer\Model\Collection;
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
+use function count;
class SocialWorkSocialActionApiController extends ApiController
{
diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/Helper/PersonRandomHelper.php b/src/Bundle/ChillPersonBundle/DataFixtures/Helper/PersonRandomHelper.php
index d3872a64b..4f5a51fd4 100644
--- a/src/Bundle/ChillPersonBundle/DataFixtures/Helper/PersonRandomHelper.php
+++ b/src/Bundle/ChillPersonBundle/DataFixtures/Helper/PersonRandomHelper.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\DataFixtures\Helper;
use Chill\PersonBundle\Entity\Person;
diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/Helper/RandomPersonHelperTrait.php b/src/Bundle/ChillPersonBundle/DataFixtures/Helper/RandomPersonHelperTrait.php
index b0a337374..516914f5f 100644
--- a/src/Bundle/ChillPersonBundle/DataFixtures/Helper/RandomPersonHelperTrait.php
+++ b/src/Bundle/ChillPersonBundle/DataFixtures/Helper/RandomPersonHelperTrait.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\DataFixtures\Helper;
use Chill\PersonBundle\Entity\Person;
diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodClosingMotive.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodClosingMotive.php
index e105e15e7..c1d045ac4 100644
--- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodClosingMotive.php
+++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodClosingMotive.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\DataFixtures\ORM;
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodNotifications.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodNotifications.php
index 3db1c264f..1e392c9f2 100644
--- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodNotifications.php
+++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodNotifications.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\DataFixtures\ORM;
use Chill\MainBundle\DataFixtures\ORM\LoadAbstractNotificationsTrait;
diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodOrigin.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodOrigin.php
index 1834a1e73..be352aa9b 100644
--- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodOrigin.php
+++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodOrigin.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\DataFixtures\ORM;
use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin;
diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php
index 6b98ff574..64c7d2701 100644
--- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php
+++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadAccompanyingPeriodWork.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\DataFixtures\ORM;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
@@ -19,6 +21,7 @@ use DateTimeImmutable;
use Doctrine\Persistence\ObjectManager;
use function array_pop;
use function array_rand;
+use function count;
class LoadAccompanyingPeriodWork extends \Doctrine\Bundle\FixturesBundle\Fixture implements \Doctrine\Common\DataFixtures\DependentFixtureInterface
{
diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php
index 1c51e45c3..9541aa76b 100644
--- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php
+++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\DataFixtures\ORM;
use Chill\CustomFieldsBundle\CustomFields\CustomFieldChoice;
@@ -26,8 +28,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class LoadCustomFields extends AbstractFixture implements
- OrderedFixtureInterface,
- ContainerAwareInterface
+ ContainerAwareInterface,
+ OrderedFixtureInterface
{
/**
* @var ContainerInterface
@@ -113,7 +115,7 @@ class LoadCustomFields extends AbstractFixture implements
// get possible values for cfGroup
$choices = array_map(
- function ($a) { return $a['slug']; },
+ static function ($a) { return $a['slug']; },
$this->customFieldChoice->getOptions()['choices']
);
// create faker
@@ -121,12 +123,12 @@ class LoadCustomFields extends AbstractFixture implements
// select a set of people and add data
foreach ($personIds as $id) {
// add info on 1 person on 2
- if (rand(0, 1) === 1) {
- /* @var $person Person */
+ if (mt_rand(0, 1) === 1) {
+ /** @var Person $person */
$person = $manager->getRepository(Person::class)->find($id);
$person->setCFData([
'remarques' => $this->createCustomFieldText()
- ->serialize($faker->text(rand(150, 250)), $this->customFieldText),
+ ->serialize($faker->text(mt_rand(150, 250)), $this->customFieldText),
'document-d-identite' => $this->createCustomFieldChoice()
->serialize([$choices[array_rand($choices)]], $this->customFieldChoice),
]);
diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHouseholdPosition.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHouseholdPosition.php
index e12c88332..42d2b7dd8 100644
--- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHouseholdPosition.php
+++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHouseholdPosition.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\DataFixtures\ORM;
use Chill\PersonBundle\Entity\Household\Position;
diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadMaritalStatus.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadMaritalStatus.php
index 65d428436..45a9f6fd4 100644
--- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadMaritalStatus.php
+++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadMaritalStatus.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\DataFixtures\ORM;
use Chill\PersonBundle\Entity\MaritalStatus;
diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php
index 355dae785..924155955 100644
--- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php
+++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPeople.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\DataFixtures\ORM;
use Chill\MainBundle\DataFixtures\ORM\LoadPostalCodes;
@@ -40,13 +42,14 @@ use Nelmio\Alice\Loader\NativeLoader;
use Nelmio\Alice\ObjectSet;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\Workflow\Registry;
+use function count;
use function random_int;
use function ucfirst;
/**
* Load people into database.
*/
-class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface
+class LoadPeople extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
{
use \Symfony\Component\DependencyInjection\ContainerAwareTrait;
@@ -273,7 +276,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
$this->cacheCenters = $this->centerRepository->findAll();
}
- return $this->cacheCenters[\array_rand($this->cacheCenters)];
+ return $this->cacheCenters[array_rand($this->cacheCenters)];
}
/**
@@ -291,7 +294,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
return null;
}
- return $this->cacheCountries[\array_rand($this->cacheCountries)];
+ return $this->cacheCountries[array_rand($this->cacheCountries)];
}
/**
@@ -475,7 +478,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
private function getPostalCode(): PostalCode
{
- $ref = LoadPostalCodes::$refs[\array_rand(LoadPostalCodes::$refs)];
+ $ref = LoadPostalCodes::$refs[array_rand(LoadPostalCodes::$refs)];
return $this->getReference($ref);
}
@@ -490,10 +493,10 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
return (new Address())
->setStreetAddress1($this->faker->streetAddress)
->setStreetAddress2(
- rand(0, 9) > 5 ? $this->faker->streetAddress : ''
+ mt_rand(0, 9) > 5 ? $this->faker->streetAddress : ''
)
->setPoint(
- rand(0, 9) > 5 ? $this->getRandomPoint() : null
+ mt_rand(0, 9) > 5 ? $this->getRandomPoint() : null
)
->setPostcode($this->getReference(
LoadPostalCodes::$refs[array_rand(LoadPostalCodes::$refs)]
@@ -510,8 +513,8 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
{
$lonBrussels = 4.35243;
$latBrussels = 50.84676;
- $lon = $lonBrussels + 0.01 * rand(-5, 5);
- $lat = $latBrussels + 0.01 * rand(-5, 5);
+ $lon = $lonBrussels + 0.01 * mt_rand(-5, 5);
+ $lat = $latBrussels + 0.01 * mt_rand(-5, 5);
return Point::fromLonLat($lon, $lat);
}
@@ -522,7 +525,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
$this->cacheSocialIssues = $this->socialIssueRepository->findAll();
}
- return $this->cacheSocialIssues[\array_rand($this->cacheSocialIssues)];
+ return $this->cacheSocialIssues[array_rand($this->cacheSocialIssues)];
}
private function getRandomUser(): User
@@ -531,7 +534,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
$this->cacheUsers = $this->userRepository->findAll();
}
- return $this->cacheUsers[\array_rand($this->cacheUsers)];
+ return $this->cacheUsers[array_rand($this->cacheUsers)];
}
/*
diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPersonACL.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPersonACL.php
index a0418e02b..7b368bbe8 100644
--- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPersonACL.php
+++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadPersonACL.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\DataFixtures\ORM;
use Chill\MainBundle\DataFixtures\ORM\LoadPermissionsGroup;
diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php
index 3d52e9352..80f3e711d 100644
--- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php
+++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadRelationships.php
@@ -20,6 +20,7 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ObjectManager;
+use function count;
class LoadRelationships extends Fixture implements DependentFixtureInterface
{
@@ -49,7 +50,7 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface
->setFromPerson($this->getRandomPerson($this->em))
->setToPerson($this->getRandomPerson($this->em))
->setRelation($this->getReference(LoadRelations::RELATION_KEY .
- \random_int(0, count(LoadRelations::RELATIONS) - 1)))
+ random_int(0, count(LoadRelations::RELATIONS) - 1)))
->setReverse((bool) random_int(0, 1))
->setCreatedBy($user)
->setUpdatedBy($user)
diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php
index 84d1c1a71..1e4d5022f 100644
--- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php
+++ b/src/Bundle/ChillPersonBundle/DependencyInjection/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 Chill\MainBundle\DependencyInjection\MissingBundleException;
@@ -21,6 +23,7 @@ use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
+use function array_key_exists;
/**
* Class ChillPersonExtension
@@ -378,7 +381,6 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
Request::METHOD_DELETE => 'ALWAYS_FAILS',
],
],
-
'confirm' => [
'methods' => [
Request::METHOD_POST => true,
@@ -389,6 +391,16 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
],
],
+ 'confidential' => [
+ 'methods' => [
+ Request::METHOD_POST => true,
+ Request::METHOD_GET => true,
+ ],
+ 'controller_action' => 'toggleConfidentialApi',
+ 'roles' => [
+ Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::TOGGLE_CONFIDENTIAL,
+ ],
+ ],
'findAccompanyingPeriodsByPerson' => [
'path' => '/by-person/{person_id}.{_format}',
'controller_action' => 'getAccompanyingPeriodsByPerson',
diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/CompilerPass/AccompanyingPeriodTimelineCompilerPass.php b/src/Bundle/ChillPersonBundle/DependencyInjection/CompilerPass/AccompanyingPeriodTimelineCompilerPass.php
index a6ce583f2..c4f4dbdf3 100644
--- a/src/Bundle/ChillPersonBundle/DependencyInjection/CompilerPass/AccompanyingPeriodTimelineCompilerPass.php
+++ b/src/Bundle/ChillPersonBundle/DependencyInjection/CompilerPass/AccompanyingPeriodTimelineCompilerPass.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\DependencyInjection\CompilerPass;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
@@ -49,7 +51,7 @@ class AccompanyingPeriodTimelineCompilerPass implements CompilerPassInterface
$definition->removeMethodCall('addProvider');
- if (false === in_array($arguments[1], $definitions)) {
+ if (false === in_array($arguments[1], $definitions, true)) {
$definition->addMethodCall($method, $arguments);
}
}
diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php
index 68a8e1fd5..d3e1b7f82 100644
--- a/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\DependencyInjection;
use DateInterval;
@@ -44,7 +46,7 @@ class Configuration implements ConfigurationInterface
->info($this->validationBirthdateNotAfterInfos)
->defaultValue('P1D')
->validate()
- ->ifTrue(function ($period) {
+ ->ifTrue(static function ($period) {
try {
$interval = new DateInterval($period);
} catch (Exception $ex) {
diff --git a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart.php b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart.php
index c9b7a6ca2..14c9fb694 100644
--- a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart.php
+++ b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Doctrine\DQL;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
diff --git a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartAddressId.php b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartAddressId.php
index 698bb65ff..5b9e784f1 100644
--- a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartAddressId.php
+++ b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartAddressId.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;
diff --git a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartCountryCode.php b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartCountryCode.php
index 5e558eac3..ca130478c 100644
--- a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartCountryCode.php
+++ b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartCountryCode.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;
diff --git a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartCountryId.php b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartCountryId.php
index b0379b934..3672c2a74 100644
--- a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartCountryId.php
+++ b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartCountryId.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;
diff --git a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartCountryName.php b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartCountryName.php
index 7eb1408fa..b6da85ee4 100644
--- a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartCountryName.php
+++ b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartCountryName.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;
diff --git a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartIsNoAddress.php b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartIsNoAddress.php
index 0676659d3..4390fb6a8 100644
--- a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartIsNoAddress.php
+++ b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartIsNoAddress.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;
diff --git a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartPostCodeCode.php b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartPostCodeCode.php
index eb786df22..09804b241 100644
--- a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartPostCodeCode.php
+++ b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartPostCodeCode.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;
diff --git a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartPostCodeId.php b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartPostCodeId.php
index 0f9885b8b..bd2536047 100644
--- a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartPostCodeId.php
+++ b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartPostCodeId.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;
diff --git a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartPostCodeLabel.php b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartPostCodeLabel.php
index 3814ab5a3..5edb77e6f 100644
--- a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartPostCodeLabel.php
+++ b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartPostCodeLabel.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;
diff --git a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartStreetAddress1.php b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartStreetAddress1.php
index 30d87f452..344b7e3c2 100644
--- a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartStreetAddress1.php
+++ b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartStreetAddress1.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;
diff --git a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartStreetAddress2.php b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartStreetAddress2.php
index e52ce38ba..2827016bc 100644
--- a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartStreetAddress2.php
+++ b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartStreetAddress2.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;
diff --git a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartValidFrom.php b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartValidFrom.php
index 43b271960..89ef28606 100644
--- a/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartValidFrom.php
+++ b/src/Bundle/ChillPersonBundle/Doctrine/DQL/AddressPart/AddressPartValidFrom.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;
diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
index 6b0c5d768..13109cc98 100644
--- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
+++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
@@ -39,6 +41,9 @@ use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Symfony\Component\Validator\GroupSequenceProviderInterface;
use UnexpectedValueException;
+use function count;
+use function in_array;
+use const SORT_REGULAR;
/**
* AccompanyingPeriod Class.
@@ -49,13 +54,17 @@ use UnexpectedValueException;
* "accompanying_period": AccompanyingPeriod::class
* })
* @Assert\GroupSequenceProvider
+ * @Assert\Expression(
+ * "this.isConfidential and this.getUser === NULL",
+ * message="If the accompanying course is confirmed and confidential, a referrer must remain assigned."
+ * )
*/
class AccompanyingPeriod implements
- TrackCreationInterface,
- TrackUpdateInterface,
- HasScopesInterface,
+ GroupSequenceProviderInterface,
HasCentersInterface,
- GroupSequenceProviderInterface
+ HasScopesInterface,
+ TrackCreationInterface,
+ TrackUpdateInterface
{
public const INTENSITIES = [self::INTENSITY_OCCASIONAL, self::INTENSITY_REGULAR];
@@ -514,10 +523,10 @@ class AccompanyingPeriod implements
public function getAvailablePersonLocation(): Collection
{
return $this->getOpenParticipations()
- ->filter(function (AccompanyingPeriodParticipation $p) {
+ ->filter(static function (AccompanyingPeriodParticipation $p) {
return $p->getPerson()->hasCurrentHouseholdAddress();
})
- ->map(function (AccompanyingPeriodParticipation $p) {
+ ->map(static function (AccompanyingPeriodParticipation $p) {
return $p->getPerson();
});
}
@@ -534,7 +543,7 @@ class AccompanyingPeriod implements
public function getCenters(): ?iterable
{
foreach ($this->getPersons() as $person) {
- if (!in_array($person->getCenter(), $centers ?? [])
+ if (!in_array($person->getCenter(), $centers ?? [], true)
&& null !== $person->getCenter()) {
$centers[] = $person->getCenter();
}
@@ -580,11 +589,11 @@ class AccompanyingPeriod implements
public function getGroupSequence()
{
- if ($this->getStep() == self::STEP_DRAFT) {
+ if ($this->getStep() === self::STEP_DRAFT) {
return [[self::STEP_DRAFT]];
}
- if ($this->getStep() == self::STEP_CONFIRMED) {
+ if ($this->getStep() === self::STEP_CONFIRMED) {
return [[self::STEP_DRAFT, self::STEP_CONFIRMED]];
}
diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php
index 03c09e1db..2d0bfe918 100644
--- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php
+++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php
index 8317f8838..cdcad98bd 100644
--- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php
+++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
@@ -30,7 +32,7 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* "accompanying_period_work_evaluation": AccompanyingPeriodWorkEvaluation::class,
* })
*/
-class AccompanyingPeriodWorkEvaluation implements TrackUpdateInterface, TrackCreationInterface
+class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackUpdateInterface
{
/**
* @ORM\ManyToOne(
diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php
index d51534240..538cffc36 100644
--- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php
+++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkGoal.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkGoal.php
index 0a40be12b..c31dfaa83 100644
--- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkGoal.php
+++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkGoal.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\SocialWork\Goal;
diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/ClosingMotive.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/ClosingMotive.php
index b78fcccde..b7d4c00b1 100644
--- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/ClosingMotive.php
+++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/ClosingMotive.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Doctrine\Common\Collections\ArrayCollection;
diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php
index 758893b93..75d1b2857 100644
--- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php
+++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php
index 402f9d69d..7d35b8684 100644
--- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php
+++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use DateTimeImmutable;
diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php
index 8b3d09cbe..ea20666fb 100644
--- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php
+++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriodParticipation.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriodParticipation.php
index 191752b97..3478b2631 100644
--- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriodParticipation.php
+++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriodParticipation.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity;
use DateTimeImmutable;
@@ -123,7 +125,7 @@ class AccompanyingPeriodParticipation
private function checkSameStartEnd()
{
- if ($this->endDate == $this->startDate) {
+ if ($this->endDate === $this->startDate) {
$this->accompanyingPeriod->removeParticipation($this);
}
}
diff --git a/src/Bundle/ChillPersonBundle/Entity/HasPerson.php b/src/Bundle/ChillPersonBundle/Entity/HasPerson.php
index 97b170009..1bee7127c 100644
--- a/src/Bundle/ChillPersonBundle/Entity/HasPerson.php
+++ b/src/Bundle/ChillPersonBundle/Entity/HasPerson.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity;
/**
diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php
index 39b9c3ca3..c03644214 100644
--- a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php
+++ b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\Household;
use Chill\MainBundle\Entity\Address;
@@ -22,6 +24,7 @@ use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
+use function count;
/**
* @ORM\Entity
@@ -92,7 +95,7 @@ class Household
public function addAddress(Address $address)
{
foreach ($this->getAddresses() as $a) {
- if ($a->getValidFrom() < $address->getValidFrom() && $a->getValidTo() === null) {
+ if ($a->getValidFrom() <= $address->getValidFrom() && $a->getValidTo() === null) {
$a->setValidTo($address->getValidFrom());
}
}
@@ -138,7 +141,7 @@ class Household
{
$at = null === $at ? new DateTime('today') : $at;
- $addrs = $this->getAddresses()->filter(function (Address $a) use ($at) {
+ $addrs = $this->getAddresses()->filter(static function (Address $a) use ($at) {
return $a->getValidFrom() <= $at && (
null === $a->getValidTo() || $a->getValidTo() > $at
);
@@ -177,7 +180,7 @@ class Household
public function getCurrentMembersIds(?DateTimeImmutable $now = null): Collection
{
return $this->getCurrentMembers($now)->map(
- fn (HouseholdMember $m) => $m->getId()
+ static fn (HouseholdMember $m) => $m->getId()
);
}
@@ -190,7 +193,7 @@ class Household
$members->getIterator()
->uasort(
- function (HouseholdMember $a, HouseholdMember $b) {
+ static function (HouseholdMember $a, HouseholdMember $b) {
if ($a->getPosition() === null) {
if ($b->getPosition() === null) {
return 0;
@@ -246,7 +249,7 @@ class Household
public function getCurrentPersons(?DateTimeImmutable $now = null): Collection
{
return $this->getCurrentMembers($now)
- ->map(function (HouseholdMember $m) { return $m->getPerson(); });
+ ->map(static function (HouseholdMember $m) { return $m->getPerson(); });
}
public function getId(): ?int
@@ -268,7 +271,7 @@ class Household
$membership->getStartDate(),
$membership->getEndDate()
)->filter(
- function (HouseholdMember $m) use ($membership) {
+ static function (HouseholdMember $m) use ($membership) {
return $m !== $membership;
}
);
@@ -418,7 +421,7 @@ class Household
$cond = true;
for ($i = 0; count($addresses) - 1 > $i; ++$i) {
- if ($addresses[$i]->getValidFrom() != $addresses[$i + 1]->getValidTo()) {
+ if ($addresses[$i]->getValidFrom() !== $addresses[$i + 1]->getValidTo()) {
$cond = false;
$context->buildViolation('The address are not sequentials. The validFrom date of one address should be equal to the validTo date of the previous address.')
->atPath('addresses')
diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php
index 403912328..af3ead806 100644
--- a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php
+++ b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\Household;
use Chill\PersonBundle\Entity\Person;
diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/PersonHouseholdAddress.php b/src/Bundle/ChillPersonBundle/Entity/Household/PersonHouseholdAddress.php
index f23f325f9..3bb204c6f 100644
--- a/src/Bundle/ChillPersonBundle/Entity/Household/PersonHouseholdAddress.php
+++ b/src/Bundle/ChillPersonBundle/Entity/Household/PersonHouseholdAddress.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\Household;
use Chill\MainBundle\Entity\Address;
diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/Position.php b/src/Bundle/ChillPersonBundle/Entity/Household/Position.php
index bd297c09e..721c35433 100644
--- a/src/Bundle/ChillPersonBundle/Entity/Household/Position.php
+++ b/src/Bundle/ChillPersonBundle/Entity/Household/Position.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\Household;
use Doctrine\ORM\Mapping as ORM;
diff --git a/src/Bundle/ChillPersonBundle/Entity/MaritalStatus.php b/src/Bundle/ChillPersonBundle/Entity/MaritalStatus.php
index 02463e5d6..56c9368dc 100644
--- a/src/Bundle/ChillPersonBundle/Entity/MaritalStatus.php
+++ b/src/Bundle/ChillPersonBundle/Entity/MaritalStatus.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php
index 130e1ec10..f58cee747 100644
--- a/src/Bundle/ChillPersonBundle/Entity/Person.php
+++ b/src/Bundle/ChillPersonBundle/Entity/Person.php
@@ -40,6 +40,8 @@ use Exception;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
+use function count;
+use function in_array;
/**
* Person Class.
@@ -599,7 +601,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
public function checkAccompanyingPeriodsAreNotCollapsing()
{
$periods = $this->getAccompanyingPeriodsOrdered();
- $periodsNbr = sizeof($periods);
+ $periodsNbr = count($periods);
$i = 0;
while ($periodsNbr - 1 > $i) {
@@ -772,15 +774,15 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
$periods = $this->getAccompanyingPeriods();
//order by date :
- usort($periods, function ($a, $b) {
+ usort($periods, static function ($a, $b) {
$dateA = $a->getOpeningDate();
$dateB = $b->getOpeningDate();
- if ($dateA == $dateB) {
+ if ($dateA === $dateB) {
$dateEA = $a->getClosingDate();
$dateEB = $b->getClosingDate();
- if ($dateEA == $dateEB) {
+ if ($dateEA === $dateEB) {
return 0;
}
@@ -1294,7 +1296,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
return $this->getAccompanyingPeriodParticipations()
->matching($criteria)
- ->filter(function (AccompanyingPeriodParticipation $app) {
+ ->filter(static function (AccompanyingPeriodParticipation $app) {
return AccompanyingPeriod::STEP_CLOSED !== $app->getAccompanyingPeriod()->getStep();
});
}
@@ -1358,7 +1360,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
foreach ($this->addresses as $ad) {
$validDate = $ad->getValidFrom()->format('Y-m-d');
- if (in_array($validDate, $validYMDDates)) {
+ if (in_array($validDate, $validYMDDates, true)) {
return true;
}
$validYMDDates[] = $validDate;
diff --git a/src/Bundle/ChillPersonBundle/Entity/Person/PersonCurrentAddress.php b/src/Bundle/ChillPersonBundle/Entity/Person/PersonCurrentAddress.php
index e9b7c8ae2..0c9e416c2 100644
--- a/src/Bundle/ChillPersonBundle/Entity/Person/PersonCurrentAddress.php
+++ b/src/Bundle/ChillPersonBundle/Entity/Person/PersonCurrentAddress.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\Person;
use Chill\MainBundle\Entity\Address;
diff --git a/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php b/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php
index 15f0d8eb5..d233082c4 100644
--- a/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php
+++ b/src/Bundle/ChillPersonBundle/Entity/PersonAltName.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
diff --git a/src/Bundle/ChillPersonBundle/Entity/PersonNotDuplicate.php b/src/Bundle/ChillPersonBundle/Entity/PersonNotDuplicate.php
index 0d83dcf6f..c00eb91fa 100644
--- a/src/Bundle/ChillPersonBundle/Entity/PersonNotDuplicate.php
+++ b/src/Bundle/ChillPersonBundle/Entity/PersonNotDuplicate.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity;
use Chill\MainBundle\Entity\User;
diff --git a/src/Bundle/ChillPersonBundle/Entity/PersonPhone.php b/src/Bundle/ChillPersonBundle/Entity/PersonPhone.php
index 12487f74a..400e39c88 100644
--- a/src/Bundle/ChillPersonBundle/Entity/PersonPhone.php
+++ b/src/Bundle/ChillPersonBundle/Entity/PersonPhone.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity;
use DateTime;
diff --git a/src/Bundle/ChillPersonBundle/Entity/Relationships/Relation.php b/src/Bundle/ChillPersonBundle/Entity/Relationships/Relation.php
index 0761ba9fa..3b7c75a06 100644
--- a/src/Bundle/ChillPersonBundle/Entity/Relationships/Relation.php
+++ b/src/Bundle/ChillPersonBundle/Entity/Relationships/Relation.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\Relationships;
use Doctrine\ORM\Mapping as ORM;
diff --git a/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php b/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php
index 57470acfb..45cd546b0 100644
--- a/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php
+++ b/src/Bundle/ChillPersonBundle/Entity/Relationships/Relationship.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\Relationships;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php
index 5c7f5bab1..6b1d81700 100644
--- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php
+++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\SocialWork;
use DateInterval;
diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Goal.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Goal.php
index 5a7265944..9c02a129d 100644
--- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Goal.php
+++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Goal.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\SocialWork;
use DateTimeInterface;
diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Result.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Result.php
index 91212e30a..b2894d210 100644
--- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Result.php
+++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Result.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\SocialWork;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php
index 4cde849c9..c5ca7d18a 100644
--- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php
+++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\SocialWork;
use DateInterval;
diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php
index 9e862fad6..84d47796b 100644
--- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php
+++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Entity\SocialWork;
use DateTimeInterface;
diff --git a/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php b/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php
index 393ed2096..d3b4beb47 100644
--- a/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php
+++ b/src/Bundle/ChillPersonBundle/EventListener/PersonEventListener.php
@@ -13,6 +13,7 @@ namespace Chill\PersonBundle\EventListener;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Entity\PersonAltName;
+use const MB_CASE_TITLE;
class PersonEventListener
{
diff --git a/src/Bundle/ChillPersonBundle/Export/AbstractAccompanyingPeriodExportElement.php b/src/Bundle/ChillPersonBundle/Export/AbstractAccompanyingPeriodExportElement.php
index e12394ad1..b570c83de 100644
--- a/src/Bundle/ChillPersonBundle/Export/AbstractAccompanyingPeriodExportElement.php
+++ b/src/Bundle/ChillPersonBundle/Export/AbstractAccompanyingPeriodExportElement.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Export;
use Doctrine\ORM\QueryBuilder;
@@ -23,7 +25,7 @@ class AbstractAccompanyingPeriodExportElement
protected function addJoinAccompanyingPeriod(QueryBuilder $query): void
{
if (false === $this->havingAccompanyingPeriodInJoin($query)) {
- if (false === in_array('person', $query->getAllAliases())) {
+ if (false === in_array('person', $query->getAllAliases(), true)) {
throw new LogicException("the alias 'person' does not exists in "
. 'query builder');
}
@@ -39,6 +41,6 @@ class AbstractAccompanyingPeriodExportElement
{
$joins = $query->getDQLPart('join') ?? [];
- return in_array('accompanying_period', $query->getAllAliases());
+ return in_array('accompanying_period', $query->getAllAliases(), true);
}
}
diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AgeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AgeAggregator.php
index e72c1f977..04edade32 100644
--- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AgeAggregator.php
+++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AgeAggregator.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Export\Aggregator;
use Chill\MainBundle\Export\AggregatorInterface;
diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/CountryOfBirthAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/CountryOfBirthAggregator.php
index 770812ce5..9126542ad 100644
--- a/src/Bundle/ChillPersonBundle/Export/Aggregator/CountryOfBirthAggregator.php
+++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/CountryOfBirthAggregator.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Export\Aggregator;
use Chill\MainBundle\Export\AggregatorInterface;
@@ -147,7 +149,7 @@ final class CountryOfBirthAggregator implements AggregatorInterface, ExportEleme
];
}
- return function (string $value) use ($labels): string {
+ return static function (string $value) use ($labels): string {
return $labels[$value];
};
}
diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/GenderAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/GenderAggregator.php
index 9e9e2cc26..d40f0e739 100644
--- a/src/Bundle/ChillPersonBundle/Export/Aggregator/GenderAggregator.php
+++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/GenderAggregator.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Export\Aggregator;
use Chill\MainBundle\Export\AggregatorInterface;
diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/NationalityAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/NationalityAggregator.php
index d6c69b7bc..05a0baa05 100644
--- a/src/Bundle/ChillPersonBundle/Export/Aggregator/NationalityAggregator.php
+++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/NationalityAggregator.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Export\Aggregator;
use Chill\MainBundle\Export\AggregatorInterface;
@@ -147,7 +149,7 @@ final class NationalityAggregator implements AggregatorInterface, ExportElementV
];
}
- return function (string $value) use ($labels): string {
+ return static function (string $value) use ($labels): string {
return $labels[$value];
};
}
diff --git a/src/Bundle/ChillPersonBundle/Export/Declarations.php b/src/Bundle/ChillPersonBundle/Export/Declarations.php
index 8d2b9e951..b23325e5e 100644
--- a/src/Bundle/ChillPersonBundle/Export/Declarations.php
+++ b/src/Bundle/ChillPersonBundle/Export/Declarations.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Export;
/**
diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php
index c621e8217..ffa69026a 100644
--- a/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php
+++ b/src/Bundle/ChillPersonBundle/Export/Export/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;
@@ -56,7 +58,7 @@ class CountPerson implements ExportInterface
$labels = array_combine($values, $values);
$labels['_header'] = $this->getTitle();
- return function ($value) use ($labels) {
+ return static function ($value) use ($labels) {
return $labels[$value];
};
}
@@ -88,7 +90,7 @@ class CountPerson implements ExportInterface
*/
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);
$qb = $this->entityManager->createQueryBuilder();
diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php
index b949c5ebc..6c02f4033 100644
--- a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php
+++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php
@@ -36,13 +36,15 @@ use function addcslashes;
use function array_key_exists;
use function array_keys;
use function array_merge;
+use function count;
+use function in_array;
use function strtolower;
use function uniqid;
/**
* Render a list of people.
*/
-class ListPerson implements ListInterface, ExportElementValidatedInterface
+class ListPerson implements ExportElementValidatedInterface, ListInterface
{
protected CustomFieldProvider $customFieldProvider;
@@ -100,7 +102,7 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface
return [];
},
'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')
@@ -219,7 +221,7 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface
default:
// for fields which are associated with person
- if (in_array($key, $this->fields)) {
+ if (in_array($key, $this->fields, true)) {
return static function ($value) use ($key) {
if ('_header' === $value) {
return strtolower($key);
@@ -238,7 +240,7 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface
$fields = [];
foreach ($data['fields'] as $key) {
- if (in_array($key, $this->fields)) {
+ if (in_array($key, $this->fields, true)) {
$fields[] = $key;
}
}
@@ -264,7 +266,7 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface
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)) {
@@ -275,7 +277,7 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface
$qb = $this->entityManager->createQueryBuilder();
foreach ($this->fields as $f) {
- if (in_array($f, $data['fields'])) {
+ if (in_array($f, $data['fields'], true)) {
switch ($f) {
case 'countryOfBirth':
case 'nationality':
@@ -310,7 +312,7 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface
foreach ($this->getCustomFields() as $cf) {
$cfType = $this->customFieldProvider->getCustomFieldByType($cf->getType());
- if ($cfType instanceof CustomFieldChoice and $cfType->isMultiple($cf)) {
+ if ($cfType instanceof CustomFieldChoice && $cfType->isMultiple($cf)) {
foreach ($cfType->getChoices($cf) as $choiceSlug => $label) {
$slug = $this->slugToDQL($cf->getSlug(), 'choice', ['choiceSlug' => $choiceSlug]);
$qb->addSelect(
@@ -411,7 +413,7 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface
private function getLabelForCustomField($key, array $values, $data)
{
// for fields which are custom fields
- /* @var $cf CustomField */
+ /** @var CustomField $cf */
$cf = $this->entityManager
->getRepository(CustomField::class)
->findOneBy(['slug' => $this->DQLToSlug($key)]);
@@ -426,10 +428,10 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface
->render(json_decode($value, true), $cf, 'csv');
};
- if ($cfType instanceof CustomFieldChoice and $cfType->isMultiple($cf)) {
+ if ($cfType instanceof CustomFieldChoice && $cfType->isMultiple($cf)) {
return function ($value) use ($cf, $cfType, $key) {
$slugChoice = $this->extractInfosFromSlug($key)['additionnalInfos']['choiceSlug'];
- $decoded = \json_decode($value, true);
+ $decoded = json_decode($value, true);
if ('_header' === $value) {
$label = $cfType->getChoices($cf)[$slugChoice];
@@ -438,7 +440,7 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface
. ' | ' . $label;
}
- if ('_other' === $slugChoice and $cfType->isChecked($cf, $choiceSlug, $decoded)) {
+ if ('_other' === $slugChoice && $cfType->isChecked($cf, $choiceSlug, $decoded)) {
return $cfType->extractOtherValue($cf, $decoded);
}
diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php
index f1852da88..d82c8b0aa 100644
--- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php
+++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.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\DirectExportInterface;
@@ -167,23 +169,23 @@ class ListPersonDuplicate implements DirectExportInterface, ExportElementValidat
SIMILARITY(p.fullnamecanonical, p2.fullnamecanonical) AS "similarity nom + prenom",
SIMILARITY(p.lastname, p2.lastname) AS "similarity nom",
SIMILARITY(p.firstname, p2.firstname) AS "similarity prenom"
- FROM chill_person_person AS p
- JOIN chill_person_person AS p2
- ON p.id != p2.id
- AND (SIMILARITY(p.fullnamecanonical, p2.fullnamecanonical) > :precision
+ FROM chill_person_person AS p
+ JOIN chill_person_person AS p2
+ ON p.id != p2.id
+ AND (SIMILARITY(p.fullnamecanonical, p2.fullnamecanonical) > :precision
AND p.id < p2.id)
OR (UNACCENT(LOWER(p.firstname)) = UNACCENT(LOWER(p2.lastname))
AND UNACCENT(LOWER(p.lastname)) = UNACCENT(LOWER(p2.firstname)))
- JOIN centers AS p1center
+ JOIN centers AS p1center
ON p1center.id = p.center_id
- JOIN centers AS p2center
+ JOIN centers AS p2center
ON p2center.id = p2.center_id
WHERE NOT EXISTS (
- SELECT id
- FROM chill_person_not_duplicate as pnd
- WHERE (pnd.person1_id = p.id
+ SELECT id
+ FROM chill_person_not_duplicate as pnd
+ WHERE (pnd.person1_id = p.id
AND pnd.person2_id = p2.id)
- OR (pnd.person2_id = p.id
+ OR (pnd.person2_id = p.id
AND pnd.person1_id = p2.id)
)
ORDER BY p.fullnamecanonical, p.id, p2.id';
diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodClosingFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodClosingFilter.php
index 68f613896..787bf46d6 100644
--- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodClosingFilter.php
+++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodClosingFilter.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\FilterInterface;
diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodFilter.php
index c52f192d7..1c658527f 100644
--- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodFilter.php
+++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodFilter.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\FilterInterface;
diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodOpeningFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodOpeningFilter.php
index a821cd3d3..7d00060f4 100644
--- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodOpeningFilter.php
+++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodOpeningFilter.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\FilterInterface;
diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/BirthdateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/BirthdateFilter.php
index 518df3d4b..36457e0f8 100644
--- a/src/Bundle/ChillPersonBundle/Export/Filter/BirthdateFilter.php
+++ b/src/Bundle/ChillPersonBundle/Export/Filter/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
{
public function addRole()
{
diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/GenderFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/GenderFilter.php
index 93160690d..c7587874b 100644
--- a/src/Bundle/ChillPersonBundle/Export/Filter/GenderFilter.php
+++ b/src/Bundle/ChillPersonBundle/Export/Filter/GenderFilter.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;
@@ -19,12 +21,14 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use function array_filter;
+use function count;
use function implode;
use function in_array;
+use function is_array;
class GenderFilter implements
- FilterInterface,
- ExportElementValidatedInterface
+ ExportElementValidatedInterface,
+ FilterInterface
{
/**
* @var TranslatorInterface
@@ -46,7 +50,7 @@ class GenderFilter implements
$where = $qb->getDQLPart('where');
$isIn = $qb->expr()->in('person.gender', ':person_gender');
- if (!in_array('null', $data['accepted_genders'])) {
+ if (!in_array('null', $data['accepted_genders'], true)) {
$clause = $isIn;
} else {
$clause = $qb->expr()->orX($isIn, $qb->expr()->isNull('person.gender'));
@@ -61,7 +65,7 @@ class GenderFilter implements
$qb->add('where', $where);
$qb->setParameter('person_gender', array_filter(
$data['accepted_genders'],
- function ($el) {
+ static function ($el) {
return 'null' !== $el;
}
));
diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/NationalityFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/NationalityFilter.php
index 449af1913..602457024 100644
--- a/src/Bundle/ChillPersonBundle/Export/Filter/NationalityFilter.php
+++ b/src/Bundle/ChillPersonBundle/Export/Filter/NationalityFilter.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\Entity\Country;
@@ -20,8 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
class NationalityFilter implements
- FilterInterface,
- ExportElementValidatedInterface
+ ExportElementValidatedInterface,
+ FilterInterface
{
/**
* @var TranslatableStringHelper
diff --git a/src/Bundle/ChillPersonBundle/Form/AccompanyingPeriodType.php b/src/Bundle/ChillPersonBundle/Form/AccompanyingPeriodType.php
index 6b2b3e171..ec1766088 100644
--- a/src/Bundle/ChillPersonBundle/Form/AccompanyingPeriodType.php
+++ b/src/Bundle/ChillPersonBundle/Form/AccompanyingPeriodType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form;
use Chill\MainBundle\Entity\Center;
@@ -64,8 +66,8 @@ class AccompanyingPeriodType extends AbstractType
if (
('close' === $options['period_action'])
- or ('create' === $options['period_action'])
- or ('update' === $options['period_action'] and !$accompanyingPeriod->isOpen())
+ || ('create' === $options['period_action'])
+ || ('update' === $options['period_action'] && !$accompanyingPeriod->isOpen())
) {
$builder->add('closingDate', DateType::class, [
'required' => true,
diff --git a/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php b/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php
index dd26e3cd9..2924b7e35 100644
--- a/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php
+++ b/src/Bundle/ChillPersonBundle/Form/ChoiceLoader/PersonChoiceLoader.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form\ChoiceLoader;
use Chill\PersonBundle\Entity\Person;
@@ -15,6 +17,7 @@ use RuntimeException;
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
use function call_user_func;
+use function count;
use function in_array;
/**
@@ -51,7 +54,7 @@ class PersonChoiceLoader implements ChoiceLoaderInterface
{
return new \Symfony\Component\Form\ChoiceList\ArrayChoiceList(
$this->lazyLoadedPersons,
- function (Person $p) use ($value) {
+ static function (Person $p) use ($value) {
return call_user_func($value, $p);
}
);
@@ -74,7 +77,7 @@ class PersonChoiceLoader implements ChoiceLoaderInterface
$person = $this->personRepository->find($value);
if ($this->hasCenterFilter()
- && !in_array($person->getCenter(), $this->centers)) {
+ && !in_array($person->getCenter(), $this->centers, true)) {
throw new RuntimeException('chosen a person not in correct center');
}
diff --git a/src/Bundle/ChillPersonBundle/Form/ClosingMotiveType.php b/src/Bundle/ChillPersonBundle/Form/ClosingMotiveType.php
index ba8544cf0..9cf24d8c3 100644
--- a/src/Bundle/ChillPersonBundle/Form/ClosingMotiveType.php
+++ b/src/Bundle/ChillPersonBundle/Form/ClosingMotiveType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
diff --git a/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php b/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php
index aaa346893..13de3b9f5 100644
--- a/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php
+++ b/src/Bundle/ChillPersonBundle/Form/DataMapper/PersonAltNameDataMapper.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form\DataMapper;
use Chill\PersonBundle\Entity\PersonAltName;
@@ -15,6 +17,7 @@ use Doctrine\Common\Collections\Collection;
use Symfony\Component\Form\DataMapperInterface;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use function array_key_exists;
+use function is_array;
class PersonAltNameDataMapper implements DataMapperInterface
{
diff --git a/src/Bundle/ChillPersonBundle/Form/DataTransformer/PersonToIdTransformer.php b/src/Bundle/ChillPersonBundle/Form/DataTransformer/PersonToIdTransformer.php
index 0198b3b8d..5e7ed4043 100644
--- a/src/Bundle/ChillPersonBundle/Form/DataTransformer/PersonToIdTransformer.php
+++ b/src/Bundle/ChillPersonBundle/Form/DataTransformer/PersonToIdTransformer.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form\DataTransformer;
use Chill\PersonBundle\Entity\Person;
diff --git a/src/Bundle/ChillPersonBundle/Form/HouseholdMemberType.php b/src/Bundle/ChillPersonBundle/Form/HouseholdMemberType.php
index 297a58a57..a5284afdb 100644
--- a/src/Bundle/ChillPersonBundle/Form/HouseholdMemberType.php
+++ b/src/Bundle/ChillPersonBundle/Form/HouseholdMemberType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form;
use Chill\MainBundle\Form\Type\ChillDateType;
diff --git a/src/Bundle/ChillPersonBundle/Form/HouseholdType.php b/src/Bundle/ChillPersonBundle/Form/HouseholdType.php
index d628ab47f..68f00fa22 100644
--- a/src/Bundle/ChillPersonBundle/Form/HouseholdType.php
+++ b/src/Bundle/ChillPersonBundle/Form/HouseholdType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form;
use Chill\MainBundle\Form\Type\ChillDateType;
diff --git a/src/Bundle/ChillPersonBundle/Form/MaritalStatusType.php b/src/Bundle/ChillPersonBundle/Form/MaritalStatusType.php
index 2387daa9f..fb81331c6 100644
--- a/src/Bundle/ChillPersonBundle/Form/MaritalStatusType.php
+++ b/src/Bundle/ChillPersonBundle/Form/MaritalStatusType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
diff --git a/src/Bundle/ChillPersonBundle/Form/PersonConfimDuplicateType.php b/src/Bundle/ChillPersonBundle/Form/PersonConfimDuplicateType.php
index 82fb5d3a9..52ed35db6 100644
--- a/src/Bundle/ChillPersonBundle/Form/PersonConfimDuplicateType.php
+++ b/src/Bundle/ChillPersonBundle/Form/PersonConfimDuplicateType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form;
use Symfony\Component\Form\AbstractType;
diff --git a/src/Bundle/ChillPersonBundle/Form/PersonFindManuallyDuplicateType.php b/src/Bundle/ChillPersonBundle/Form/PersonFindManuallyDuplicateType.php
index e0d828c07..7ecbcdc9b 100644
--- a/src/Bundle/ChillPersonBundle/Form/PersonFindManuallyDuplicateType.php
+++ b/src/Bundle/ChillPersonBundle/Form/PersonFindManuallyDuplicateType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form;
use Chill\PersonBundle\Form\Type\PickPersonType;
diff --git a/src/Bundle/ChillPersonBundle/Form/PersonType.php b/src/Bundle/ChillPersonBundle/Form/PersonType.php
index 2f2ab79a5..eddf8c751 100644
--- a/src/Bundle/ChillPersonBundle/Form/PersonType.php
+++ b/src/Bundle/ChillPersonBundle/Form/PersonType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form;
use Chill\CustomFieldsBundle\Form\Type\CustomFieldType;
@@ -111,10 +113,10 @@ class PersonType extends AbstractType
]);
$builder->get('placeOfBirth')->addModelTransformer(new CallbackTransformer(
- function ($string) {
+ static function ($string) {
return strtoupper($string);
},
- function ($string) {
+ static function ($string) {
return strtoupper($string);
}
));
@@ -148,7 +150,7 @@ class PersonType extends AbstractType
'allow_delete' => true,
'by_reference' => false,
'label' => false,
- 'delete_empty' => function (?PersonPhone $pp = null) {
+ 'delete_empty' => static function (?PersonPhone $pp = null) {
return null === $pp || $pp->isEmpty();
},
'error_bubbling' => false,
@@ -192,7 +194,7 @@ class PersonType extends AbstractType
'choice_label' => function (Civility $civility): string {
return $this->translatableStringHelper->localize($civility->getName());
},
- 'query_builder' => function (EntityRepository $er): QueryBuilder {
+ 'query_builder' => static function (EntityRepository $er): QueryBuilder {
return $er->createQueryBuilder('c')
->where('c.active = true');
},
diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/EvaluationType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/EvaluationType.php
index a23a065d7..0c6bb0d32 100644
--- a/src/Bundle/ChillPersonBundle/Form/SocialWork/EvaluationType.php
+++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/EvaluationType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form\SocialWork;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php
index bd5c03584..4ea0a5e70 100644
--- a/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php
+++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/GoalType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form\SocialWork;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/ResultType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/ResultType.php
index 85f240792..a0219aaf3 100644
--- a/src/Bundle/ChillPersonBundle/Form/SocialWork/ResultType.php
+++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/ResultType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form\SocialWork;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php
index 9f340de46..1f1ae0810 100644
--- a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php
+++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form\SocialWork;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
diff --git a/src/Bundle/ChillPersonBundle/Form/Type/ClosingMotivePickerType.php b/src/Bundle/ChillPersonBundle/Form/Type/ClosingMotivePickerType.php
index 5f209e8a7..600720ddf 100644
--- a/src/Bundle/ChillPersonBundle/Form/Type/ClosingMotivePickerType.php
+++ b/src/Bundle/ChillPersonBundle/Form/Type/ClosingMotivePickerType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form\Type;
use Chill\MainBundle\Templating\Entity\ChillEntityRenderExtension;
diff --git a/src/Bundle/ChillPersonBundle/Form/Type/GenderType.php b/src/Bundle/ChillPersonBundle/Form/Type/GenderType.php
index 0949fce0b..43edfb8d0 100644
--- a/src/Bundle/ChillPersonBundle/Form/Type/GenderType.php
+++ b/src/Bundle/ChillPersonBundle/Form/Type/GenderType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form\Type;
use Chill\PersonBundle\Entity\Person;
diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php b/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php
index 5e0b7e14e..02335c397 100644
--- a/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php
+++ b/src/Bundle/ChillPersonBundle/Form/Type/PersonAltNameType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form\Type;
use Chill\MainBundle\Templating\TranslatableStringHelper;
diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php b/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php
index 8150551c9..00243349f 100644
--- a/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php
+++ b/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form\Type;
use Chill\MainBundle\Phonenumber\PhonenumberHelper;
diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PickPersonType.php b/src/Bundle/ChillPersonBundle/Form/Type/PickPersonType.php
index 422a372db..98572b8bc 100644
--- a/src/Bundle/ChillPersonBundle/Form/Type/PickPersonType.php
+++ b/src/Bundle/ChillPersonBundle/Form/Type/PickPersonType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form\Type;
use Chill\MainBundle\Entity\Center;
@@ -26,6 +28,8 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Translation\TranslatorInterface;
+use function in_array;
+use function is_array;
/**
* This type allow to pick a person.
@@ -108,11 +112,11 @@ class PickPersonType extends AbstractType
// add the default options
$resolver->setDefaults([
'class' => Person::class,
- 'choice_label' => function (Person $p) {
+ 'choice_label' => static function (Person $p) {
return $p->getFirstname() . ' ' . $p->getLastname();
},
'placeholder' => 'Pick a person',
- 'choice_attr' => function (Person $p) {
+ 'choice_attr' => static function (Person $p) {
return [
'data-center' => $p->getCenter()->getId(),
];
@@ -134,7 +138,7 @@ class PickPersonType extends AbstractType
protected function filterCentersfom(Options $options)
{
if (null === $options['role']) {
- $centers = array_map(function (GroupCenter $g) {
+ $centers = array_map(static function (GroupCenter $g) {
return $g->getCenter();
}, $this->user->getGroupCenters()->toArray());
} else {
@@ -158,9 +162,9 @@ class PickPersonType extends AbstractType
}
if (!in_array($c->getId(), array_map(
- function (Center $c) { return $c->getId(); },
+ static function (Center $c) { return $c->getId(); },
$centers
- ))) {
+ ), true)) {
throw new AccessDeniedException('The given center is not reachable');
}
$selectedCenters[] = $c;
diff --git a/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php b/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php
index dcd7b9075..c75b93f7a 100644
--- a/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php
+++ b/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Form\Type;
use Chill\MainBundle\Form\Type\DataTransformer\ObjectToIdTransformer;
@@ -17,6 +19,8 @@ use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
+use const SORT_FLAG_CASE;
+use const SORT_STRING;
/**
* A type to select the marital status.
diff --git a/src/Bundle/ChillPersonBundle/Household/MembersEditor.php b/src/Bundle/ChillPersonBundle/Household/MembersEditor.php
index 2a5254889..2d3749fa7 100644
--- a/src/Bundle/ChillPersonBundle/Household/MembersEditor.php
+++ b/src/Bundle/ChillPersonBundle/Household/MembersEditor.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Household;
use Chill\PersonBundle\Entity\Household\Household;
@@ -132,7 +134,7 @@ class MembersEditor
}
foreach ($this->membershipsAffected as $m) {
- if (in_array(spl_object_hash($m), $this->oldMembershipsHashes)) {
+ if (in_array(spl_object_hash($m), $this->oldMembershipsHashes, true)) {
$list->addAll($this->validator->validate($m, null, [self::VALIDATION_GROUP_AFFECTED]));
} else {
$list->addAll($this->validator->validate($m, null, [self::VALIDATION_GROUP_CREATED,
diff --git a/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php b/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php
index 884209136..a26841064 100644
--- a/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php
+++ b/src/Bundle/ChillPersonBundle/Household/MembersEditorFactory.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Household;
use Chill\PersonBundle\Entity\Household\Household;
diff --git a/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php
index 83394c239..fed840954 100644
--- a/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php
+++ b/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
diff --git a/src/Bundle/ChillPersonBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/AdminMenuBuilder.php
index 57ee8d75d..25996f7bf 100644
--- a/src/Bundle/ChillPersonBundle/Menu/AdminMenuBuilder.php
+++ b/src/Bundle/ChillPersonBundle/Menu/AdminMenuBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
diff --git a/src/Bundle/ChillPersonBundle/Menu/HouseholdMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/HouseholdMenuBuilder.php
index 7a2712be3..feb465f8d 100644
--- a/src/Bundle/ChillPersonBundle/Menu/HouseholdMenuBuilder.php
+++ b/src/Bundle/ChillPersonBundle/Menu/HouseholdMenuBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
diff --git a/src/Bundle/ChillPersonBundle/Menu/PersonMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/PersonMenuBuilder.php
index 3de6d6323..ee359434b 100644
--- a/src/Bundle/ChillPersonBundle/Menu/PersonMenuBuilder.php
+++ b/src/Bundle/ChillPersonBundle/Menu/PersonMenuBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
diff --git a/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php
index 52e2205e4..eff2e7a3a 100644
--- a/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php
+++ b/src/Bundle/ChillPersonBundle/Menu/SectionMenuBuilder.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
diff --git a/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationRenderer.php b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationRenderer.php
index fb3bd070b..c67c3d8a8 100644
--- a/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationRenderer.php
+++ b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodNotificationRenderer.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Notification;
use Chill\MainBundle\Entity\Notification;
@@ -26,6 +28,6 @@ final class AccompanyingPeriodNotificationRenderer
public function supports(Notification $notification)
{
- return $notification->getRelatedEntityClass() == AccompanyingPeriod::class;
+ return $notification->getRelatedEntityClass() === AccompanyingPeriod::class;
}
}
diff --git a/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php b/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php
index a3decb69e..7f8da3671 100644
--- a/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php
+++ b/src/Bundle/ChillPersonBundle/Privacy/AccompanyingPeriodPrivacyEvent.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Privacy;
/*
diff --git a/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php b/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php
index 39595adbb..0bfd7a435 100644
--- a/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php
+++ b/src/Bundle/ChillPersonBundle/Privacy/PrivacyEvent.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Privacy;
/*
@@ -31,6 +33,7 @@ namespace Chill\PersonBundle\Privacy;
use Chill\PersonBundle\Entity\Person;
use Symfony\Component\EventDispatcher\Event;
+use function count;
/**
* Class PrivacyEvent.
diff --git a/src/Bundle/ChillPersonBundle/Privacy/PrivacyEventSubscriber.php b/src/Bundle/ChillPersonBundle/Privacy/PrivacyEventSubscriber.php
index 958b8424f..5018743dc 100644
--- a/src/Bundle/ChillPersonBundle/Privacy/PrivacyEventSubscriber.php
+++ b/src/Bundle/ChillPersonBundle/Privacy/PrivacyEventSubscriber.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Privacy;
/*
@@ -73,7 +75,7 @@ class PrivacyEventSubscriber implements EventSubscriberInterface
$involved = $this->getInvolved();
$involved['period_id'] = $event->getPeriod()->getId();
$involved['persons'] = $event->getPeriod()->getPersons()
- ->map(function (Person $p) { return $p->getId(); })
+ ->map(static function (Person $p) { return $p->getId(); })
->toArray();
$this->logger->notice(
@@ -97,7 +99,7 @@ class PrivacyEventSubscriber implements EventSubscriberInterface
if ($event->hasPersons()) {
$involved['persons'] = array_map(
- function (Person $p) { return $p->getId(); },
+ static function (Person $p) { return $p->getId(); },
$event->getPersons()
);
}
diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkGoalRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkGoalRepository.php
index 4c0dd3fc4..1f432e4e0 100644
--- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkGoalRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkGoalRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkGoal;
diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php
index 0b6eff3c2..ea5b1feff 100644
--- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ClosingMotiveRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/CommentRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/CommentRepository.php
index 05e7c19e8..0da6fc662 100644
--- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/CommentRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/CommentRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/OriginRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/OriginRepository.php
index 9392180e2..5d7c10f7e 100644
--- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/OriginRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/OriginRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin;
diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ResourceRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ResourceRepository.php
index 339258e70..8eee0e9e4 100644
--- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ResourceRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/ResourceRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod\Resource;
diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php
index f2e4af721..965231e3f 100644
--- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php
@@ -16,6 +16,7 @@ use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
use Symfony\Component\Security\Core\Security;
+use function count;
final class AccompanyingPeriodACLAwareRepository implements AccompanyingPeriodACLAwareRepositoryInterface
{
diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepositoryInterface.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepositoryInterface.php
index 655b3792e..778e8d8fe 100644
--- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepositoryInterface.php
+++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepositoryInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository;
use Chill\PersonBundle\Entity\Person;
diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodParticipationRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodParticipationRepository.php
index c8fd4ad30..cbfb3e6d9 100644
--- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodParticipationRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodParticipationRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository;
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php
index d6ad39d57..b21431554 100644
--- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php
index f06812986..0649dae1c 100644
--- a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository\Household;
use Chill\MainBundle\Entity\AddressReference;
diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepositoryInterface.php b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepositoryInterface.php
index 1323361ee..e13d8b888 100644
--- a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepositoryInterface.php
+++ b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepositoryInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository\Household;
use Chill\MainBundle\Entity\AddressReference;
diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdRepository.php
index e03e232f0..8becf4409 100644
--- a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository\Household;
use Chill\PersonBundle\Entity\Household\Household;
@@ -25,10 +27,10 @@ final class HouseholdRepository implements ObjectRepository
FROM chill_person_accompanying_period_participation AS part
WHERE person_id = ?),
other_participants AS (
- SELECT person_id, startDate, endDate
+ SELECT person_id, startDate, endDate
FROM chill_person_accompanying_period_participation
JOIN participations USING (accompanyingperiod_id)
- WHERE person_id != ?
+ WHERE person_id != ?
),
households AS (SELECT DISTINCT household.*
FROM chill_person_household_members AS hmembers
diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/PersonHouseholdAddressRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/PersonHouseholdAddressRepository.php
index 8e9b789a7..2cd370260 100644
--- a/src/Bundle/ChillPersonBundle/Repository/Household/PersonHouseholdAddressRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/Household/PersonHouseholdAddressRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository\Household;
use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress;
diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/PositionRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/PositionRepository.php
index f8d264449..2ceab9b9e 100644
--- a/src/Bundle/ChillPersonBundle/Repository/Household/PositionRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/Household/PositionRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository\Household;
use Chill\PersonBundle\Entity\Household\Position;
diff --git a/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepository.php b/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepository.php
index c0558ef4e..58b4aa7fa 100644
--- a/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/MaritalStatusRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository;
use Chill\PersonBundle\Entity\MaritalStatus;
diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php
index b55e69655..972264282 100644
--- a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository;
use Chill\MainBundle\Entity\Center;
@@ -25,6 +27,7 @@ use function array_fill;
use function array_map;
use function array_merge;
use function array_push;
+use function count;
use function explode;
use function implode;
@@ -137,8 +140,9 @@ final class PersonACLAwareRepository implements PersonACLAwareRepositoryInterfac
$pertinence[] =
'STRICT_WORD_SIMILARITY(LOWER(UNACCENT(?)), person.fullnamecanonical) + ' .
"(person.fullnamecanonical LIKE '%' || LOWER(UNACCENT(?)) || '%')::int + " .
- "(EXISTS (SELECT 1 FROM unnest(string_to_array(fullnamecanonical, ' ')) AS t WHERE starts_with(t, UNACCENT(LOWER(?)))))::int";
- array_push($pertinenceArgs, $str, $str, $str);
+ "(EXISTS (SELECT 1 FROM unnest(string_to_array(fullnamecanonical, ' ')) AS t WHERE starts_with(t, UNACCENT(LOWER(?)))))::int + " .
+ '(starts_with(LOWER(UNACCENT(lastname)), UNACCENT(LOWER(?))))::int';
+ array_push($pertinenceArgs, $str, $str, $str, $str);
$orWhereSearchClause[] =
'(LOWER(UNACCENT(?)) <<% person.fullnamecanonical OR ' .
@@ -180,14 +184,14 @@ final class PersonACLAwareRepository implements PersonACLAwareRepositoryInterfac
if (null !== $birthdateBefore) {
$query->andWhereClause(
- 'p.birthdate < ?::date',
+ 'person.birthdate <= ?::date',
[$birthdateBefore->format('Y-m-d')]
);
}
if (null !== $birthdateAfter) {
$query->andWhereClause(
- 'p.birthdate > ?::date',
+ 'person.birthdate >= ?::date',
[$birthdateAfter->format('Y-m-d')]
);
}
@@ -312,7 +316,7 @@ final class PersonACLAwareRepository implements PersonACLAwareRepositoryInterfac
),
]
),
- array_map(function (Center $c) {return $c->getId(); }, $authorizedCenters)
+ array_map(static function (Center $c) {return $c->getId(); }, $authorizedCenters)
);
}
}
diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepositoryInterface.php b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepositoryInterface.php
index 7bb46d84f..72d4682c8 100644
--- a/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepositoryInterface.php
+++ b/src/Bundle/ChillPersonBundle/Repository/PersonACLAwareRepositoryInterface.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository;
use Chill\MainBundle\Search\SearchApiQuery;
diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonAltNameRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonAltNameRepository.php
index 5ef285e36..6e5533f78 100644
--- a/src/Bundle/ChillPersonBundle/Repository/PersonAltNameRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/PersonAltNameRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository;
use Chill\PersonBundle\Entity\PersonAltName;
diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonNotDuplicateRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonNotDuplicateRepository.php
index da650ec15..8fe586760 100644
--- a/src/Bundle/ChillPersonBundle/Repository/PersonNotDuplicateRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/PersonNotDuplicateRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository;
use Chill\PersonBundle\Entity\Person;
diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php
index d9b858139..57cea2d55 100644
--- a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository;
use Chill\PersonBundle\Entity\Person;
@@ -15,6 +17,7 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectRepository;
use Exception;
+use function count;
use function in_array;
use function str_replace;
@@ -126,11 +129,11 @@ final class PersonRepository implements ObjectRepository
$orX = $qb->expr()->orX();
- if (in_array('mobile', $only)) {
+ if (in_array('mobile', $only, true)) {
$orX->add($qb->expr()->like("REPLACE(p.mobilenumber, ' ', '')", ':phonenumber'));
}
- if (in_array('phone', $only)) {
+ if (in_array('phone', $only, true)) {
$orX->add($qb->expr()->like("REPLACE(p.phonenumber, ' ', '')", ':phonenumber'));
}
diff --git a/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationRepository.php b/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationRepository.php
index 22a95b3ca..ddf82ca8d 100644
--- a/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository\Relationships;
use Chill\PersonBundle\Entity\Relationships\Relation;
diff --git a/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationshipRepository.php b/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationshipRepository.php
index 2b2bf9136..ab172e459 100644
--- a/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationshipRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/Relationships/RelationshipRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository\Relationships;
use Chill\PersonBundle\Entity\Relationships\Relationship;
diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepository.php
index ac8e4d9d3..cb651b9ae 100644
--- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/EvaluationRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository\SocialWork;
use Chill\PersonBundle\Entity\SocialWork\Evaluation;
diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php
index 211d86ba0..ec74b1919 100644
--- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/GoalRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository\SocialWork;
use Chill\PersonBundle\Entity\SocialWork\Goal;
diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/ResultRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/ResultRepository.php
index 1dca70d1e..744c42577 100644
--- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/ResultRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/ResultRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository\SocialWork;
use Chill\PersonBundle\Entity\SocialWork\Goal;
diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php
index 1a8623d5e..fdf9d3b3f 100644
--- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php
@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Chill\PersonBundle\Repository\SocialWork;
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss
index 6c9687ff9..f39f64eb2 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss
+++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss
@@ -95,7 +95,6 @@ div.person-view {
* Header custom for Accompanying Course
*/
-
div.banner {
div#header-accompanying_course-name {
background: none repeat scroll 0 0 $chill-accourse-context;
@@ -117,6 +116,37 @@ div.banner {
color: $white;
padding-top: 1em;
padding-bottom: 1em;
+
+ /// AccompanyingCourse: HeaderSlider Carousel
+ button.carousel-control-prev,
+ button.carousel-control-next {
+ width: 8%;
+ opacity: inherit;
+ }
+ button.carousel-control-prev {
+ left: unset;
+ right: 0;
+ }
+ span.to-social-issues,
+ span.to-persons-associated {
+ display: inline-block;
+ border-radius: 15px;
+ width: 24px;
+ height: 24px;
+ box-shadow: 0 0 3px 1px grey;
+ opacity: 0.8;
+ &:hover {
+ opacity: 1;
+ }
+ }
+ span.to-social-issues {
+ background-color: #4bafe8;
+ border-left: 12px solid #32749a;
+ }
+ span.to-persons-associated {
+ background-color: #16d9b4;
+ border-right: 12px solid #ffffff;
+ }
}
}
@@ -203,34 +233,11 @@ div.household-resume {
}
}
-/// Horizontal list of persons (Accourse resume page)
-div.accompanyingcourse-resume {
- div.associated-persons {
- font-size: 110%;
- span.household {
- display: inline-block;
- border-radius: 8px;
- border: 1px solid $white;
- &:hover {
- border: 1px solid $chill-beige;
- i {
- display: inline-block;
- }
- }
- &.no-household:hover {
- border: 1px solid $white;
- }
- i {
- color: $chill-beige;
- display: none;
- }
- padding: 0.3em;
- margin-right: 2px;
- }
- }
-}
+/*
+* GENERIC PERSON STYLES
+* miscellaneous
+*/
-///
abbr.referrer { // still used ?
font-size: 70%;
padding-right: 0.4em;
@@ -246,4 +253,4 @@ abbr.referrer { // still used ?
.created-updated {
border: 1px solid black;
padding: 10px;
-}
\ No newline at end of file
+}
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/accompanying_period_work.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/accompanying_period_work.scss
index cc56fcbda..d246b3c92 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/accompanying_period_work.scss
+++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/accompanying_period_work.scss
@@ -87,26 +87,12 @@ div.accompanying_course_work-list {
&.result_list {
padding-left: 1em;
margin-bottom: 0;
- li {
- padding-left: 0.3em;
- &::marker {
- /*
- content: '→';
- font-weight: bold;
- font-size: 120%;
- */
- font-family: ForkAwesome;
- content: '\f04b';
- font-size: 75%;
- transform: rotate(45deg);
- }
- }
}
- &.goal_title li::marker {
- color: $social-issue-color;
+ &.goal_title {
+ @include list_marker_triangle($social-issue-color);
}
- &.result_list li::marker {
- color: $pink;
+ &.result_list {
+ @include list_marker_triangle($pink);
}
}
}
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/badge.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/badge.scss
index 7dc626858..6ffe0ac9d 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/badge.scss
+++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/badge.scss
@@ -49,8 +49,6 @@ h2.badge-title {
width: 100%;
color: $dark;
- a & { text-decoration: none; } // ?!? keep it ?
-
span.title_label {
border-radius: 0.35rem 0 0 0.35rem;
color: $white;
@@ -75,13 +73,43 @@ h2.badge-title {
flex-grow: 1;
margin: 0 0 0 auto;
border-radius: 0 0.35rem 0.35rem 0;
- background-color: $light;
+ background-color: $chill-llight-gray;
padding: 0.2em 1em;
ul.small_in_title {
- margin-top: 0.5em;
+ margin: 0;
+ //margin-top: 0.5em;
font-size: 70%;
padding-left: 1rem;
+ &.evaluations {
+ @include list_marker_triangle($orange);
+ }
+ }
+ ul.columns { // XS:1 SM:2 MD:1 LG:2 XL:2 XXL:2
+ @include media-breakpoint-only(sm) {
+ columns: 2; -webkit-columns: 2; -moz-columns: 2;
+ }
+ @include media-breakpoint-up(lg) {
+ columns: 2; -webkit-columns: 2; -moz-columns: 2;
+ }
+ }
+ }
+}
+
+/// Theses links apply on badge as parent tag.
+/// They don't look like button, picto or simple text links
+a.badge-link {
+ color: unset;
+ text-decoration: unset;
+ & > h2.badge-title {
+ &:hover {
+ //box-shadow: 0 0 7px 0 $chill-gray;
+ //opacity: 0.8;
+ }
+ span.title_action {
+ &:hover {
+ background-color: $chill-ll-gray;
+ }
}
}
}
@@ -128,35 +156,7 @@ div.activity-list {
}
}
-/// AccompanyingCourse: HeaderSlider Carousel
-div#header-accompanying_course-details {
- button.carousel-control-prev,
- button.carousel-control-next {
- width: 8%;
- opacity: inherit;
- }
- button.carousel-control-prev {
- left: unset;
- right: 0;
- }
- span.to-social-issues,
- span.to-persons-associated {
- display: inline-block;
- border-radius: 15px;
- width: 24px;
- height: 24px;
- box-shadow: 0 0 3px 1px grey;
- opacity: 0.8;
- &:hover {
- opacity: 1;
- }
- }
- span.to-social-issues {
- background-color: #4bafe8;
- border-left: 12px solid #32749a;
- }
- span.to-persons-associated {
- background-color: #16d9b4;
- border-right: 12px solid #ffffff;
- }
-}
+/*
+*/
+
+
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/mixins.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/mixins.scss
index 878ff82e1..8a3d21ece 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/mixins.scss
+++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/mixins.scss
@@ -37,3 +37,20 @@
margin: 0 0.3em 0 -1.05em;
}
}
+
+///
+/// Make list with items marker like a colored triangle
+///
+
+@mixin list_marker_triangle($color) {
+ & > li {
+ padding-left: 0.3em;
+ &::marker {
+ font-family: ForkAwesome;
+ content: '\f04b';
+ font-size: 75%;
+ transform: rotate(45deg);
+ color: $color;
+ }
+ }
+}
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/page/accompanying_course_index/masonry.js b/src/Bundle/ChillPersonBundle/Resources/public/page/accompanying_course_index/masonry.js
new file mode 100644
index 000000000..e2dadd2a9
--- /dev/null
+++ b/src/Bundle/ChillPersonBundle/Resources/public/page/accompanying_course_index/masonry.js
@@ -0,0 +1,6 @@
+import Masonry from 'masonry-layout/masonry';
+
+let elem = document.querySelector('#dashboards');
+let msnry = new Masonry( elem, {
+ // options
+});
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Banner/PersonsAssociated.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Banner/PersonsAssociated.vue
index 005350b96..00dc73bd2 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Banner/PersonsAssociated.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Banner/PersonsAssociated.vue
@@ -48,9 +48,7 @@ export default {
persons: this.persons.filter(p => p.current_household_id === h)
})
})
- console.log(personsByHousehold)
-
-
+ //console.log(personsByHousehold)
return personsByHousehold
},
householdExists(id) {
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Banner/ToggleFlags.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Banner/ToggleFlags.vue
index 459e5e758..39fe50acc 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Banner/ToggleFlags.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Banner/ToggleFlags.vue
@@ -21,6 +21,7 @@
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue
index 93363fed1..26e74e944 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue
@@ -47,6 +47,14 @@
+