From 6e6f19c4995a27c7c46c8df6df2b8298916d374a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 19 Jul 2023 16:28:51 +0200 Subject: [PATCH] fix small risky code --- .../Entity/CustomFieldsGroup.php | 12 +++--------- .../Entity/SocialWork/Evaluation.php | 2 +- .../Entity/SocialWork/SocialIssue.php | 6 +++--- src/Bundle/ChillTaskBundle/Entity/RecurringTask.php | 6 ------ 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php index c279a6c58..033dfd20e 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php @@ -95,10 +95,8 @@ class CustomFieldsGroup /** * Get all the custom. - * - * @return Collection */ - public function getActiveCustomFields() + public function getActiveCustomFields(): array { if (null === $this->activeCustomFields) { $this->activeCustomFields = []; @@ -143,15 +141,11 @@ class CustomFieldsGroup /** * Get name. - * - * @param mixed|null $language - * - * @return array */ - public function getName($language = null) + public function getName(?string $language = null): string|array { //TODO set this in a service, PLUS twig function - if ($language) { + if (null !== $language) { if (isset($this->name[$language])) { return $this->name[$language]; } diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php index 6c6b07985..3f033f34e 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php @@ -133,7 +133,7 @@ class Evaluation public function removeSocialAction(SocialAction $socialAction): self { if ($this->socialActions->contains($socialAction)) { - $this->socialActions->remove($socialAction); + $this->socialActions->removeElement($socialAction); } return $this; diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php index 3a03d2e16..113c8888d 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php @@ -92,7 +92,7 @@ class SocialIssue { if (!$this->socialActions->contains($socialAction)) { $this->socialActions[] = $socialAction; - $socialAction->setSocialIssue($this); + $socialAction->setIssue($this); } return $this; @@ -328,8 +328,8 @@ class SocialIssue { if ($this->socialActions->removeElement($socialAction)) { // set the owning side to null (unless already changed) - if ($socialAction->getSocialIssue() === $this) { - $socialAction->setSocialIssue(null); + if ($socialAction->getIssue() === $this) { + $socialAction->setIssue(null); } } diff --git a/src/Bundle/ChillTaskBundle/Entity/RecurringTask.php b/src/Bundle/ChillTaskBundle/Entity/RecurringTask.php index 6751466d5..557c12edd 100644 --- a/src/Bundle/ChillTaskBundle/Entity/RecurringTask.php +++ b/src/Bundle/ChillTaskBundle/Entity/RecurringTask.php @@ -55,14 +55,12 @@ class RecurringTask extends AbstractTask private $occurenceFrequency; /** - * @var dateinterval * * @ORM\Column(name="occurence_start_date", type="dateinterval") */ private $occurenceStartDate; /** - * @var dateinterval * * @ORM\Column(name="occurence_warning_interval", type="dateinterval", nullable=true) */ @@ -126,7 +124,6 @@ class RecurringTask extends AbstractTask /** * Get occurenceStartDate. * - * @return dateinterval */ public function getOccurenceStartDate() { @@ -136,7 +133,6 @@ class RecurringTask extends AbstractTask /** * Get occurenceWarningInterval. * - * @return dateinterval */ public function getOccurenceWarningInterval() { @@ -188,7 +184,6 @@ class RecurringTask extends AbstractTask /** * Set occurenceStartDate. * - * @param dateinterval $occurenceStartDate * * @return RecurringTask */ @@ -202,7 +197,6 @@ class RecurringTask extends AbstractTask /** * Set occurenceWarningInterval. * - * @param dateinterval $occurenceWarningInterval * * @return RecurringTask */