From f570fe92a5675bbac245590a97e146ce024b22b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 28 Jul 2023 02:40:02 +0200 Subject: [PATCH] apply rector rules --- .../DataFixtures/ORM/LoadActivity.php | 5 +-- .../Entity/ActivityReasonCategory.php | 7 +-- .../src/Entity/AsideActivity.php | 12 ++--- .../Controller/ChargeController.php | 25 +++-------- .../Controller/ElementController.php | 10 +---- .../Controller/ResourceController.php | 25 +++-------- .../ChillBudgetBundle/Entity/Charge.php | 3 +- .../Entity/CancelReason.php | 6 +-- .../DataFixtures/ORM/LoadOption.php | 2 +- .../Entity/CustomField.php | 16 ++----- .../Entity/CustomFieldLongChoice/Option.php | 21 ++++----- .../Entity/CustomFieldsGroup.php | 8 +--- .../Form/Type/ChoiceWithOtherType.php | 2 +- .../Form/Type/LinkedCustomFieldsType.php | 8 +--- .../Service/CustomFieldProvider.php | 2 +- .../Twig/CustomFieldRenderingTwig.php | 7 +-- .../Twig/CustomFieldsGroupRenderingTwig.php | 7 +-- .../CustomFields/CustomFieldsChoiceTest.php | 5 +-- .../CustomFields/CustomFieldsNumberTest.php | 5 +-- .../CustomFields/CustomFieldsTextTest.php | 5 +-- .../Tests/Service/CustomFieldsHelperTest.php | 10 +---- .../Twig/CustomFieldRenderingTwigTest.php | 10 +---- .../CustomFieldsGroupRenderingTwigTest.php | 10 +---- .../Helper/NormalizeNullValueHelper.php | 2 +- .../ChillDocStoreBundle/Entity/Document.php | 12 ++--- src/Bundle/ChillEventBundle/Entity/Event.php | 12 ++--- .../ChillEventBundle/Entity/Participation.php | 15 +++---- src/Bundle/ChillEventBundle/Entity/Role.php | 3 +- src/Bundle/ChillEventBundle/Entity/Status.php | 3 +- .../ParticipationControllerTest.php | 2 +- .../Entity/AbstractFamilyMember.php | 34 +++++--------- .../Controller/AbstractCRUDController.php | 2 - .../CRUD/Controller/ApiController.php | 7 --- .../CRUD/Controller/CRUDController.php | 12 ----- .../ChillUserSendRenewPasswordCodeCommand.php | 8 +--- .../Command/LoadAndUpdateLanguagesCommand.php | 7 ++- .../ORM/LoadAddressReferences.php | 5 +-- .../DataFixtures/ORM/LoadCountries.php | 5 +-- .../DataFixtures/ORM/LoadLanguages.php | 11 ++--- .../DataFixtures/ORM/LoadLocationType.php | 5 +-- .../DataFixtures/ORM/LoadPostalCodes.php | 4 +- .../DataFixtures/ORM/LoadUsers.php | 5 +-- .../Widget/AbstractWidgetsCompilerPass.php | 8 ++-- .../ChillMainBundle/Doctrine/DQL/Age.php | 4 +- .../ChillMainBundle/Doctrine/DQL/Extract.php | 2 +- .../Doctrine/DQL/GetJsonFieldByKey.php | 4 +- .../Doctrine/DQL/JsonAggregate.php | 2 +- .../Doctrine/DQL/JsonExtract.php | 4 +- .../Doctrine/DQL/JsonbArrayLength.php | 2 +- .../Doctrine/DQL/JsonbExistsInArray.php | 4 +- .../Doctrine/DQL/OverlapsI.php | 8 ++-- .../Doctrine/DQL/STContains.php | 4 +- .../ChillMainBundle/Doctrine/DQL/STX.php | 2 +- .../ChillMainBundle/Doctrine/DQL/STY.php | 2 +- .../Doctrine/DQL/Similarity.php | 4 +- .../Doctrine/DQL/StrictWordSimilarityOPS.php | 4 +- .../ChillMainBundle/Doctrine/DQL/ToChar.php | 4 +- .../ChillMainBundle/Doctrine/DQL/Unaccent.php | 2 +- .../Entity/Embeddable/CommentEmbeddable.php | 3 +- .../Entity/PermissionsGroup.php | 2 +- .../ChillMainBundle/Entity/PostalCode.php | 15 +++---- .../ChillMainBundle/Export/ExportManager.php | 5 +-- .../Export/Formatter/SpreadSheetFormatter.php | 8 +--- .../Form/Type/ComposedRoleScopeType.php | 9 ++-- .../Form/Type/TranslatableStringFormType.php | 2 +- .../Phonenumber/PhonenumberHelper.php | 2 +- .../ChillMainBundle/Routing/MenuTwig.php | 7 +-- .../ChillMainBundle/Search/SearchProvider.php | 6 +-- .../ChillMainBundle/Security/RoleProvider.php | 6 +-- .../Templating/Widget/WidgetRenderingTwig.php | 1 - .../Test/Export/AbstractExportTest.php | 8 ---- .../Tests/Controller/UserControllerTest.php | 2 +- .../Tests/Routing/Loader/RouteLoaderTest.php | 2 +- .../Tests/Search/AbstractSearchTest.php | 2 +- .../Tests/Search/SearchProviderTest.php | 5 +-- .../Timeline/TimelineBuilder.php | 6 +-- .../ChillMainBundle/Util/CountriesInfo.php | 2 +- .../migrations/Version20150821105642.php | 7 +-- .../ORM/LoadAccompanyingPeriodOrigin.php | 2 +- .../DataFixtures/ORM/LoadCustomFields.php | 4 +- .../DataFixtures/ORM/LoadMaritalStatus.php | 2 +- .../DataFixtures/ORM/LoadPeople.php | 4 +- .../DependencyInjection/Configuration.php | 2 +- .../Doctrine/DQL/AddressPart.php | 10 +---- .../Entity/AccompanyingPeriod.php | 6 +-- .../AccompanyingPeriodWorkGoal.php | 2 +- .../ChillPersonBundle/Entity/Person.php | 44 +++++++------------ .../Entity/PersonAltName.php | 4 +- .../Entity/PersonNotDuplicate.php | 15 ++----- .../Entity/SocialWork/Goal.php | 2 +- .../Entity/SocialWork/SocialAction.php | 10 ++--- .../Entity/SocialWork/SocialIssue.php | 6 +-- .../Export/Export/ListPerson.php | 2 +- .../Privacy/PrivacyEvent.php | 5 +-- .../Controller/PersonControllerUpdateTest.php | 14 ++---- ...onControllerUpdateWithHiddenFieldsTest.php | 14 ++---- .../Controller/PersonControllerViewTest.php | 12 ++--- ...rsonControllerViewWithHiddenFieldsTest.php | 12 ++--- .../Tests/Export/Export/CountPersonTest.php | 2 +- .../migrations/Version20210326113045.php | 2 +- .../DataFixtures/ORM/LoadReports.php | 7 +-- .../ChillReportBundle/Entity/Report.php | 15 +++---- .../ChillReportBundle/Search/ReportSearch.php | 5 +-- .../Tests/Controller/ReportControllerTest.php | 5 +-- .../Tests/Timeline/TimelineProviderTest.php | 24 ++-------- .../migrations/Version20150622233319.php | 5 +-- .../ChillTaskBundle/Entity/AbstractTask.php | 24 ++++------ .../ChillTaskBundle/Entity/RecurringTask.php | 2 +- .../ChillTaskBundle/Entity/SingleTask.php | 3 +- .../Entity/Task/AbstractTaskPlaceEvent.php | 19 +++----- .../ThirdPartyType/ThirdPartyTypeManager.php | 2 - .../migrations/Version20230215175150.php | 2 +- 112 files changed, 252 insertions(+), 562 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php index 9f0c59784..b205384e6 100644 --- a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php +++ b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php @@ -25,10 +25,7 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface { use \Symfony\Component\DependencyInjection\ContainerAwareTrait; - /** - * @var \Faker\Generator - */ - private $faker; + private readonly \Faker\Generator $faker; public function __construct(private readonly EntityManagerInterface $em) { diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php b/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php index 1bae408dc..0522d5037 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php @@ -25,10 +25,9 @@ use Doctrine\ORM\Mapping as ORM; class ActivityReasonCategory implements \Stringable { /** - * @var bool * @ORM\Column(type="boolean") */ - private $active = true; + private bool $active = true; /** * @var int @@ -122,11 +121,9 @@ class ActivityReasonCategory implements \Stringable * as unactive, all the reason have this entity as category is also * set as unactive. * - * @param bool $active - * * @return ActivityReasonCategory */ - public function setActive($active) + public function setActive(bool $active) { if ($this->active !== $active && !$active) { foreach ($this->reasons as $reason) { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php index 3dc205f09..ec318f413 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php @@ -34,7 +34,7 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="datetime") */ - private $createdAt; + private ?\DateTimeInterface $createdAt = null; /** * @ORM\ManyToOne(targetEntity=User::class) @@ -45,7 +45,7 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="datetime") */ - private $date; + private ?\DateTimeInterface $date = null; /** * @ORM\Column(type="time", nullable=true) @@ -62,23 +62,23 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface /** * @ORM\Column(type="string", length=100, nullable=true) */ - private $location; + private ?string $location = null; /** * @ORM\Column(type="text", nullable=true) */ - private $note; + private ?string $note = null; /** * @ORM\ManyToOne(targetEntity=AsideActivityCategory::class, inversedBy="asideActivities") * @ORM\JoinColumn(nullable=false) */ - private $type; + private ?\Chill\AsideActivityBundle\Entity\AsideActivityCategory $type = null; /** * @ORM\Column(type="datetime", nullable=true) */ - private $updatedAt; + private ?\DateTimeInterface $updatedAt = null; /** * @ORM\ManyToOne(targetEntity=User::class) diff --git a/src/Bundle/ChillBudgetBundle/Controller/ChargeController.php b/src/Bundle/ChillBudgetBundle/Controller/ChargeController.php index 5d4a8b3a4..4f057a939 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/ChargeController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/ChargeController.php @@ -21,12 +21,9 @@ use Symfony\Component\HttpFoundation\Request; class ChargeController extends AbstractElementController { /** - * @Route( - * "{_locale}/budget/charge/{id}/delete", - * name="chill_budget_charge_delete" - * ) * * @return \Symfony\Component\HttpFoundation\Response + * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/{id}/delete", name="chill_budget_charge_delete") */ public function deleteAction(Request $request, Charge $charge) { @@ -39,12 +36,9 @@ class ChargeController extends AbstractElementController } /** - * @Route( - * "{_locale}/budget/charge/{id}/edit", - * name="chill_budget_charge_edit" - * ) * * @return \Symfony\Component\HttpFoundation\Response + * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/{id}/edit", name="chill_budget_charge_edit") */ public function editAction(Request $request, Charge $charge) { @@ -57,12 +51,9 @@ class ChargeController extends AbstractElementController } /** - * @Route( - * "{_locale}/budget/charge/by-person/{id}/new", - * name="chill_budget_charge_new" - * ) * * @return \Symfony\Component\HttpFoundation\Response + * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/by-person/{id}/new", name="chill_budget_charge_new") */ public function newAction(Request $request, Person $person) { @@ -75,12 +66,9 @@ class ChargeController extends AbstractElementController } /** - * @Route( - * "{_locale}/budget/charge/by-household/{id}/new", - * name="chill_budget_charge_household_new" - * ) * * @return \Symfony\Component\HttpFoundation\Response + * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/by-household/{id}/new", name="chill_budget_charge_household_new") */ public function newHouseholdAction(Request $request, Household $household) { @@ -93,12 +81,9 @@ class ChargeController extends AbstractElementController } /** - * @Route( - * "{_locale}/budget/charge/{id}/view", - * name="chill_budget_charge_view" - * ) * * @return \Symfony\Component\HttpFoundation\Response + * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/{id}/view", name="chill_budget_charge_view") */ public function viewAction(Charge $charge) { diff --git a/src/Bundle/ChillBudgetBundle/Controller/ElementController.php b/src/Bundle/ChillBudgetBundle/Controller/ElementController.php index c949342b9..fdaae0163 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/ElementController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/ElementController.php @@ -36,10 +36,7 @@ class ElementController extends AbstractController } /** - * @Route( - * "{_locale}/budget/elements/by-person/{id}", - * name="chill_budget_elements_index" - * ) + * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/elements/by-person/{id}", name="chill_budget_elements_index") */ public function indexAction(Person $person) { @@ -63,10 +60,7 @@ class ElementController extends AbstractController } /** - * @Route( - * "{_locale}/budget/elements/by-household/{id}", - * name="chill_budget_elements_household_index" - * ) + * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/elements/by-household/{id}", name="chill_budget_elements_household_index") */ public function indexHouseholdAction(Household $household) { diff --git a/src/Bundle/ChillBudgetBundle/Controller/ResourceController.php b/src/Bundle/ChillBudgetBundle/Controller/ResourceController.php index e7f1e9ff3..eb02c3635 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/ResourceController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/ResourceController.php @@ -22,10 +22,7 @@ use Symfony\Component\HttpFoundation\Response; class ResourceController extends AbstractElementController { /** - * @Route( - * "{_locale}/budget/resource/{id}/delete", - * name="chill_budget_resource_delete" - * ) + * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/{id}/delete", name="chill_budget_resource_delete") */ public function deleteAction(Request $request, Resource $resource) { @@ -38,10 +35,7 @@ class ResourceController extends AbstractElementController } /** - * @Route( - * "{_locale}/budget/resource/{id}/edit", - * name="chill_budget_resource_edit" - * ) + * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/{id}/edit", name="chill_budget_resource_edit") */ public function editAction(Request $request, Resource $resource): Response { @@ -56,10 +50,7 @@ class ResourceController extends AbstractElementController /** * Create a new budget element for a person. * - * @Route( - * "{_locale}/budget/resource/by-person/{id}/new", - * name="chill_budget_resource_new" - * ) + * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/by-person/{id}/new", name="chill_budget_resource_new") */ public function newAction(Request $request, Person $person): Response { @@ -74,10 +65,7 @@ class ResourceController extends AbstractElementController /** * Create new budget element for a household. * - * @Route( - * "{_locale}/budget/resource/by-household/{id}/new", - * name="chill_budget_resource_household_new" - * ) + * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/by-household/{id}/new", name="chill_budget_resource_household_new") */ public function newHouseholdAction(Request $request, Household $household): Response { @@ -90,10 +78,7 @@ class ResourceController extends AbstractElementController } /** - * @Route( - * "{_locale}/budget/resource/{id}/view", - * name="chill_budget_resource_view" - * ) + * @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/{id}/view", name="chill_budget_resource_view") */ public function viewAction(Resource $resource): Response { diff --git a/src/Bundle/ChillBudgetBundle/Entity/Charge.php b/src/Bundle/ChillBudgetBundle/Entity/Charge.php index 50602e849..6040cb328 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/Charge.php +++ b/src/Bundle/ChillBudgetBundle/Entity/Charge.php @@ -46,10 +46,9 @@ class Charge extends AbstractElement implements HasCentersInterface private ?ChargeKind $charge = null; /** - * @var string * @ORM\Column(name="help", type="string", nullable=true) */ - private $help = self::HELP_NOT_RELEVANT; + private string $help = self::HELP_NOT_RELEVANT; /** * @ORM\Column(name="id", type="integer") diff --git a/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php b/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php index 3c4d80c94..c8be951fe 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php +++ b/src/Bundle/ChillCalendarBundle/Entity/CancelReason.php @@ -29,12 +29,12 @@ class CancelReason /** * @ORM\Column(type="boolean") */ - private $active; + private ?bool $active = null; /** * @ORM\Column(type="string", length=255) */ - private $canceledBy; + private ?string $canceledBy = null; /** * @ORM\Id @@ -46,7 +46,7 @@ class CancelReason /** * @ORM\Column(type="json") */ - private $name = []; + private array $name = []; public function getActive(): ?bool { diff --git a/src/Bundle/ChillCustomFieldsBundle/DataFixtures/ORM/LoadOption.php b/src/Bundle/ChillCustomFieldsBundle/DataFixtures/ORM/LoadOption.php index 5b2598ab7..8b827b535 100644 --- a/src/Bundle/ChillCustomFieldsBundle/DataFixtures/ORM/LoadOption.php +++ b/src/Bundle/ChillCustomFieldsBundle/DataFixtures/ORM/LoadOption.php @@ -37,7 +37,7 @@ class LoadOption extends AbstractFixture implements OrderedFixtureInterface */ public $fakerNl; - private $counter = 0; + private int $counter = 0; public function __construct() { diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php index 06aeb9f4f..4c466d20e 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php @@ -27,20 +27,16 @@ class CustomField final public const ONE_TO_ONE = 1; /** - * @var bool - * * @ORM\Column(type="boolean") */ - private $active = true; + private bool $active = true; /** - * @var CustomFieldsGroup - * * @ORM\ManyToOne( * targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldsGroup", * inversedBy="customFields") */ - private $customFieldGroup; + private ?\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldGroup = null; /** * @var int @@ -59,11 +55,9 @@ class CustomField private $name; /** - * @var array - * * @ORM\Column(type="json") */ - private $options = []; + private array $options = []; /** * @var float @@ -73,11 +67,9 @@ class CustomField private $ordering; /** - * @var bool - * * @ORM\Column(type="boolean") */ - private $required = false; + private false $required = false; /** * @var string diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php index 39eb7a153..92d228659 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice; +use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; @@ -22,10 +23,9 @@ use Doctrine\ORM\Mapping as ORM; class Option { /** - * @var bool * @ORM\Column(type="boolean") */ - private $active = true; + private bool $active = true; /** * @var Collection