Browse Source

add phpstan 'ergebnis' pack of rules and apply fixes

Olivier Massot 10 tháng trước cách đây
mục cha
commit
d58cf7788d
66 tập tin đã thay đổi với 223 bổ sung257 xóa
  1. 2 1
      composer.json
  2. 26 0
      phpstan.neon.dist
  3. 2 0
      src/ApiResources/Export/ExportRequestInterface.php
  4. 2 0
      src/ApiResources/OnlineRegistration/RegistrationAvailability.php
  5. 2 0
      src/ApiResources/OnlineRegistration/RegistrationStatus.php
  6. 2 0
      src/ApiResources/Organization/OrganizationCreationRequest.php
  7. 2 0
      src/ApiResources/Organization/OrganizationDeletionRequest.php
  8. 2 0
      src/ApiResources/Organization/OrganizationMemberCreationRequest.php
  9. 2 0
      src/Commands/AddSubdomainCommand.php
  10. 3 1
      src/Commands/CronCommand.php
  11. 2 0
      src/Commands/Doctrine/SchemaUpdateCommand.php
  12. 2 0
      src/Commands/Doctrine/SchemaValidateCommand.php
  13. 5 3
      src/Commands/PostUpgrade/V0_2/PostUpgradeCommand.php
  14. 2 0
      src/Commands/SetupEnvCommand.php
  15. 2 0
      src/DataFixtures/AppFixtures.php
  16. 2 0
      src/Doctrine/ORM/AST/SphericalDistance.php
  17. 2 0
      src/Entity/Billing/BillAccountingInterface.php
  18. 2 0
      src/Entity/Booking/AttendanceBookingReason.php
  19. 0 87
      src/Entity/OnlineRegistration/OnlineRegistrationOpeningPeriod.php
  20. 0 142
      src/Entity/OnlineRegistration/OnlineRegistrationSettings.php
  21. 35 1
      src/Entity/Organization/OnlineRegistrationOpeningPeriod.php
  22. 29 1
      src/Entity/Organization/OnlineRegistrationSettings.php
  23. 2 0
      src/EventListener/OnKernelRequestPreRead.php
  24. 2 0
      src/Filter/Doctrine/TimeConstraint/AbstractTimeFilter.php
  25. 2 0
      src/Filter/Doctrine/TimeConstraint/ActivityYearFilter.php
  26. 2 0
      src/Filter/Doctrine/TimeConstraint/DatetimeFilter.php
  27. 0 11
      src/Filter/Doctrine/TimeConstraint/TimeConstraintInterface.php
  28. 2 0
      src/Kernel.php
  29. 2 0
      src/Message/Handler/Typo3/Typo3DeleteHandler.php
  30. 2 0
      src/Message/Handler/Typo3/Typo3UndeleteHandler.php
  31. 2 0
      src/Message/Handler/Typo3/Typo3UpdateHandler.php
  32. 2 0
      src/Security/Voter/EntityVoter/AbstractEntityVoter.php
  33. 2 0
      src/Service/ApiLegacy/ApiLegacyRequestService.php
  34. 2 0
      src/Service/ApiResourceBuilder/Mobyt/MobytUserStatusBuilder.php
  35. 2 0
      src/Service/Constraint/TimeConstraintInterface.php
  36. 2 0
      src/Service/Core/AddressPostalUtils.php
  37. 2 0
      src/Service/Cron/BaseCronJob.php
  38. 2 0
      src/Service/Cron/CronjobInterface.php
  39. 2 0
      src/Service/Cron/Job/CleanDb.php
  40. 2 0
      src/Service/Cron/Job/CleanTempFiles.php
  41. 2 0
      src/Service/Cron/Job/DolibarrSync.php
  42. 2 0
      src/Service/Cron/Job/SchemaValidation.php
  43. 2 0
      src/Service/Cron/UI/ConsoleUI.php
  44. 2 0
      src/Service/Cron/UI/CronUIInterface.php
  45. 2 0
      src/Service/Cron/UI/SilentUI.php
  46. 2 0
      src/Service/Doctrine/FiltersConfigurationService.php
  47. 3 2
      src/Service/Doctrine/SchemaValidation/SchemaSnippetsMaker.php
  48. 2 0
      src/Service/Education/Utils.php
  49. 2 0
      src/Service/OnChange/OnChangeContext.php
  50. 2 0
      src/Service/OnChange/OnChangeDefault.php
  51. 2 0
      src/Service/OnChange/OnChangeInterface.php
  52. 2 0
      src/Service/OnlineRegistration/OnlineRegistrationService.php
  53. 2 0
      src/Service/OnlineRegistration/RegistrationStatusService.php
  54. 10 8
      src/Service/Organization/OrganizationFactory.php
  55. 2 0
      src/Service/Security/InternalRequestsService.php
  56. 2 0
      src/Service/ServiceIterator/CronjobIterator.php
  57. 2 0
      src/Service/Typo3/BindFileService.php
  58. 2 0
      src/Service/Typo3/SubdomainService.php
  59. 2 0
      src/Service/Typo3/Typo3Service.php
  60. 2 0
      src/Service/Utils/ObjectUtils.php
  61. 2 0
      src/Service/Utils/Parser/ParserInterface.php
  62. 2 0
      src/Service/Utils/Uuid.php
  63. 2 0
      src/State/Processor/EntityProcessor.php
  64. 2 0
      src/State/Provider/OnlineRegistration/RegistrationAvailabilityProvider.php
  65. 2 0
      src/State/Provider/OnlineRegistration/RegistrationStatusProvider.php
  66. 2 0
      src/State/Provider/Organization/Subdomain/SubdomainAvailabilityProvider.php

+ 2 - 1
composer.json

@@ -80,10 +80,11 @@
     "cyclonedx/cyclonedx-php-composer": "^3.4",
     "dg/bypass-finals": "^1.4",
     "doctrine/doctrine-fixtures-bundle": "^3.4",
+    "ergebnis/phpstan-rules": "^2.5",
     "friendsofphp/php-cs-fixer": "^3.52.1",
     "hautelook/alice-bundle": "^2.11",
     "justinrainbow/json-schema": "^5.2",
-    "phpstan/extension-installer": "^1.2",
+    "phpstan/extension-installer": "^1.4",
     "phpstan/phpstan": "^1.10",
     "phpstan/phpstan-doctrine": "^1.3",
     "phpstan/phpstan-phpunit": "^1.3",

+ 26 - 0
phpstan.neon.dist

@@ -11,3 +11,29 @@ parameters:
         - '#Attribute class JetBrains\\PhpStorm\\[a-zA-Z]+ does not exist.#'
         - identifier: missingType.generics
 
+    ergebnis:
+        # TODO: simplify by using allRules: false (https://github.com/ergebnis/phpstan-rules?tab=readme-ov-file#enabling-rules-one-by-one)
+        final:
+            enabled: false
+        noExtends:
+            enabled: false
+        noNullableReturnTypeDeclaration:
+            enabled: false
+        noParameterWithNullableTypeDeclaration:
+            enabled: false
+        noParameterWithNullDefaultValue:
+            enabled: false
+        noCompact:
+            enabled: false
+        noIsset:
+            enabled: false
+        finalInAbstractClass:
+            enabled: false
+        noConstructorParameterWithDefaultValue:
+            enabled: false
+        noParameterWithContainerTypeDeclaration:
+            enabled: false
+        noSwitch:
+            enabled: false
+        privateInFinalClass:
+            enabled: false

+ 2 - 0
src/ApiResources/Export/ExportRequestInterface.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\ApiResources\Export;
 
 interface ExportRequestInterface

+ 2 - 0
src/ApiResources/OnlineRegistration/RegistrationAvailability.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\ApiResources\OnlineRegistration;
 
 use ApiPlatform\Metadata\ApiProperty;

+ 2 - 0
src/ApiResources/OnlineRegistration/RegistrationStatus.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\ApiResources\OnlineRegistration;
 
 use ApiPlatform\Metadata\ApiProperty;

+ 2 - 0
src/ApiResources/Organization/OrganizationCreationRequest.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\ApiResources\Organization;
 
 use ApiPlatform\Metadata\ApiProperty;

+ 2 - 0
src/ApiResources/Organization/OrganizationDeletionRequest.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\ApiResources\Organization;
 
 use ApiPlatform\Metadata\ApiProperty;

+ 2 - 0
src/ApiResources/Organization/OrganizationMemberCreationRequest.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\ApiResources\Organization;
 
 use App\Enum\Core\FileTypeEnum;

+ 2 - 0
src/Commands/AddSubdomainCommand.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Commands;
 
 use App\Repository\Organization\OrganizationRepository;

+ 3 - 1
src/Commands/CronCommand.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Commands;
 
 use App\Service\Cron\CronjobInterface;
@@ -221,7 +223,7 @@ class CronCommand extends Command
             $this->output->writeln($formatter->formatSection($job->name(), $msg));
             $this->logger->info($job->name().' - '.$msg);
         } catch (\Throwable $e) {
-            $this->logger->critical($e);
+            $this->logger->critical((string)$e);
             $this->output->write('An error happened while running the process : '.$e);
 
             return Command::FAILURE;

+ 2 - 0
src/Commands/Doctrine/SchemaUpdateCommand.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 /** @noinspection PhpUnused */
 
 namespace App\Commands\Doctrine;

+ 2 - 0
src/Commands/Doctrine/SchemaValidateCommand.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 /** @noinspection PhpUnused */
 
 namespace App\Commands\Doctrine;

+ 5 - 3
src/Commands/PostUpgrade/V0_2/PostUpgradeCommand.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Commands\PostUpgrade\V0_2;
 
 use Psr\Log\LoggerInterface;
@@ -154,7 +156,7 @@ class PostUpgradeCommand extends Command
             $this->logger->info('Subdomain table was successfully populated');
         } catch (\Exception $e) {
             $opentalentCnn->rollBack();
-            $this->logger->error($e);
+            $this->logger->error((string)$e);
             $this->logger->critical('Error while populating the subdomains, abort and rollback');
         }
     }
@@ -179,7 +181,7 @@ class PostUpgradeCommand extends Command
             $this->logger->info('Events uuid were successfully generated');
         } catch (\Exception $e) {
             $opentalentCnn->rollBack();
-            $this->logger->error($e);
+            $this->logger->error((string)$e);
             $this->logger->critical('Error while generating events uuids, abort and rollback');
         }
     }
@@ -200,7 +202,7 @@ class PostUpgradeCommand extends Command
             $this->logger->info('Files statuses were successfully updated');
         } catch (\Exception $e) {
             $opentalentCnn->rollBack();
-            $this->logger->error($e);
+            $this->logger->error((string)$e);
             $this->logger->critical('Error while updating file statuses, abort and rollback');
         }
     }

+ 2 - 0
src/Commands/SetupEnvCommand.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Commands;
 
 use App\Service\Utils\PathUtils;

+ 2 - 0
src/DataFixtures/AppFixtures.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\DataFixtures;
 
 use Doctrine\Bundle\FixturesBundle\Fixture;

+ 2 - 0
src/Doctrine/ORM/AST/SphericalDistance.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Doctrine\ORM\AST;
 
 use Doctrine\ORM\Query\AST\ASTException;

+ 2 - 0
src/Entity/Billing/BillAccountingInterface.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Entity\Billing;
 
 interface BillAccountingInterface

+ 2 - 0
src/Entity/Booking/AttendanceBookingReason.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Entity\Booking;
 
 use ApiPlatform\Metadata\ApiResource;

+ 0 - 87
src/Entity/OnlineRegistration/OnlineRegistrationOpeningPeriod.php

@@ -1,87 +0,0 @@
-<?php
-
-namespace App\Entity\OnlineRegistration;
-
-use ApiPlatform\Metadata\ApiResource;
-use Doctrine\ORM\Mapping as ORM;
-
-/**
- * Période d'ouverture de l'IEL pour une organisation.
- */
-// #[ApiResource(operations: [])]
-// #[ORM\Entity]
-class OnlineRegistrationOpeningPeriod
-{
-    #[ORM\Id]
-    #[ORM\Column]
-    #[ORM\GeneratedValue]
-    private ?int $id = null;
-
-    #[ORM\ManyToOne(inversedBy: 'onlineRegistrationOpeningPeriods')]
-    #[ORM\JoinColumn(nullable: false)]
-    private ?OnlineRegistrationSettings $onlineRegistrationSettings = null;
-
-    /**
-     * TODO: c'est quoi?
-     */
-    #[ORM\ManyToOne(inversedBy: 'onlineRegistrationOpeningPeriods')]
-    #[ORM\JoinColumn(nullable: false)]
-    private ?OnlineRegistrationSettings $onlineRegistrationSettingsNewEnrolments = null;
-
-    /**
-     * Date de début de la période d'IEL.
-     */
-    #[ORM\Column(type: 'datetime', nullable: false)]
-    private \DateTimeInterface $startDate;
-
-    /**
-     * Date de fin de la période d'IEL.
-     */
-    #[ORM\Column(type: 'datetime', nullable: false)]
-    private \DateTimeInterface $endDate;
-
-    public function getId(): ?int
-    {
-        return $this->id;
-    }
-
-    public function getOnlineRegistrationSettings(): ?OnlineRegistrationSettings
-    {
-        return $this->onlineRegistrationSettings;
-    }
-
-    public function setOnlineRegistrationSettings(?OnlineRegistrationSettings $onlineRegistrationSettings): void
-    {
-        $this->onlineRegistrationSettings = $onlineRegistrationSettings;
-    }
-
-    public function getOnlineRegistrationSettingsNewEnrolments(): ?OnlineRegistrationSettings
-    {
-        return $this->onlineRegistrationSettingsNewEnrolments;
-    }
-
-    public function setOnlineRegistrationSettingsNewEnrolments(?OnlineRegistrationSettings $onlineRegistrationSettingsNewEnrolments): void
-    {
-        $this->onlineRegistrationSettingsNewEnrolments = $onlineRegistrationSettingsNewEnrolments;
-    }
-
-    public function getStartDate(): \DateTimeInterface
-    {
-        return $this->startDate;
-    }
-
-    public function setStartDate(\DateTimeInterface $startDate): void
-    {
-        $this->startDate = $startDate;
-    }
-
-    public function getEndDate(): \DateTimeInterface
-    {
-        return $this->endDate;
-    }
-
-    public function setEndDate(\DateTimeInterface $endDate): void
-    {
-        $this->endDate = $endDate;
-    }
-}

+ 0 - 142
src/Entity/OnlineRegistration/OnlineRegistrationSettings.php

@@ -1,142 +0,0 @@
-<?php
-
-namespace App\Entity\OnlineRegistration;
-
-use ApiPlatform\Metadata\ApiResource;
-use App\Entity\Organization\Organization;
-use Doctrine\Common\Collections\ArrayCollection;
-use Doctrine\Common\Collections\Collection;
-use Doctrine\ORM\Mapping as ORM;
-use JetBrains\PhpStorm\Pure;
-
-/**
- * Configuration de l'IEL pour une organization.
- */
-// #[ApiResource(operations: [])]
-// #[ORM\Entity]
-class OnlineRegistrationSettings
-{
-    #[ORM\Id]
-    #[ORM\Column]
-    #[ORM\GeneratedValue]
-    private ?int $id = null;
-
-    #[ORM\OneToOne(inversedBy: 'organization', targetEntity: Organization::class)]
-    private Organization $organization;
-
-    #[ORM\OneToMany(mappedBy: 'onlineRegistrationSettings', targetEntity: OnlineRegistrationOpeningPeriod::class, orphanRemoval: true)]
-    private Collection $openingPeriods;
-
-    #[ORM\OneToMany(mappedBy: 'onlineRegistrationSettingsNewEnrolments', targetEntity: OnlineRegistrationOpeningPeriod::class, orphanRemoval: true)]
-    private Collection $openingPeriodsNewEnrolments;
-
-    /**
-     * TODO: compléter la doc.
-     */
-    #[ORM\Column]
-    private bool $addNewStudents = false;
-
-    /**
-     * TODO: compléter la doc.
-     */
-    #[ORM\Column]
-    private bool $addNewEducations = false;
-
-    #[Pure]
-    public function __construct()
-    {
-        $this->openingPeriods = new ArrayCollection();
-        $this->openingPeriodsNewEnrolments = new ArrayCollection();
-    }
-
-    public function getId(): ?int
-    {
-        return $this->id;
-    }
-
-    public function getOrganization(): Organization
-    {
-        return $this->organization;
-    }
-
-    public function setOrganization(Organization $organization): void
-    {
-        $this->organization = $organization;
-    }
-
-    public function getOnlineRegistrationOpeningPeriods(): Collection
-    {
-        return $this->openingPeriods;
-    }
-
-    public function addOnlineRegistrationOpeningPeriod(OnlineRegistrationOpeningPeriod $openingPeriod): self
-    {
-        if (!$this->openingPeriods->contains($openingPeriod)) {
-            $this->openingPeriods[] = $openingPeriod;
-            $openingPeriod->setOnlineRegistrationSettings($this);
-        }
-
-        return $this;
-    }
-
-    public function removeOnlineRegistrationOpeningPeriod(OnlineRegistrationOpeningPeriod $openingPeriod): self
-    {
-        if ($this->openingPeriods->removeElement($openingPeriod)) {
-            // set the owning side to null (unless already changed)
-            if ($openingPeriod->getOnlineRegistrationSettings() === $this) {
-                $openingPeriod->setOnlineRegistrationSettings(null);
-            }
-        }
-
-        return $this;
-    }
-
-    public function getOnlineRegistrationOpeningPeriodsNewEnrolments(): Collection
-    {
-        return $this->openingPeriodsNewEnrolments;
-    }
-
-    public function addOnlineRegistrationOpeningPeriodNewEnrolments(OnlineRegistrationOpeningPeriod $openingPeriod): self
-    {
-        if (!$this->openingPeriodsNewEnrolments->contains($openingPeriod)) {
-            $this->openingPeriodsNewEnrolments[] = $openingPeriod;
-            $openingPeriod->setOnlineRegistrationSettingsNewEnrolments($this);
-        }
-
-        return $this;
-    }
-
-    public function removeOnlineRegistrationOpeningPeriodNewEnrolments(OnlineRegistrationOpeningPeriod $openingPeriod): self
-    {
-        if ($this->openingPeriodsNewEnrolments->removeElement($openingPeriod)) {
-            // set the owning side to null (unless already changed)
-            if ($openingPeriod->getOnlineRegistrationSettingsNewEnrolments() === $this) {
-                $openingPeriod->setOnlineRegistrationSettingsNewEnrolments(null);
-            }
-        }
-
-        return $this;
-    }
-
-    // TODO: confirmer que l'action est bien `can`
-    public function canAddNewStudents(): bool
-    {
-        return $this->addNewStudents;
-    }
-
-    public function setAddNewStudents(bool $addNewStudents): void
-    {
-        $this->addNewStudents = $addNewStudents;
-    }
-
-    // TODO: confirmer que l'action est bien `can`
-    public function canAddNewEducations(): bool
-    {
-        return $this->addNewEducations;
-    }
-
-    public function setAddNewEducations(bool $addNewEducations): void
-    {
-        $this->addNewEducations = $addNewEducations;
-    }
-}

+ 35 - 1
src/Entity/Organization/OnlineRegistrationOpeningPeriod.php

@@ -8,7 +8,7 @@ namespace App\Entity\Organization;
 use Doctrine\ORM\Mapping as ORM;
 
 /**
- * Classe ... qui ...
+ * Période d'ouverture de l'IEL pour une organisation.
  */
 // #[Auditable]
 #[ORM\Entity]
@@ -27,6 +27,18 @@ class OnlineRegistrationOpeningPeriod
     #[ORM\JoinColumn]
     private OnlineRegistrationSettings $onlineRegistrationSettingsNewEnrolments;
 
+    /**
+     * Date de début de la période d'IEL.
+     */
+    #[ORM\Column(type: 'datetime', nullable: false)]
+    private \DateTimeInterface $startDate;
+
+    /**
+     * Date de fin de la période d'IEL.
+     */
+    #[ORM\Column(type: 'datetime', nullable: false)]
+    private \DateTimeInterface $endDate;
+
     public function getId(): ?int
     {
         return $this->id;
@@ -55,4 +67,26 @@ class OnlineRegistrationOpeningPeriod
 
         return $this;
     }
+
+    public function getStartDate(): \DateTimeInterface
+    {
+        return $this->startDate;
+    }
+
+    public function setStartDate(\DateTimeInterface $startDate): self
+    {
+        $this->startDate = $startDate;
+        return $this;
+    }
+
+    public function getEndDate(): \DateTimeInterface
+    {
+        return $this->endDate;
+    }
+
+    public function setEndDate(\DateTimeInterface $endDate): self
+    {
+        $this->endDate = $endDate;
+        return $this;
+    }
 }

+ 29 - 1
src/Entity/Organization/OnlineRegistrationSettings.php

@@ -11,7 +11,7 @@ use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
 
 /**
- * Classe ... qui ...
+ * Configuration de l'IEL pour une organization.
  */
 // #[Auditable]
 #[ORM\Entity]
@@ -43,6 +43,12 @@ class OnlineRegistrationSettings
     #[ORM\OneToOne(inversedBy: 'onlineRegistrationSettings', targetEntity: Organization::class, cascade: [])]
     protected Organization $organization;
 
+    #[ORM\Column]
+    private bool $addNewStudents = false;
+
+    #[ORM\Column]
+    private bool $addNewEducations = false;
+
     #[ORM\OneToMany(
         mappedBy: 'adultStudentOnlineRegistrationSettings',
         targetEntity: OnlineRegistrationDocument::class,
@@ -259,6 +265,28 @@ class OnlineRegistrationSettings
         return $this;
     }
 
+    public function isAddNewStudents(): bool
+    {
+        return $this->addNewStudents;
+    }
+
+    public function setAddNewStudents(bool $addNewStudents): self
+    {
+        $this->addNewStudents = $addNewStudents;
+        return $this;
+    }
+
+    public function isAddNewEducations(): bool
+    {
+        return $this->addNewEducations;
+    }
+
+    public function setAddNewEducations(bool $addNewEducations): self
+    {
+        $this->addNewEducations = $addNewEducations;
+        return $this;
+    }
+
     public function getAdultStudentDocuments(): Collection
     {
         return $this->adultStudentDocuments;

+ 2 - 0
src/EventListener/OnKernelRequestPreRead.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\EventListener;
 
 use ApiPlatform\Symfony\EventListener\EventPriorities;

+ 2 - 0
src/Filter/Doctrine/TimeConstraint/AbstractTimeFilter.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Filter\Doctrine\TimeConstraint;
 
 use App\Service\Constraint\ActivityYearConstraint;

+ 2 - 0
src/Filter/Doctrine/TimeConstraint/ActivityYearFilter.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Filter\Doctrine\TimeConstraint;
 
 use App\Attribute\ActivityYearConstraintAware;

+ 2 - 0
src/Filter/Doctrine/TimeConstraint/DatetimeFilter.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Filter\Doctrine\TimeConstraint;
 
 use App\Attribute\DateTimeConstraintAware;

+ 0 - 11
src/Filter/Doctrine/TimeConstraint/TimeConstraintInterface.php

@@ -1,11 +0,0 @@
-<?php
-
-namespace App\Filter\Doctrine\TimeConstraint;
-
-interface TimeConstraintInterface
-{
-    /**
-     * @return array<string, array<string, list<int>>>
-     */
-    public function invoke(int $accessId): array;
-}

+ 2 - 0
src/Kernel.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App;
 
 use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;

+ 2 - 0
src/Message/Handler/Typo3/Typo3DeleteHandler.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Message\Handler\Typo3;
 
 use App\Message\Message\Typo3\Typo3Delete;

+ 2 - 0
src/Message/Handler/Typo3/Typo3UndeleteHandler.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Message\Handler\Typo3;
 
 use App\Message\Message\Typo3\Typo3Undelete;

+ 2 - 0
src/Message/Handler/Typo3/Typo3UpdateHandler.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Message\Handler\Typo3;
 
 use App\Message\Message\Typo3\Typo3Update;

+ 2 - 0
src/Security/Voter/EntityVoter/AbstractEntityVoter.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Security\Voter\EntityVoter;
 
 use App\Entity\Access\Access;

+ 2 - 0
src/Service/ApiLegacy/ApiLegacyRequestService.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\ApiLegacy;
 
 use App\Entity\Access\Access;

+ 2 - 0
src/Service/ApiResourceBuilder/Mobyt/MobytUserStatusBuilder.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\ApiResourceBuilder\Mobyt;
 
 use App\ApiResources\Mobyt\MobytUserStatus;

+ 2 - 0
src/Service/Constraint/TimeConstraintInterface.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Constraint;
 
 interface TimeConstraintInterface

+ 2 - 0
src/Service/Core/AddressPostalUtils.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Core;
 
 use App\Entity\Core\AddressPostal;

+ 2 - 0
src/Service/Cron/BaseCronJob.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Cron;
 
 use App\Service\Cron\UI\CronUIInterface;

+ 2 - 0
src/Service/Cron/CronjobInterface.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Cron;
 
 use App\Service\Cron\UI\CronUIInterface;

+ 2 - 0
src/Service/Cron/Job/CleanDb.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Cron\Job;
 
 use App\Service\Cron\BaseCronJob;

+ 2 - 0
src/Service/Cron/Job/CleanTempFiles.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Cron\Job;
 
 use App\Entity\Core\File;

+ 2 - 0
src/Service/Cron/Job/DolibarrSync.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Cron\Job;
 
 use App\Service\Cron\BaseCronJob;

+ 2 - 0
src/Service/Cron/Job/SchemaValidation.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Cron\Job;
 
 use App\Service\Cron\BaseCronJob;

+ 2 - 0
src/Service/Cron/UI/ConsoleUI.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Cron\UI;
 
 use Symfony\Component\Console\Helper\ProgressBar;

+ 2 - 0
src/Service/Cron/UI/CronUIInterface.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Cron\UI;
 
 /**

+ 2 - 0
src/Service/Cron/UI/SilentUI.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Cron\UI;
 
 /**

+ 2 - 0
src/Service/Doctrine/FiltersConfigurationService.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Doctrine;
 
 use App\Filter\Doctrine\TimeConstraint\AbstractTimeFilter;

+ 3 - 2
src/Service/Doctrine/SchemaValidation/SchemaSnippetsMaker.php

@@ -8,6 +8,7 @@ use ApiPlatform\Metadata\ApiResource;
 use App\Service\Utils\EntityUtils;
 use App\Service\Utils\FileUtils;
 use App\Service\Utils\Path;
+use App\Service\Utils\PathUtils;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping\ClassMetadataInfo;
 use Doctrine\ORM\Mapping\Column;
@@ -170,7 +171,7 @@ class SchemaSnippetsMaker
      */
     protected function getSnippetsDir(): string
     {
-        return Path::join(Path::getProjectDir(), 'schema_validation_snippets');
+        return PathUtils::join(PathUtils::getProjectDir(), 'schema_validation_snippets');
     }
 
     /**
@@ -197,7 +198,7 @@ class SchemaSnippetsMaker
 
         $relativePath = str_replace('\\', '/', $fullName).'.php';
 
-        return Path::join($snippetsDir, $relativePath);
+        return PathUtils::join($snippetsDir, $relativePath);
     }
 
     /**

+ 2 - 0
src/Service/Education/Utils.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Education;
 
 use App\Entity\Organization\Organization;

+ 2 - 0
src/Service/OnChange/OnChangeContext.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\OnChange;
 
 class OnChangeContext

+ 2 - 0
src/Service/OnChange/OnChangeDefault.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\OnChange;
 
 class OnChangeDefault implements OnChangeInterface

+ 2 - 0
src/Service/OnChange/OnChangeInterface.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\OnChange;
 
 interface OnChangeInterface

+ 2 - 0
src/Service/OnlineRegistration/OnlineRegistrationService.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\OnlineRegistration;
 
 use App\Entity\Access\Access;

+ 2 - 0
src/Service/OnlineRegistration/RegistrationStatusService.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\OnlineRegistration;
 
 use App\Entity\Access\Access;

+ 10 - 8
src/Service/Organization/OrganizationFactory.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Organization;
 
 use App\ApiResources\Organization\OrganizationCreationRequest;
@@ -136,7 +138,7 @@ class OrganizationFactory
             $this->logger->info('New dolibarr structure created (uid : '.$dolibarrId.')');
         } catch (\Throwable $e) {
             $this->logger->critical('An error happened while creating the dolibarr society, please proceed manually.');
-            $this->logger->debug($e);
+            $this->logger->debug((string)$e);
             $withError = true;
         }
 
@@ -146,7 +148,7 @@ class OrganizationFactory
             $this->logger->info('Subdomain registered');
         } catch (\Throwable $e) {
             $this->logger->critical('An error happened while updating the bind file, please proceed manually.');
-            $this->logger->debug($e);
+            $this->logger->debug((string)$e);
             $withError = true;
         }
 
@@ -157,7 +159,7 @@ class OrganizationFactory
                 $this->logger->info('Typo3 website created (root uid: '.$rootUid.')');
             } catch (\Throwable $e) {
                 $this->logger->critical('An error happened while creating the typo3 website, please proceed manually.');
-                $this->logger->debug($e);
+                $this->logger->debug((string)$e);
                 $withError = true;
             }
         } else {
@@ -170,7 +172,7 @@ class OrganizationFactory
             $this->logger->info('Adminassos db updated');
         } catch (\Throwable $e) {
             $this->logger->critical('An error happened while updating the adminassos db, please proceed manually.');
-            $this->logger->debug($e);
+            $this->logger->debug((string)$e);
             $withError = true;
         }
 
@@ -852,7 +854,7 @@ class OrganizationFactory
             $this->logger->info('Typo3 website deleted');
         } catch (\Exception $e) {
             $this->logger->critical('An error happened while deleting the Typo3 website, please proceed manually.');
-            $this->logger->debug($e);
+            $this->logger->debug((string)$e);
             $withError = true;
         }
 
@@ -861,7 +863,7 @@ class OrganizationFactory
             $this->logger->info('Dolibarr society switched to prospect');
         } catch (\Exception $e) {
             $this->logger->critical('An error happened while updating the Dolibarr society, please proceed manually.');
-            $this->logger->debug($e);
+            $this->logger->debug((string)$e);
             $withError = true;
         }
 
@@ -872,7 +874,7 @@ class OrganizationFactory
             // Nothing to delete
         } catch (\Exception $e) {
             $this->logger->critical("An error happened while deleting the organization's files, please proceed manually.");
-            $this->logger->debug($e);
+            $this->logger->debug((string)$e);
             $withError = true;
         }
 
@@ -883,7 +885,7 @@ class OrganizationFactory
                 // Nothing to delete
             } catch (\Exception $e) {
                 $this->logger->critical("An error happened while deleting the person's files, please proceed manually (id=".$personId.').');
-                $this->logger->debug($e);
+                $this->logger->debug((string)$e);
                 $withError = true;
             }
         }

+ 2 - 0
src/Service/Security/InternalRequestsService.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Security;
 
 use App\Entity\Access\Access;

+ 2 - 0
src/Service/ServiceIterator/CronjobIterator.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\ServiceIterator;
 
 use App\Service\Cron\CronjobInterface;

+ 2 - 0
src/Service/Typo3/BindFileService.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Typo3;
 
 use Path\Exception\FileNotFoundException;

+ 2 - 0
src/Service/Typo3/SubdomainService.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Typo3;
 
 use App\Entity\Organization\Organization;

+ 2 - 0
src/Service/Typo3/Typo3Service.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Typo3;
 
 use App\Service\Utils\DatesUtils;

+ 2 - 0
src/Service/Utils/ObjectUtils.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Utils;
 
 class ObjectUtils

+ 2 - 0
src/Service/Utils/Parser/ParserInterface.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Utils\Parser;
 
 /**

+ 2 - 0
src/Service/Utils/Uuid.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\Service\Utils;
 
 class Uuid

+ 2 - 0
src/State/Processor/EntityProcessor.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\State\Processor;
 
 use ApiPlatform\Metadata\Delete;

+ 2 - 0
src/State/Provider/OnlineRegistration/RegistrationAvailabilityProvider.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\State\Provider\OnlineRegistration;
 
 use ApiPlatform\Metadata\GetCollection;

+ 2 - 0
src/State/Provider/OnlineRegistration/RegistrationStatusProvider.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\State\Provider\OnlineRegistration;
 
 use ApiPlatform\Metadata\GetCollection;

+ 2 - 0
src/State/Provider/Organization/Subdomain/SubdomainAvailabilityProvider.php

@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace App\State\Provider\Organization\Subdomain;
 
 use ApiPlatform\Metadata\GetCollection;