Olivier Massot 11 months ago
parent
commit
ff75ecbb03

+ 1 - 1
phpstan.neon.dist

@@ -2,7 +2,6 @@
 parameters:
     level: 6
     treatPhpDocTypesAsCertain: false
-    checkGenericClassInNonGenericObjectType: false
     paths:
         - src
 
@@ -10,4 +9,5 @@ parameters:
     # on ignore les erreurs qui imposent d'indiquer le type d'un iterable dans la phpDoc (cf: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type)
     ignoreErrors :
         - '#Attribute class JetBrains\\PhpStorm\\[a-zA-Z]+ does not exist.#'
+        - identifier: missingType.generics
 

+ 20 - 0
src/Entity/Awin/Product.php

@@ -35,6 +35,9 @@ class Product
     #[ORM\Column]
     protected mixed $subCategory;
 
+    /**
+     * @var array<string>
+     */
     #[ORM\Column(type: 'json', options: ['nullable' => true])]
     protected array $categories;
 
@@ -44,6 +47,9 @@ class Product
     #[ORM\Column]
     protected mixed $datetimeEnd;
 
+    /**
+     * @var array<string>
+     */
     #[ORM\Column(type: 'json', options: ['nullable' => true])]
     protected array $meetingSchedule;
 
@@ -164,11 +170,18 @@ class Product
         return $this;
     }
 
+    /**
+     * @return string[]
+     */
     function getCategories(): array
     {
         return $this->categories;
     }
 
+    /**
+     * @param string[] $categories
+     * @return self
+     */
     function setCategories(array $categories): self
     {
         $this->categories = $categories;
@@ -197,11 +210,18 @@ class Product
         return $this;
     }
 
+    /**
+     * @return string[]
+     */
     function getMeetingSchedule(): array
     {
         return $this->meetingSchedule;
     }
 
+    /**
+     * @param array<string> $meetingSchedule
+     * @return $this
+     */
     function setMeetingSchedule(array $meetingSchedule): self
     {
         $this->meetingSchedule = $meetingSchedule;

+ 1 - 1
src/Entity/Billing/AbstractBillAccounting.php

@@ -348,7 +348,7 @@ abstract class AbstractBillAccounting
         return $this->access;
     }
 
-    function setAccess(Access $access): self
+    function setAccess(?Access $access): self
     {
         $this->access = $access;
         return $this;

+ 1 - 0
src/Entity/Core/LoginLog.php

@@ -5,6 +5,7 @@ declare(strict_types=1);
 namespace App\Entity\Core;
 
 use ApiPlatform\Metadata\ApiResource;
+use DateTimeInterface;
 use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;

+ 1 - 1
src/Entity/Person/AllowedIp.php

@@ -51,7 +51,7 @@ class AllowedIp
         return $this->ipOrRange;
     }
 
-    public function setIpOrRange(string $ipOrRange)
+    public function setIpOrRange(string $ipOrRange): self
     {
         $this->ipOrRange = $ipOrRange;
         return $this;

+ 2 - 2
src/Entity/Product/AbstractProduct.php

@@ -21,8 +21,8 @@ abstract class AbstractProduct
     #[ORM\GeneratedValue]
     protected ?int $id = null;
 
-//    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'products', cascade: ['persist'], orphanRemoval: false)]
-//    protected Collection $tags;
+    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'products', cascade: ['persist'], orphanRemoval: false)]
+    protected Collection $tags;
 
     #[ORM\ManyToOne]
     protected Organization $organization;

+ 16 - 0
src/Service/Doctrine/SchemaValidation/Difference.php

@@ -11,8 +11,17 @@ class Difference
 
     protected string $entity;
     protected string $property;
+
+    /**
+     * @var string|array<string, string|array<string>>
+     */
     protected string | array $expectedType;
 
+    /**
+     * @param DiffTypeEnum $type
+     * @param string|null $message
+     * @param string|array<string, string|array<string>> $expectedType
+     */
     public function __construct(DiffTypeEnum $type, ?string $message, string | array $expectedType = []) {
         $this->type = $type;
         $this->message = $message;
@@ -41,11 +50,18 @@ class Difference
         return $this;
     }
 
+    /**
+     * @return string|array<string, string|array<string>>
+     */
     public function getExpectedType(): string | array
     {
         return $this->expectedType;
     }
 
+    /**
+     * @param string|array<string, string|array<string>> $expectedType
+     * @return $this
+     */
     public function setExpectedType(string | array $expectedType): self
     {
         $this->expectedType = $expectedType;

+ 5 - 1
src/Service/Doctrine/SchemaValidation/SchemaSnippetsMaker.php

@@ -288,6 +288,10 @@ class SchemaSnippetsMaker
         }
     }
 
+    /**
+     * @param array<string, string|array<string>> $type
+     * @return string
+     */
     protected function getRelationTargetEntityName(array $type): string
     {
         $targetEntityName = $this->entityUtils->getEntityNameFromFullName($type['targetEntity']);
@@ -465,7 +469,7 @@ class SchemaSnippetsMaker
 
     /**
      * Make the '__construct' method with collections initialization
-     * @param array $collections
+     * @param array<Property> $collections
      * @return Method
      */
     protected function makeSnippetConstructor(array $collections): Method {