From 22c3952c00fdef8524bedf655fd42528336520fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 22 Dec 2025 15:28:54 +0100 Subject: [PATCH] misc phpstan issues --- .../Controller/ThirdPartyController.php | 2 +- .../Entity/ThirdParty.php | 31 ++++++++++--------- .../Repository/ThirdPartyRepository.php | 3 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php index 5c84f722d..283730be2 100644 --- a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php +++ b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php @@ -50,7 +50,7 @@ final class ThirdPartyController extends CRUDController return $defaultTemplateParameters; } - protected function buildFilterOrderHelper(string $action, Request $request): ?FilterOrderHelper + protected function buildFilterOrderHelper(string $action, Request $request): FilterOrderHelper { return $this->filterOrderHelperFactory ->create(self::class) diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index 45ad20616..cf9350abd 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -21,6 +21,7 @@ use Chill\MainBundle\Validation\Constraint\PhonenumberConstraint; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\ReadableCollection; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use libphonenumber\PhoneNumber; use Symfony\Component\Serializer\Attribute\Context; @@ -86,13 +87,13 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * [fr] Sigle. */ #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] - #[ORM\Column(name: 'acronym', type: \Doctrine\DBAL\Types\Types::STRING, length: 64, nullable: true)] + #[ORM\Column(name: 'acronym', type: Types::STRING, length: 64, nullable: true)] private ?string $acronym = ''; /** * Soft-delete flag. */ - #[ORM\Column(name: 'active', type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['defaut' => true])] + #[ORM\Column(name: 'active', type: Types::BOOLEAN, options: ['defaut' => true])] private bool $active = true; #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] @@ -106,7 +107,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * * This field is read-only, and is generated on database side. */ - #[ORM\Column(name: 'canonicalized', type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => ''])] + #[ORM\Column(name: 'canonicalized', type: Types::TEXT, nullable: false, options: ['default' => ''])] private ?string $canonicalized = ''; /** @@ -140,14 +141,14 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin private ?Civility $civility = null; #[Groups(['read', 'write'])] - #[ORM\Column(name: 'comment', type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)] + #[ORM\Column(name: 'comment', type: Types::TEXT, nullable: true)] private ?string $comment = null; #[Groups(['read', 'docgen:read', 'docgen:read:3party:parent'])] - #[ORM\Column(name: 'contact_data_anonymous', type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])] + #[ORM\Column(name: 'contact_data_anonymous', type: Types::BOOLEAN, options: ['default' => false])] private bool $contactDataAnonymous = false; - #[ORM\Column(name: 'created_at', type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: false)] + #[ORM\Column(name: 'created_at', type: Types::DATETIME_IMMUTABLE, nullable: false)] private \DateTimeImmutable $createdAt; #[ORM\ManyToOne(targetEntity: User::class)] @@ -156,35 +157,35 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin #[Assert\Email] #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] - #[ORM\Column(name: 'email', type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)] + #[ORM\Column(name: 'email', type: Types::STRING, length: 255, nullable: true)] private ?string $email = null; #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] - #[ORM\Column(name: 'firstname', type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => ''])] + #[ORM\Column(name: 'firstname', type: Types::TEXT, nullable: false, options: ['default' => ''])] private ?string $firstname = ''; #[Groups(['read', 'docgen:read', 'docgen:read:3party:parent'])] - #[ORM\Column(name: 'id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\Column(name: 'id', type: Types::INTEGER)] #[ORM\Id] #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; #[Groups(['write', 'docgen:read', 'docgen:read:3party:parent'])] - #[ORM\Column(name: 'kind', type: \Doctrine\DBAL\Types\Types::STRING, length: 20, options: ['default' => ''])] + #[ORM\Column(name: 'kind', type: Types::STRING, length: 20, options: ['default' => ''])] private string $kind = ''; #[Assert\Length(min: 2)] #[Assert\NotNull] #[Assert\NotBlank] #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] - #[ORM\Column(name: 'name', type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] + #[ORM\Column(name: 'name', type: Types::STRING, length: 255)] private string $name = ''; /** * [fr] Raison sociale. */ #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] - #[ORM\Column(name: 'name_company', type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)] + #[ORM\Column(name: 'name_company', type: Types::STRING, length: 255, nullable: true)] private ?string $nameCompany = ''; /** @@ -200,7 +201,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * [fr] Qualité. */ #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] - #[ORM\Column(name: 'profession', type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] + #[ORM\Column(name: 'profession', type: Types::TEXT, nullable: false, options: ['default' => ''])] #[Context(normalizationContext: ['groups' => 'docgen:read'], groups: ['docgen:read:3party:parent'])] private string $profession = ''; @@ -214,10 +215,10 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin #[PhonenumberConstraint(type: 'any')] private ?PhoneNumber $telephone2 = null; - #[ORM\Column(name: 'types', type: \Doctrine\DBAL\Types\Types::JSON, nullable: true)] + #[ORM\Column(name: 'types', type: Types::JSON, nullable: true)] private ?array $thirdPartyTypes = []; - #[ORM\Column(name: 'updated_at', type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true)] + #[ORM\Column(name: 'updated_at', type: Types::DATETIME_IMMUTABLE, nullable: true)] private ?\DateTimeImmutable $updatedAt = null; #[ORM\ManyToOne(targetEntity: User::class)] diff --git a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php index 2a4fb0902..138b5ea79 100644 --- a/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php +++ b/src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php @@ -114,9 +114,8 @@ class ThirdPartyRepository implements ObjectRepository /** * @param null $limit * @param null $offset - * */ - public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array + public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array { return $this->repository->findBy($criteria, $orderBy, $limit, $offset); }