apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -16,10 +16,8 @@ use Chill\MainBundle\Entity\Notification;
use Chill\MainBundle\Notification\NotificationPersisterInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Event\Person\PersonAddressMoveEvent;
use DateTimeImmutable;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Templating\EngineInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class PersonAddressMoveEventSubscriber implements EventSubscriberInterface
@@ -41,7 +39,7 @@ class PersonAddressMoveEventSubscriber implements EventSubscriberInterface
$person = $event->getPerson();
foreach ($person->getCurrentAccompanyingPeriods() as $period) {
if ($period->getStep() === AccompanyingPeriod::STEP_DRAFT) {
if (AccompanyingPeriod::STEP_DRAFT === $period->getStep()) {
continue;
}
@@ -49,7 +47,7 @@ class PersonAddressMoveEventSubscriber implements EventSubscriberInterface
$period->getPersonLocation() === $person
&& (
$event->getMoveDate() >= $period->getLastLocationHistory()->getStartDate()
|| $event->willChangeBeActiveAt(new DateTimeImmutable('now'))
|| $event->willChangeBeActiveAt(new \DateTimeImmutable('now'))
)
&& null !== $period->getUser()
&& $period->getUser() !== $this->security->getUser()

View File

@@ -18,7 +18,6 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Doctrine\Persistence\Event\LifecycleEventArgs;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Templating\EngineInterface;
use Symfony\Component\Workflow\Event\EnteredEvent;
use Symfony\Contracts\Translation\TranslatorInterface;
@@ -39,7 +38,7 @@ class UserRefEventSubscriber implements EventSubscriberInterface
{
if (
$enteredEvent->getMarking()->has(AccompanyingPeriod::STEP_CONFIRMED)
and $enteredEvent->getTransition()->getName() === 'confirm'
and 'confirm' === $enteredEvent->getTransition()->getName()
) {
$this->onPeriodConfirmed($enteredEvent->getSubject());
}
@@ -50,7 +49,7 @@ class UserRefEventSubscriber implements EventSubscriberInterface
if ($period->isChangedUser()
&& $period->getUser() !== $this->security->getUser()
&& null !== $period->getUser()
&& $period->getStep() !== AccompanyingPeriod::STEP_DRAFT
&& AccompanyingPeriod::STEP_DRAFT !== $period->getStep()
&& !$period->isPreventUserIsChangedNotification()
) {
$this->generateNotificationToUser($period);
@@ -62,12 +61,12 @@ class UserRefEventSubscriber implements EventSubscriberInterface
$notification = new Notification();
$urgentStatement =
$period->isEmergency() ? strtoupper($this->translator->trans('accompanying_period.emergency')) . ' ' : '';
$period->isEmergency() ? strtoupper($this->translator->trans('accompanying_period.emergency')).' ' : '';
$notification
->setRelatedEntityId($period->getId())
->setRelatedEntityClass(AccompanyingPeriod::class)
->setTitle($urgentStatement . $this->translator->trans('period_notification.period_designated_subject'))
->setTitle($urgentStatement.$this->translator->trans('period_notification.period_designated_subject'))
->setMessage($this->engine->render(
'@ChillPerson/Notification/accompanying_course_designation.md.twig',
[

View File

@@ -28,7 +28,7 @@ class AccompanyingPeriodStepChangeMessageHandler implements MessageHandlerInterf
public function __invoke(AccompanyingPeriodStepChangeRequestMessage $message): void
{
if (null === $period = $this->accompanyingPeriodRepository->find($message->getPeriodId())) {
throw new \RuntimeException(self::LOG_PREFIX . 'Could not find period with this id: '. $message->getPeriodId());
throw new \RuntimeException(self::LOG_PREFIX.'Could not find period with this id: '.$message->getPeriodId());
}
($this->changer)($period, $message->getTransition());

View File

@@ -14,7 +14,7 @@ namespace Chill\PersonBundle\AccompanyingPeriod\Lifecycle;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
/**
* Message which will request a change in the step of accompanying period
* Message which will request a change in the step of accompanying period.
*/
class AccompanyingPeriodStepChangeRequestMessage
{
@@ -31,7 +31,7 @@ class AccompanyingPeriodStepChangeRequestMessage
$this->periodId = $id;
}
throw new \LogicException("This AccompanyingPeriod does not have and id yet");
throw new \LogicException('This AccompanyingPeriod does not have and id yet');
}
}

View File

@@ -13,13 +13,12 @@ namespace Chill\PersonBundle\AccompanyingPeriod\Lifecycle;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodInfoRepositoryInterface;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Messenger\MessageBusInterface;
/**
* Gather all the accompanying period which needs a change in step
* Gather all the accompanying period which needs a change in step.
*/
class AccompanyingPeriodStepChangeRequestor
{

View File

@@ -17,7 +17,7 @@ use Psr\Log\LoggerInterface;
use Symfony\Component\Workflow\Registry;
/**
* Change the step of an accompanying period
* Change the step of an accompanying period.
*
* This should be invoked through scripts (not in the in context of an http request, or an
* action from a user).
@@ -32,14 +32,14 @@ class AccompanyingPeriodStepChanger
private readonly Registry $workflowRegistry,
) {}
public function __invoke(AccompanyingPeriod $period, string $transition, ?string $workflowName = null): void
public function __invoke(AccompanyingPeriod $period, string $transition, string $workflowName = null): void
{
$workflow = $this->workflowRegistry->get($period, $workflowName);
if (!$workflow->can($period, $transition)) {
$this->logger->info(self::LOG_PREFIX . 'not able to apply the transition on period', [
$this->logger->info(self::LOG_PREFIX.'not able to apply the transition on period', [
'period_id' => $period->getId(),
'transition' => $transition
'transition' => $transition,
]);
return;
@@ -49,9 +49,9 @@ class AccompanyingPeriodStepChanger
$this->entityManager->flush();
$this->logger->info(self::LOG_PREFIX . 'could apply a transition', [
$this->logger->info(self::LOG_PREFIX.'could apply a transition', [
'period_id' => $period->getId(),
'transition' => $transition
'transition' => $transition,
]);
}
}

View File

@@ -13,7 +13,6 @@ namespace Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\PrePersistEventArgs;
use Doctrine\ORM\Event\PreUpdateEventArgs;