From 3a670bb093afddb4591fdd36a432afaee3d015a4 Mon Sep 17 00:00:00 2001 From: Ambroise Maupate Date: Fri, 19 May 2023 18:13:36 +0200 Subject: [PATCH] fix: Fixed `Collection` type hinting --- .../src/Models/DocumentInterface.php | 2 +- lib/Documents/src/Models/FolderInterface.php | 6 ++--- .../src/Models/HasThumbnailInterface.php | 4 +-- .../src/Field/ManyToManyFieldGenerator.php | 6 ++--- .../Field/ProxiedManyToManyFieldGenerator.php | 4 +-- .../mocks/GeneratedNodesSources/NSMock.php | 26 +++++++++---------- .../NSMock.php | 26 +++++++++---------- .../Core/AbstractEntities/LeafInterface.php | 3 --- .../Core/AbstractEntities/LeafTrait.php | 9 +++---- .../Model/BlocksAwareWebResponseInterface.php | 4 +-- .../src/Api/Model/WebResponse.php | 6 ++--- lib/RoadizCoreBundle/src/Entity/Folder.php | 10 +++---- lib/RoadizCoreBundle/src/Entity/Realm.php | 16 ++++++------ lib/RoadizCoreBundle/src/Entity/Role.php | 2 +- .../src/Entity/SettingGroup.php | 8 +++--- lib/RoadizCoreBundle/src/Entity/Tag.php | 14 +++++----- .../EntityCollectionTransformer.php | 4 +-- .../src/Model/AttributableInterface.php | 4 +-- .../src/Model/AttributableTrait.php | 8 +++--- .../src/Model/AttributeGroupTrait.php | 4 +-- .../src/Model/AttributeInterface.php | 4 +-- .../src/Model/AttributeTrait.php | 6 ++--- .../src/Model/AttributeValueInterface.php | 6 ++--- .../src/Model/AttributeValueTrait.php | 4 +-- ...tDocumentTranslationIndexingSubscriber.php | 3 ++- 25 files changed, 92 insertions(+), 97 deletions(-) diff --git a/lib/Documents/src/Models/DocumentInterface.php b/lib/Documents/src/Models/DocumentInterface.php index db56eb0c..3936b4f7 100644 --- a/lib/Documents/src/Models/DocumentInterface.php +++ b/lib/Documents/src/Models/DocumentInterface.php @@ -169,7 +169,7 @@ public function setRaw(bool $raw): static; public function getDownscaledDocument(): ?DocumentInterface; /** - * @return Collection + * @return Collection */ public function getFolders(): Collection; diff --git a/lib/Documents/src/Models/FolderInterface.php b/lib/Documents/src/Models/FolderInterface.php index c657a2ab..f5555fd6 100644 --- a/lib/Documents/src/Models/FolderInterface.php +++ b/lib/Documents/src/Models/FolderInterface.php @@ -9,7 +9,7 @@ interface FolderInterface { /** - * @return Collection + * @return Collection */ public function getDocuments(): Collection; @@ -25,10 +25,8 @@ public function addDocument(DocumentInterface $document): static; */ public function removeDocument(DocumentInterface $document): static; - /** - * @return bool - */ public function getVisible(): bool; + public function isVisible(): bool; /** * @param bool $visible diff --git a/lib/Documents/src/Models/HasThumbnailInterface.php b/lib/Documents/src/Models/HasThumbnailInterface.php index 0b8b54df..cf43796f 100644 --- a/lib/Documents/src/Models/HasThumbnailInterface.php +++ b/lib/Documents/src/Models/HasThumbnailInterface.php @@ -20,12 +20,12 @@ public function getOriginal(): ?HasThumbnailInterface; public function setOriginal(?HasThumbnailInterface $original): static; /** - * @return Collection + * @return Collection */ public function getThumbnails(): Collection; /** - * @param Collection $thumbnails + * @param Collection $thumbnails * @return $this */ public function setThumbnails(Collection $thumbnails): static; diff --git a/lib/EntityGenerator/src/Field/ManyToManyFieldGenerator.php b/lib/EntityGenerator/src/Field/ManyToManyFieldGenerator.php index 0c4a7f02..09039bb6 100644 --- a/lib/EntityGenerator/src/Field/ManyToManyFieldGenerator.php +++ b/lib/EntityGenerator/src/Field/ManyToManyFieldGenerator.php @@ -83,7 +83,7 @@ public function getFieldAnnotation(): string return ' /** *' . implode(PHP_EOL . static::ANNOTATION_PREFIX, $this->getFieldAutodoc()) . ' - * @var Collection<' . $this->getFullyQualifiedClassName() . '> + * @var CollectiongetFullyQualifiedClassName() . '> */' . PHP_EOL; } @@ -99,7 +99,7 @@ public function getFieldGetter(): string { return ' /** - * @return Collection<' . $this->getFullyQualifiedClassName() . '> + * @return CollectiongetFullyQualifiedClassName() . '> */ public function ' . $this->field->getGetterName() . '(): Collection { @@ -114,7 +114,7 @@ public function getFieldSetter(): string { return ' /** - * @param Collection<' . $this->getFullyQualifiedClassName() . '>|' . $this->getFullyQualifiedClassName() . '[] $' . $this->field->getVarName() . ' + * @param CollectiongetFullyQualifiedClassName() . '>|' . $this->getFullyQualifiedClassName() . '[] $' . $this->field->getVarName() . ' * @return $this */ public function ' . $this->field->getSetterName() . '(Collection|array $' . $this->field->getVarName() . '): static diff --git a/lib/EntityGenerator/src/Field/ProxiedManyToManyFieldGenerator.php b/lib/EntityGenerator/src/Field/ProxiedManyToManyFieldGenerator.php index 3738e891..ccfd13ea 100644 --- a/lib/EntityGenerator/src/Field/ProxiedManyToManyFieldGenerator.php +++ b/lib/EntityGenerator/src/Field/ProxiedManyToManyFieldGenerator.php @@ -93,7 +93,7 @@ public function getFieldAnnotation(): string /** * ' . $this->field->getLabel() . ' * - * @var Collection<' . $this->getProxyClassname() . '> + * @var CollectiongetProxyClassname() . '> */' . PHP_EOL; } @@ -104,7 +104,7 @@ public function getFieldGetter(): string { return ' /** - * @return Collection<' . $this->getProxyClassname() . '> + * @return CollectiongetProxyClassname() . '> */ public function ' . $this->getProxiedGetterName() . '(): Collection { diff --git a/lib/EntityGenerator/tests/mocks/GeneratedNodesSources/NSMock.php b/lib/EntityGenerator/tests/mocks/GeneratedNodesSources/NSMock.php index e9e4f618..73498319 100644 --- a/lib/EntityGenerator/tests/mocks/GeneratedNodesSources/NSMock.php +++ b/lib/EntityGenerator/tests/mocks/GeneratedNodesSources/NSMock.php @@ -431,7 +431,7 @@ public function setSingleEventReference(?\App\Entity\Base\Event $singleEventRefe * orderBy: * - field: sortingLastDateTime * direction: DESC - * @var Collection<\App\Entity\Base\Event> + * @var Collection */ #[ SymfonySerializer\SerializedName(serializedName: "eventReferences"), @@ -449,7 +449,7 @@ public function setSingleEventReference(?\App\Entity\Base\Event $singleEventRefe private Collection $eventReferences; /** - * @return Collection<\App\Entity\Base\Event> + * @return Collection */ public function getEventReferences(): Collection { @@ -457,7 +457,7 @@ public function getEventReferences(): Collection } /** - * @param Collection<\App\Entity\Base\Event>|\App\Entity\Base\Event[] $eventReferences + * @param Collection|\App\Entity\Base\Event[] $eventReferences * @return $this */ public function setEventReferences(Collection|array $eventReferences): static @@ -475,7 +475,7 @@ public function setEventReferences(Collection|array $eventReferences): static /** * Remontée d'événements manuelle * - * @var Collection<\App\Entity\PositionedCity> + * @var Collection */ #[ Serializer\Exclude, @@ -491,7 +491,7 @@ public function setEventReferences(Collection|array $eventReferences): static private Collection $eventReferencesProxiedProxy; /** - * @return Collection<\App\Entity\PositionedCity> + * @return Collection */ public function getEventReferencesProxiedProxy(): Collection { @@ -575,7 +575,7 @@ public function setEventReferencesProxied(Collection|array|null $eventReferences * orderBy: * - field: sortingLastDateTime * direction: DESC - * @var Collection<\App\Entity\Base\Event> + * @var Collection */ #[ ORM\ManyToMany(targetEntity: \App\Entity\Base\Event::class), @@ -590,7 +590,7 @@ public function setEventReferencesProxied(Collection|array|null $eventReferences private Collection $eventReferencesExcluded; /** - * @return Collection<\App\Entity\Base\Event> + * @return Collection */ public function getEventReferencesExcluded(): Collection { @@ -598,7 +598,7 @@ public function getEventReferencesExcluded(): Collection } /** - * @param Collection<\App\Entity\Base\Event>|\App\Entity\Base\Event[] $eventReferencesExcluded + * @param Collection|\App\Entity\Base\Event[] $eventReferencesExcluded * @return $this */ public function setEventReferencesExcluded(Collection|array $eventReferencesExcluded): static @@ -1025,7 +1025,7 @@ public function setFooManyToOne(?\MyCustomEntity $fooManyToOne = null): static * orderBy: * - field: name * direction: asc - * @var Collection<\MyCustomEntity> + * @var Collection */ #[ SymfonySerializer\SerializedName(serializedName: "fooManyToMany"), @@ -1043,7 +1043,7 @@ public function setFooManyToOne(?\MyCustomEntity $fooManyToOne = null): static private Collection $fooManyToMany; /** - * @return Collection<\MyCustomEntity> + * @return Collection */ public function getFooManyToMany(): Collection { @@ -1051,7 +1051,7 @@ public function getFooManyToMany(): Collection } /** - * @param Collection<\MyCustomEntity>|\MyCustomEntity[] $fooManyToMany + * @param Collection|\MyCustomEntity[] $fooManyToMany * @return $this */ public function setFooManyToMany(Collection|array $fooManyToMany): static @@ -1069,7 +1069,7 @@ public function setFooManyToMany(Collection|array $fooManyToMany): static /** * For many_to_many proxied field * - * @var Collection<\Themes\MyTheme\Entities\PositionedCity> + * @var Collection */ #[ Serializer\Exclude, @@ -1085,7 +1085,7 @@ public function setFooManyToMany(Collection|array $fooManyToMany): static private Collection $fooManyToManyProxiedProxy; /** - * @return Collection<\Themes\MyTheme\Entities\PositionedCity> + * @return Collection */ public function getFooManyToManyProxiedProxy(): Collection { diff --git a/lib/EntityGenerator/tests/mocks/GeneratedNodesSourcesWithRepository/NSMock.php b/lib/EntityGenerator/tests/mocks/GeneratedNodesSourcesWithRepository/NSMock.php index 813f497e..f9013e8a 100644 --- a/lib/EntityGenerator/tests/mocks/GeneratedNodesSourcesWithRepository/NSMock.php +++ b/lib/EntityGenerator/tests/mocks/GeneratedNodesSourcesWithRepository/NSMock.php @@ -431,7 +431,7 @@ public function setSingleEventReference(?\App\Entity\Base\Event $singleEventRefe * orderBy: * - field: sortingLastDateTime * direction: DESC - * @var Collection<\App\Entity\Base\Event> + * @var Collection */ #[ SymfonySerializer\SerializedName(serializedName: "eventReferences"), @@ -449,7 +449,7 @@ public function setSingleEventReference(?\App\Entity\Base\Event $singleEventRefe private Collection $eventReferences; /** - * @return Collection<\App\Entity\Base\Event> + * @return Collection */ public function getEventReferences(): Collection { @@ -457,7 +457,7 @@ public function getEventReferences(): Collection } /** - * @param Collection<\App\Entity\Base\Event>|\App\Entity\Base\Event[] $eventReferences + * @param Collection|\App\Entity\Base\Event[] $eventReferences * @return $this */ public function setEventReferences(Collection|array $eventReferences): static @@ -475,7 +475,7 @@ public function setEventReferences(Collection|array $eventReferences): static /** * Remontée d'événements manuelle * - * @var Collection<\App\Entity\PositionedCity> + * @var Collection */ #[ Serializer\Exclude, @@ -491,7 +491,7 @@ public function setEventReferences(Collection|array $eventReferences): static private Collection $eventReferencesProxiedProxy; /** - * @return Collection<\App\Entity\PositionedCity> + * @return Collection */ public function getEventReferencesProxiedProxy(): Collection { @@ -575,7 +575,7 @@ public function setEventReferencesProxied(Collection|array|null $eventReferences * orderBy: * - field: sortingLastDateTime * direction: DESC - * @var Collection<\App\Entity\Base\Event> + * @var Collection */ #[ ORM\ManyToMany(targetEntity: \App\Entity\Base\Event::class), @@ -590,7 +590,7 @@ public function setEventReferencesProxied(Collection|array|null $eventReferences private Collection $eventReferencesExcluded; /** - * @return Collection<\App\Entity\Base\Event> + * @return Collection */ public function getEventReferencesExcluded(): Collection { @@ -598,7 +598,7 @@ public function getEventReferencesExcluded(): Collection } /** - * @param Collection<\App\Entity\Base\Event>|\App\Entity\Base\Event[] $eventReferencesExcluded + * @param Collection|\App\Entity\Base\Event[] $eventReferencesExcluded * @return $this */ public function setEventReferencesExcluded(Collection|array $eventReferencesExcluded): static @@ -1025,7 +1025,7 @@ public function setFooManyToOne(?\MyCustomEntity $fooManyToOne = null): static * orderBy: * - field: name * direction: asc - * @var Collection<\MyCustomEntity> + * @var Collection */ #[ SymfonySerializer\SerializedName(serializedName: "fooManyToMany"), @@ -1043,7 +1043,7 @@ public function setFooManyToOne(?\MyCustomEntity $fooManyToOne = null): static private Collection $fooManyToMany; /** - * @return Collection<\MyCustomEntity> + * @return Collection */ public function getFooManyToMany(): Collection { @@ -1051,7 +1051,7 @@ public function getFooManyToMany(): Collection } /** - * @param Collection<\MyCustomEntity>|\MyCustomEntity[] $fooManyToMany + * @param Collection|\MyCustomEntity[] $fooManyToMany * @return $this */ public function setFooManyToMany(Collection|array $fooManyToMany): static @@ -1069,7 +1069,7 @@ public function setFooManyToMany(Collection|array $fooManyToMany): static /** * For many_to_many proxied field * - * @var Collection<\Themes\MyTheme\Entities\PositionedCity> + * @var Collection */ #[ Serializer\Exclude, @@ -1085,7 +1085,7 @@ public function setFooManyToMany(Collection|array $fooManyToMany): static private Collection $fooManyToManyProxiedProxy; /** - * @return Collection<\Themes\MyTheme\Entities\PositionedCity> + * @return Collection */ public function getFooManyToManyProxiedProxy(): Collection { diff --git a/lib/Models/src/Roadiz/Core/AbstractEntities/LeafInterface.php b/lib/Models/src/Roadiz/Core/AbstractEntities/LeafInterface.php index 126a2ecf..33424664 100644 --- a/lib/Models/src/Roadiz/Core/AbstractEntities/LeafInterface.php +++ b/lib/Models/src/Roadiz/Core/AbstractEntities/LeafInterface.php @@ -9,9 +9,6 @@ interface LeafInterface extends PositionedInterface, Comparable { - /** - * @return Collection - */ public function getChildren(): Collection; /** diff --git a/lib/Models/src/Roadiz/Core/AbstractEntities/LeafTrait.php b/lib/Models/src/Roadiz/Core/AbstractEntities/LeafTrait.php index 5b586a3d..a9944cf5 100644 --- a/lib/Models/src/Roadiz/Core/AbstractEntities/LeafTrait.php +++ b/lib/Models/src/Roadiz/Core/AbstractEntities/LeafTrait.php @@ -15,10 +15,6 @@ public function getChildren(): Collection return $this->children; } - /** - * @param Collection $children - * @return $this - */ public function setChildren(Collection $children): static { $this->children = $children; @@ -30,7 +26,7 @@ public function setChildren(Collection $children): static } /** - * @param static $child + * @param LeafInterface $child * @return $this */ public function addChild(LeafInterface $child): static @@ -77,6 +73,9 @@ public function setParent(?LeafInterface $parent = null): static if ($parent === $this) { throw new \InvalidArgumentException('An entity cannot have itself as a parent.'); } + if (get_class($parent) !== get_class($this)) { + throw new \InvalidArgumentException('Parent must be the same class as the current entity.'); + } $this->parent = $parent; $this->parent?->addChild($this); diff --git a/lib/RoadizCoreBundle/src/Api/Model/BlocksAwareWebResponseInterface.php b/lib/RoadizCoreBundle/src/Api/Model/BlocksAwareWebResponseInterface.php index 6c99e260..e94917f7 100644 --- a/lib/RoadizCoreBundle/src/Api/Model/BlocksAwareWebResponseInterface.php +++ b/lib/RoadizCoreBundle/src/Api/Model/BlocksAwareWebResponseInterface.php @@ -10,12 +10,12 @@ interface BlocksAwareWebResponseInterface extends WebResponseInterface { /** - * @return Collection|null + * @return Collection|null */ public function getBlocks(): ?Collection; /** - * @param Collection|null $blocks + * @param Collection|null $blocks * @return BlocksAwareWebResponseInterface */ public function setBlocks(?Collection $blocks): BlocksAwareWebResponseInterface; diff --git a/lib/RoadizCoreBundle/src/Api/Model/WebResponse.php b/lib/RoadizCoreBundle/src/Api/Model/WebResponse.php index e33aec38..2cf0b7e4 100644 --- a/lib/RoadizCoreBundle/src/Api/Model/WebResponse.php +++ b/lib/RoadizCoreBundle/src/Api/Model/WebResponse.php @@ -26,7 +26,7 @@ final class WebResponse implements WebResponseInterface, BlocksAwareWebResponseI #[Serializer\Groups(["web_response"])] public ?NodesSourcesHeadInterface $head = null; /** - * @var Collection|null + * @var Collection|null */ #[Serializer\Groups(["web_response"])] private ?Collection $blocks = null; @@ -48,7 +48,7 @@ public function getItem(): ?PersistableInterface } /** - * @return Collection|null + * @return Collection|null */ public function getBlocks(): ?Collection { @@ -56,7 +56,7 @@ public function getBlocks(): ?Collection } /** - * @param Collection|null $blocks + * @param Collection|null $blocks * @return WebResponse */ public function setBlocks(?Collection $blocks): WebResponse diff --git a/lib/RoadizCoreBundle/src/Entity/Folder.php b/lib/RoadizCoreBundle/src/Entity/Folder.php index 76788a55..8a68596e 100644 --- a/lib/RoadizCoreBundle/src/Entity/Folder.php +++ b/lib/RoadizCoreBundle/src/Entity/Folder.php @@ -67,7 +67,7 @@ class Folder extends AbstractDateTimedPositioned implements FolderInterface, Lea protected ?Folder $parent = null; /** - * @var Collection + * @var Collection */ #[ORM\OneToMany(mappedBy: 'parent', targetEntity: Folder::class, orphanRemoval: true)] #[ORM\OrderBy(['position' => 'ASC'])] @@ -132,7 +132,7 @@ class Folder extends AbstractDateTimedPositioned implements FolderInterface, Lea private bool $locked = false; /** - * @var Collection + * @var Collection */ #[ORM\OneToMany(mappedBy: 'folder', targetEntity: FolderTranslation::class, orphanRemoval: true)] #[SymfonySerializer\Ignore] @@ -212,7 +212,7 @@ public function setVisible(bool $visible): static /** * @param TranslationInterface $translation - * @return Collection + * @return Collection */ #[SymfonySerializer\Ignore] public function getTranslatedFoldersByTranslation(TranslationInterface $translation): Collection @@ -237,7 +237,7 @@ public function getName(): ?string } /** - * @return Collection + * @return Collection */ public function getTranslatedFolders(): Collection { @@ -245,7 +245,7 @@ public function getTranslatedFolders(): Collection } /** - * @param Collection $translatedFolders + * @param Collection $translatedFolders * @return $this */ public function setTranslatedFolders(Collection $translatedFolders): static diff --git a/lib/RoadizCoreBundle/src/Entity/Realm.php b/lib/RoadizCoreBundle/src/Entity/Realm.php index 92000fc9..118fdab2 100644 --- a/lib/RoadizCoreBundle/src/Entity/Realm.php +++ b/lib/RoadizCoreBundle/src/Entity/Realm.php @@ -80,7 +80,7 @@ class Realm extends AbstractEntity implements RealmInterface private ?string $serializationGroup = null; /** - * @var Collection + * @var Collection */ #[ORM\JoinTable(name: 'realms_users')] #[ORM\ManyToMany(targetEntity: User::class)] @@ -89,7 +89,7 @@ class Realm extends AbstractEntity implements RealmInterface private Collection $users; /** - * @var Collection + * @var Collection */ #[ORM\OneToMany(mappedBy: 'realm', targetEntity: RealmNode::class)] #[SymfonySerializer\Ignore] @@ -173,7 +173,7 @@ public function setName(string $name): Realm } /** - * @return ArrayCollection|Collection + * @return Collection */ public function getRealmNodes(): Collection { @@ -181,7 +181,7 @@ public function getRealmNodes(): Collection } /** - * @param ArrayCollection|Collection $realmNodes + * @param Collection $realmNodes * @return Realm */ public function setRealmNodes(Collection $realmNodes) @@ -191,7 +191,7 @@ public function setRealmNodes(Collection $realmNodes) } /** - * @return Collection|ArrayCollection + * @return Collection */ public function getUsers(): Collection { @@ -199,7 +199,7 @@ public function getUsers(): Collection } /** - * @param Collection|ArrayCollection $users + * @param Collection $users * @return Realm */ public function setUsers(Collection $users) @@ -209,7 +209,7 @@ public function setUsers(Collection $users) } /** - * @return string + * @return string|null */ public function getPlainPassword(): ?string { @@ -217,7 +217,7 @@ public function getPlainPassword(): ?string } /** - * @param string $plainPassword + * @param string|null $plainPassword * @return Realm */ public function setPlainPassword(?string $plainPassword): Realm diff --git a/lib/RoadizCoreBundle/src/Entity/Role.php b/lib/RoadizCoreBundle/src/Entity/Role.php index 83264b28..09474b57 100644 --- a/lib/RoadizCoreBundle/src/Entity/Role.php +++ b/lib/RoadizCoreBundle/src/Entity/Role.php @@ -46,7 +46,7 @@ class Role implements PersistableInterface private string $name = ''; /** - * @var Collection + * @var Collection */ #[ORM\ManyToMany(targetEntity: Group::class, mappedBy: 'roleEntities', cascade: ['persist', 'merge'])] #[SymfonySerializer\Groups(['role'])] diff --git a/lib/RoadizCoreBundle/src/Entity/SettingGroup.php b/lib/RoadizCoreBundle/src/Entity/SettingGroup.php index 2b1b34c3..297c7d67 100644 --- a/lib/RoadizCoreBundle/src/Entity/SettingGroup.php +++ b/lib/RoadizCoreBundle/src/Entity/SettingGroup.php @@ -38,7 +38,7 @@ class SettingGroup extends AbstractEntity private string $name = ''; /** - * @var Collection + * @var Collection */ #[ORM\OneToMany(mappedBy: 'settingGroup', targetEntity: Setting::class)] #[SymfonySerializer\Groups(['setting_group'])] @@ -101,15 +101,15 @@ public function addSetting(Setting $setting) } /** - * @return Collection + * @return Collection */ - public function getSettings() + public function getSettings(): Collection { return $this->settings; } /** - * @param Collection $settings + * @param Collection $settings * @return SettingGroup */ public function addSettings(Collection $settings) diff --git a/lib/RoadizCoreBundle/src/Entity/Tag.php b/lib/RoadizCoreBundle/src/Entity/Tag.php index c991c7d8..07aad1b4 100644 --- a/lib/RoadizCoreBundle/src/Entity/Tag.php +++ b/lib/RoadizCoreBundle/src/Entity/Tag.php @@ -81,7 +81,7 @@ class Tag extends AbstractDateTimedPositioned implements LeafInterface protected ?LeafInterface $parent = null; /** - * @var Collection + * @var Collection */ #[ORM\OneToMany( mappedBy: 'parent', @@ -96,7 +96,7 @@ class Tag extends AbstractDateTimedPositioned implements LeafInterface protected Collection $children; /** - * @var Collection + * @var Collection */ #[ORM\OneToMany( mappedBy: 'tag', @@ -146,7 +146,7 @@ class Tag extends AbstractDateTimedPositioned implements LeafInterface private bool $locked = false; /** - * @var Collection + * @var Collection */ #[ORM\OneToMany( mappedBy: 'tag', @@ -211,7 +211,7 @@ public function setLocked(bool $locked): static } /** - * @return Collection + * @return Collection */ public function getNodes(): Collection { @@ -262,7 +262,7 @@ public function setTagName(string $tagName): static /** * @param TranslationInterface $translation - * @return Collection + * @return Collection */ #[SymfonySerializer\Ignore] public function getTranslatedTagsByTranslation(TranslationInterface $translation): Collection @@ -396,7 +396,7 @@ public function getName(): ?string } /** - * @return Collection + * @return Collection */ public function getTranslatedTags(): Collection { @@ -404,7 +404,7 @@ public function getTranslatedTags(): Collection } /** - * @param Collection $translatedTags + * @param Collection $translatedTags * @return $this */ public function setTranslatedTags(Collection $translatedTags): static diff --git a/lib/RoadizCoreBundle/src/Form/DataTransformer/EntityCollectionTransformer.php b/lib/RoadizCoreBundle/src/Form/DataTransformer/EntityCollectionTransformer.php index d4ef5edb..bee48792 100644 --- a/lib/RoadizCoreBundle/src/Form/DataTransformer/EntityCollectionTransformer.php +++ b/lib/RoadizCoreBundle/src/Form/DataTransformer/EntityCollectionTransformer.php @@ -35,7 +35,7 @@ public function __construct(ObjectManager $manager, string $classname, bool $asC } /** - * @param ArrayCollection|PersistableInterface[]|null $value + * @param iterable|mixed|null $value * @return string|array */ public function transform(mixed $value): string|array @@ -56,7 +56,7 @@ public function transform(mixed $value): string|array /** * @param string|array|null $value - * @return array|ArrayCollection + * @return array|ArrayCollection */ public function reverseTransform(mixed $value): array|ArrayCollection { diff --git a/lib/RoadizCoreBundle/src/Model/AttributableInterface.php b/lib/RoadizCoreBundle/src/Model/AttributableInterface.php index 39ba3537..6024140c 100644 --- a/lib/RoadizCoreBundle/src/Model/AttributableInterface.php +++ b/lib/RoadizCoreBundle/src/Model/AttributableInterface.php @@ -18,14 +18,14 @@ public function getAttributeValues(): Collection; /** * @param TranslationInterface $translation * - * @return Collection + * @return Collection */ public function getAttributesValuesForTranslation(TranslationInterface $translation): Collection; /** * @param TranslationInterface $translation * - * @return Collection + * @return Collection */ public function getAttributesValuesTranslations(TranslationInterface $translation): Collection; diff --git a/lib/RoadizCoreBundle/src/Model/AttributableTrait.php b/lib/RoadizCoreBundle/src/Model/AttributableTrait.php index 0fa41d94..ec5ebbf5 100644 --- a/lib/RoadizCoreBundle/src/Model/AttributableTrait.php +++ b/lib/RoadizCoreBundle/src/Model/AttributableTrait.php @@ -10,7 +10,7 @@ trait AttributableTrait { /** - * @return Collection + * @return Collection */ public function getAttributeValues(): Collection { @@ -20,7 +20,7 @@ public function getAttributeValues(): Collection /** * @param TranslationInterface $translation * - * @return Collection + * @return Collection */ public function getAttributesValuesForTranslation(TranslationInterface $translation): Collection { @@ -38,11 +38,11 @@ public function getAttributesValuesForTranslation(TranslationInterface $translat /** * @param TranslationInterface $translation * - * @return Collection + * @return Collection */ public function getAttributesValuesTranslations(TranslationInterface $translation): Collection { - /** @var Collection $values */ + /** @var Collection $values */ $values = $this->getAttributesValuesForTranslation($translation) ->map(function (AttributeValueInterface $attributeValue) use ($translation) { /** @var AttributeValueTranslationInterface $attributeValueTranslation */ diff --git a/lib/RoadizCoreBundle/src/Model/AttributeGroupTrait.php b/lib/RoadizCoreBundle/src/Model/AttributeGroupTrait.php index 0eedcfdb..6348ad92 100644 --- a/lib/RoadizCoreBundle/src/Model/AttributeGroupTrait.php +++ b/lib/RoadizCoreBundle/src/Model/AttributeGroupTrait.php @@ -26,7 +26,7 @@ trait AttributeGroupTrait protected string $canonicalName = ''; /** - * @var Collection + * @var Collection */ #[ ORM\OneToMany(mappedBy: "group", targetEntity: AttributeInterface::class), @@ -36,7 +36,7 @@ trait AttributeGroupTrait protected Collection $attributes; /** - * @var Collection + * @var Collection */ #[ ORM\OneToMany(mappedBy: "attributeGroup", targetEntity: AttributeGroupTranslationInterface::class, cascade: ["all"]), diff --git a/lib/RoadizCoreBundle/src/Model/AttributeInterface.php b/lib/RoadizCoreBundle/src/Model/AttributeInterface.php index 0f1c8b99..f22e2ec2 100644 --- a/lib/RoadizCoreBundle/src/Model/AttributeInterface.php +++ b/lib/RoadizCoreBundle/src/Model/AttributeInterface.php @@ -77,12 +77,12 @@ public function setCode(string $code): self; public function getLabelOrCode(?TranslationInterface $translation = null): string; /** - * @return Collection + * @return Collection */ public function getAttributeTranslations(): Collection; /** - * @param Collection $attributeTranslations + * @param Collection $attributeTranslations * * @return $this */ diff --git a/lib/RoadizCoreBundle/src/Model/AttributeTrait.php b/lib/RoadizCoreBundle/src/Model/AttributeTrait.php index 3b7a2c46..64cc7174 100644 --- a/lib/RoadizCoreBundle/src/Model/AttributeTrait.php +++ b/lib/RoadizCoreBundle/src/Model/AttributeTrait.php @@ -63,7 +63,7 @@ trait AttributeTrait protected ?AttributeGroupInterface $group = null; /** - * @var Collection + * @var Collection */ #[ ORM\OneToMany( @@ -81,7 +81,7 @@ trait AttributeTrait protected Collection $attributeTranslations; /** - * @var Collection + * @var Collection */ #[ ORM\OneToMany( @@ -236,7 +236,7 @@ function (AttributeTranslationInterface $attributeTranslation) use ($translation } /** - * @return Collection + * @return Collection */ public function getAttributeTranslations(): Collection { diff --git a/lib/RoadizCoreBundle/src/Model/AttributeValueInterface.php b/lib/RoadizCoreBundle/src/Model/AttributeValueInterface.php index 40567088..8bb43e55 100644 --- a/lib/RoadizCoreBundle/src/Model/AttributeValueInterface.php +++ b/lib/RoadizCoreBundle/src/Model/AttributeValueInterface.php @@ -29,19 +29,19 @@ public function setAttribute(AttributeInterface $attribute); public function getType(): int; /** - * @return Collection + * @return Collection */ public function getAttributeValueTranslations(): Collection; /** * @param TranslationInterface $translation * - * @return AttributeValueTranslationInterface + * @return AttributeValueTranslationInterface|null */ public function getAttributeValueTranslation(TranslationInterface $translation): ?AttributeValueTranslationInterface; /** - * @param Collection $attributeValueTranslations + * @param Collection $attributeValueTranslations * * @return mixed */ diff --git a/lib/RoadizCoreBundle/src/Model/AttributeValueTrait.php b/lib/RoadizCoreBundle/src/Model/AttributeValueTrait.php index 8be3f542..fd6b0cbe 100644 --- a/lib/RoadizCoreBundle/src/Model/AttributeValueTrait.php +++ b/lib/RoadizCoreBundle/src/Model/AttributeValueTrait.php @@ -33,7 +33,7 @@ trait AttributeValueTrait protected ?AttributeInterface $attribute = null; /** - * @var Collection + * @var Collection */ #[ ORM\OneToMany( @@ -77,7 +77,7 @@ public function getType(): int } /** - * @return Collection + * @return Collection */ public function getAttributeValueTranslations(): Collection { diff --git a/lib/RoadizCoreBundle/src/SearchEngine/Subscriber/DefaultDocumentTranslationIndexingSubscriber.php b/lib/RoadizCoreBundle/src/SearchEngine/Subscriber/DefaultDocumentTranslationIndexingSubscriber.php index b722fada..66de4921 100644 --- a/lib/RoadizCoreBundle/src/SearchEngine/Subscriber/DefaultDocumentTranslationIndexingSubscriber.php +++ b/lib/RoadizCoreBundle/src/SearchEngine/Subscriber/DefaultDocumentTranslationIndexingSubscriber.php @@ -9,6 +9,7 @@ use RZ\Roadiz\CoreBundle\Event\Document\DocumentTranslationIndexingEvent; use RZ\Roadiz\CoreBundle\SearchEngine\AbstractSolarium; use RZ\Roadiz\CoreBundle\SearchEngine\SolariumDocumentTranslation; +use RZ\Roadiz\Documents\Models\FolderInterface; final class DefaultDocumentTranslationIndexingSubscriber extends AbstractIndexingSubscriber { @@ -76,7 +77,7 @@ public function onIndexing(DocumentTranslationIndexingEvent $event): void /* * `tags_txt` Must store only public, visible and user-searchable content. */ - $visibleFolders = $document->getFolders()->filter(function (Folder $folder) { + $visibleFolders = $document->getFolders()->filter(function (FolderInterface $folder) { return $folder->isVisible(); })->toArray(); $visibleFolderNames = [];