Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ parameters:
message: '#but database expects#'
paths:
- tests/Fixtures/TestBundle/Entity/
- '#Cannot call method add\(\) on iterable.#'
-
message: '#is never read, only written.#'
paths:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
public ?RelatedDummy $relatedDummy = null;

#[ORM\ManyToMany(targetEntity: RelatedDummy::class)]
public Collection|iterable $relatedDummies;
public Collection $relatedDummies;

/**
* @var array|null serialize data
Expand Down Expand Up @@ -302,7 +302,7 @@
return $this->dummy;
}

public function getRelatedDummies(): Collection|iterable
public function getRelatedDummies(): Collection

Check warning on line 305 in src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/Dummy.php

View check run for this annotation

Codecov / codecov/patch

src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/Dummy.php#L305

Added line #L305 was not covered by tests
{
return $this->relatedDummies;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class FourthLevel
#[Groups(['barcelona', 'chicago'])]
private int $level = 4;
#[ORM\OneToMany(targetEntity: ThirdLevel::class, cascade: ['persist'], mappedBy: 'badFourthLevel')]
public Collection|iterable|null $badThirdLevel = null;
public ?Collection $badThirdLevel = null;

public function getId(): ?int
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@

#[ORM\OneToMany(targetEntity: RelatedToDummyFriend::class, cascade: ['persist'], mappedBy: 'relatedDummy')]
#[Groups(['fakemanytomany', 'friends'])]
public Collection|iterable $relatedToDummyFriend;
public Collection $relatedToDummyFriend;

/**
* @var bool|null A dummy bool
Expand Down Expand Up @@ -169,7 +169,7 @@
/**
* Get relatedToDummyFriend.
*/
public function getRelatedToDummyFriend(): Collection|iterable
public function getRelatedToDummyFriend(): Collection

Check warning on line 172 in src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/RelatedDummy.php

View check run for this annotation

Codecov / codecov/patch

src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/RelatedDummy.php#L172

Added line #L172 was not covered by tests
{
return $this->relatedToDummyFriend;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/Tests/Fixtures/Document/Dummy.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Dummy
#[ODM\ReferenceOne(targetDocument: RelatedDummy::class, storeAs: 'id', nullable: true)]
public ?RelatedDummy $relatedDummy = null;
#[ODM\ReferenceMany(targetDocument: RelatedDummy::class, storeAs: 'id', nullable: true)]
public Collection|iterable $relatedDummies;
public Collection $relatedDummies;
#[ODM\Field(type: 'hash', nullable: true)]
public array $jsonData = [];
#[ODM\Field(type: 'collection', nullable: true)]
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/Tests/Fixtures/Document/FourthLevel.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class FourthLevel
#[ODM\Field(type: 'int')]
private ?int $level = 4;
#[ODM\ReferenceMany(targetDocument: ThirdLevel::class, cascade: ['persist'], mappedBy: 'badFourthLevel', storeAs: 'id')]
public Collection|iterable|null $badThirdLevel = null;
public ?Collection $badThirdLevel = null;

public function getId(): ?int
{
Expand Down
4 changes: 2 additions & 2 deletions src/Doctrine/Odm/Tests/Fixtures/Document/RelatedDummy.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#[ODM\ReferenceOne(targetDocument: ThirdLevel::class, cascade: ['persist'], nullable: true, storeAs: 'id', inversedBy: 'relatedDummies')]
public ?ThirdLevel $thirdLevel = null;
#[ODM\ReferenceMany(targetDocument: RelatedToDummyFriend::class, cascade: ['persist'], mappedBy: 'relatedDummy', storeAs: 'id')]
public Collection|iterable $relatedToDummyFriend;
public Collection $relatedToDummyFriend;
#[ODM\Field(type: 'bool')]
public ?bool $dummyBoolean = null;
#[ODM\EmbedOne(targetDocument: EmbeddableDummy::class)]
Expand Down Expand Up @@ -121,7 +121,7 @@
/**
* Get relatedToDummyFriend.
*/
public function getRelatedToDummyFriend(): Collection|iterable
public function getRelatedToDummyFriend(): Collection

Check warning on line 124 in src/Doctrine/Odm/Tests/Fixtures/Document/RelatedDummy.php

View check run for this annotation

Codecov / codecov/patch

src/Doctrine/Odm/Tests/Fixtures/Document/RelatedDummy.php#L124

Added line #L124 was not covered by tests
{
return $this->relatedToDummyFriend;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/Tests/Fixtures/Document/ThirdLevel.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ThirdLevel
#[ODM\ReferenceOne(targetDocument: FourthLevel::class, cascade: ['persist'])]
public $badFourthLevel;
#[ODM\ReferenceMany(mappedBy: 'thirdLevel', targetDocument: RelatedDummy::class)]
public Collection|iterable $relatedDummies;
public Collection $relatedDummies;

public function __construct()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Doctrine/Orm/Tests/Fixtures/Entity/CompositeItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
private ?string $field1 = null;
#[ORM\OneToMany(targetEntity: CompositeRelation::class, mappedBy: 'compositeItem', fetch: 'EAGER')]
#[Groups(['default'])]
private Collection|iterable $compositeValues;
private Collection $compositeValues;

public function __construct()
{
Expand Down Expand Up @@ -71,7 +71,7 @@
/**
* Gets compositeValues.
*/
public function getCompositeValues(): Collection|iterable
public function getCompositeValues(): Collection

Check warning on line 74 in src/Doctrine/Orm/Tests/Fixtures/Entity/CompositeItem.php

View check run for this annotation

Codecov / codecov/patch

src/Doctrine/Orm/Tests/Fixtures/Entity/CompositeItem.php#L74

Added line #L74 was not covered by tests
{
return $this->compositeValues;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Doctrine/Orm/Tests/Fixtures/Entity/Dummy.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
public ?RelatedDummy $relatedDummy = null;

#[ORM\ManyToMany(targetEntity: RelatedDummy::class)]
public Collection|iterable $relatedDummies;
public Collection $relatedDummies;

/**
* @var array|null serialize data
Expand Down Expand Up @@ -305,7 +305,7 @@
return $this->dummy;
}

public function getRelatedDummies(): Collection|iterable
public function getRelatedDummies(): Collection

Check warning on line 308 in src/Doctrine/Orm/Tests/Fixtures/Entity/Dummy.php

View check run for this annotation

Codecov / codecov/patch

src/Doctrine/Orm/Tests/Fixtures/Entity/Dummy.php#L308

Added line #L308 was not covered by tests
{
return $this->relatedDummies;
}
Expand Down
12 changes: 6 additions & 6 deletions src/Doctrine/Orm/Tests/Fixtures/Entity/DummyCar.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@
private DummyCarIdentifier $id;
#[ApiFilter(SearchFilter::class, properties: ['colors.prop' => 'ipartial', 'colors' => 'exact'])]
#[ORM\OneToMany(targetEntity: DummyCarColor::class, mappedBy: 'car')]
private Collection|iterable $colors;
private Collection $colors;
#[ApiFilter(SearchFilter::class, strategy: 'exact')]
#[ORM\OneToMany(targetEntity: DummyCarColor::class, mappedBy: 'car')]
private Collection|iterable|null $secondColors = null;
private ?Collection $secondColors = null;
#[ApiFilter(SearchFilter::class, strategy: 'exact')]
#[ORM\OneToMany(targetEntity: DummyCarColor::class, mappedBy: 'car')]
private Collection|iterable|null $thirdColors = null;
private ?Collection $thirdColors = null;
#[ApiFilter(SearchFilter::class, strategy: 'exact')]
#[ORM\ManyToMany(targetEntity: UuidIdentifierDummy::class, indexBy: 'uuid')]
#[ORM\JoinColumn(name: 'car_id', referencedColumnName: 'id_id')]
#[ORM\InverseJoinColumn(name: 'uuid_uuid', referencedColumnName: 'uuid')]
#[ORM\JoinTable(name: 'uuid_cars')]
private Collection|iterable|null $uuid = null;
private ?Collection $uuid = null;

#[ApiFilter(SearchFilter::class, strategy: 'partial')]
#[ORM\Column(type: 'string')]
Expand All @@ -80,12 +80,12 @@
return $this->id;
}

public function getColors(): Collection|iterable
public function getColors(): Collection

Check warning on line 83 in src/Doctrine/Orm/Tests/Fixtures/Entity/DummyCar.php

View check run for this annotation

Codecov / codecov/patch

src/Doctrine/Orm/Tests/Fixtures/Entity/DummyCar.php#L83

Added line #L83 was not covered by tests
{
return $this->colors;
}

public function setColors(Collection|iterable $colors): self
public function setColors(Collection $colors): self

Check warning on line 88 in src/Doctrine/Orm/Tests/Fixtures/Entity/DummyCar.php

View check run for this annotation

Codecov / codecov/patch

src/Doctrine/Orm/Tests/Fixtures/Entity/DummyCar.php#L88

Added line #L88 was not covered by tests
{
$this->colors = $colors;

Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Orm/Tests/Fixtures/Entity/FourthLevel.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class FourthLevel
#[Groups(['barcelona', 'chicago'])]
private int $level = 4;
#[ORM\OneToMany(targetEntity: ThirdLevel::class, cascade: ['persist'], mappedBy: 'badFourthLevel')]
public Collection|iterable|null $badThirdLevel = null;
public ?Collection $badThirdLevel = null;

public function getId(): ?int
{
Expand Down
4 changes: 2 additions & 2 deletions src/Doctrine/Orm/Tests/Fixtures/Entity/RelatedDummy.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

#[ORM\OneToMany(targetEntity: RelatedToDummyFriend::class, cascade: ['persist'], mappedBy: 'relatedDummy')]
#[Groups(['fakemanytomany', 'friends'])]
public Collection|iterable $relatedToDummyFriend;
public Collection $relatedToDummyFriend;

#[ORM\Column(enumType: DummyBackedEnum::class, nullable: true)]
public DummyBackedEnum $dummyBackedEnum;
Expand Down Expand Up @@ -180,7 +180,7 @@
/**
* Get relatedToDummyFriend.
*/
public function getRelatedToDummyFriend(): Collection|iterable
public function getRelatedToDummyFriend(): Collection

Check warning on line 183 in src/Doctrine/Orm/Tests/Fixtures/Entity/RelatedDummy.php

View check run for this annotation

Codecov / codecov/patch

src/Doctrine/Orm/Tests/Fixtures/Entity/RelatedDummy.php#L183

Added line #L183 was not covered by tests
{
return $this->relatedToDummyFriend;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Orm/Tests/Fixtures/Entity/ThirdLevel.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ThirdLevel
public $badFourthLevel;

#[ORM\OneToMany(mappedBy: 'thirdLevel', targetEntity: RelatedDummy::class)]
public Collection|iterable $relatedDummies;
public Collection $relatedDummies;

public function __construct()
{
Expand Down
6 changes: 4 additions & 2 deletions src/OpenApi/Tests/Fixtures/Dummy.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;

/**
* Dummy.
Expand Down Expand Up @@ -81,7 +83,7 @@
#[ApiProperty(push: true)]
public ?RelatedDummy $relatedDummy = null;

public iterable $relatedDummies;
public Collection $relatedDummies;

/**
* @var array|null serialize data
Expand All @@ -104,7 +106,7 @@

public function __construct()
{
$this->relatedDummies = [];
$this->relatedDummies = new ArrayCollection();

Check warning on line 109 in src/OpenApi/Tests/Fixtures/Dummy.php

View check run for this annotation

Codecov / codecov/patch

src/OpenApi/Tests/Fixtures/Dummy.php#L109

Added line #L109 was not covered by tests
}

public function getId()
Expand Down
4 changes: 2 additions & 2 deletions src/Serializer/Tests/Fixtures/ApiResource/Dummy.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
#[ApiProperty(push: true)]
public ?RelatedDummy $relatedDummy = null;

public Collection|iterable $relatedDummies;
public Collection $relatedDummies;

/**
* @phpstan-ignore-next-line
Expand Down Expand Up @@ -251,7 +251,7 @@
return $this->dummy;
}

public function getRelatedDummies(): Collection|iterable
public function getRelatedDummies(): Collection

Check warning on line 254 in src/Serializer/Tests/Fixtures/ApiResource/Dummy.php

View check run for this annotation

Codecov / codecov/patch

src/Serializer/Tests/Fixtures/ApiResource/Dummy.php#L254

Added line #L254 was not covered by tests
{
return $this->relatedDummies;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class DummyProperty
#[Groups(['dummy_read', 'dummy_graphql_read', 'dummy_write'])]
public $group;
#[Groups(['dummy_read', 'dummy_graphql_read', 'dummy_write'])]
public Collection|iterable|null $groups = null;
public ?Collection $groups = null;
/**
* @var string|null
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* @var Collection<int, DummyTableInheritance> Related children
*/
#[Groups(['default'])]
private Collection|iterable $children;
private Collection $children;

public function __construct()
{
Expand All @@ -42,12 +42,12 @@
return $this->id;
}

public function getChildren(): Collection|iterable
public function getChildren(): Collection

Check warning on line 45 in src/Serializer/Tests/Fixtures/ApiResource/DummyTableInheritanceRelated.php

View check run for this annotation

Codecov / codecov/patch

src/Serializer/Tests/Fixtures/ApiResource/DummyTableInheritanceRelated.php#L45

Added line #L45 was not covered by tests
{
return $this->children;
}

public function setChildren(Collection|iterable $children)
public function setChildren(Collection $children)

Check warning on line 50 in src/Serializer/Tests/Fixtures/ApiResource/DummyTableInheritanceRelated.php

View check run for this annotation

Codecov / codecov/patch

src/Serializer/Tests/Fixtures/ApiResource/DummyTableInheritanceRelated.php#L50

Added line #L50 was not covered by tests
{
$this->children = $children;

Expand Down
13 changes: 7 additions & 6 deletions src/Serializer/Tests/Fixtures/ApiResource/SecuredDummy.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use ApiPlatform\Metadata\GraphQl\QueryCollection;
use ApiPlatform\Metadata\Post;
use ApiPlatform\Metadata\Put;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Symfony\Component\Validator\Constraints as Assert;

Expand Down Expand Up @@ -83,7 +84,7 @@
* A collection of dummies that only admins can access.
*/
#[ApiProperty(security: "is_granted('ROLE_ADMIN')")]
public Collection|iterable $relatedDummies;
public Collection $relatedDummies;

/**
* A dummy that only admins can access.
Expand All @@ -97,7 +98,7 @@
* A collection of dummies that only users can access. The security on RelatedSecuredDummy shouldn't be run.
*/
#[ApiProperty(security: "is_granted('ROLE_USER')")]
public Collection|iterable $relatedSecuredDummies;
public Collection $relatedSecuredDummies;

/**
* A dummy that only users can access. The security on RelatedSecuredDummy shouldn't be run.
Expand All @@ -108,7 +109,7 @@
/**
* Collection of dummies that anyone can access. There is no ApiProperty security, and the security on RelatedSecuredDummy shouldn't be run.
*/
public iterable $publicRelatedSecuredDummies;
public Collection $publicRelatedSecuredDummies;

/**
* A dummy that anyone can access. There is no ApiProperty security, and the security on RelatedSecuredDummy shouldn't be run.
Expand All @@ -117,9 +118,9 @@

public function __construct()
{
$this->relatedDummies = [];
$this->relatedSecuredDummies = [];
$this->publicRelatedSecuredDummies = [];
$this->relatedDummies = new ArrayCollection();
$this->relatedSecuredDummies = new ArrayCollection();
$this->publicRelatedSecuredDummies = new ArrayCollection();

Check warning on line 123 in src/Serializer/Tests/Fixtures/ApiResource/SecuredDummy.php

View check run for this annotation

Codecov / codecov/patch

src/Serializer/Tests/Fixtures/ApiResource/SecuredDummy.php#L121-L123

Added lines #L121 - L123 were not covered by tests
}

public function getId(): ?int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AbsoluteUrlRelationDummy
#[ODM\Id(strategy: 'INCREMENT', type: 'int')]
private $id;
#[ODM\ReferenceMany(targetDocument: AbsoluteUrlDummy::class, mappedBy: 'absoluteUrlRelationDummy')]
public Collection|iterable $absoluteUrlDummies;
public Collection $absoluteUrlDummies;

public function __construct()
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixtures/TestBundle/Document/Answer.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Answer
private ?Question $question = null;
#[Serializer\Groups(['foobar'])]
#[ODM\ReferenceMany(targetDocument: Question::class, mappedBy: 'answer')]
private Collection|iterable $relatedQuestions;
private Collection $relatedQuestions;

public function __construct()
{
Expand Down Expand Up @@ -99,7 +99,7 @@ public function getQuestion(): ?Question
/**
* Get related question.
*/
public function getRelatedQuestions(): Collection|iterable
public function getRelatedQuestions(): Collection
{
return $this->relatedQuestions;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/TestBundle/Document/CircularReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CircularReference
public $parent;
#[Groups(['circular'])]
#[ODM\ReferenceMany(targetDocument: self::class, mappedBy: 'parent')]
public Collection|iterable $children;
public Collection $children;

public function __construct()
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixtures/TestBundle/Document/CompositeItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CompositeItem implements \Stringable
private ?string $field1 = null;
#[Groups(['default'])]
#[ODM\ReferenceMany(targetDocument: CompositeRelation::class, mappedBy: 'compositeItem')]
private Collection|iterable $compositeValues;
private Collection $compositeValues;

public function __construct()
{
Expand Down Expand Up @@ -67,7 +67,7 @@ public function setField1(?string $field1 = null): void
/**
* Gets compositeValues.
*/
public function getCompositeValues(): Collection|iterable
public function getCompositeValues(): Collection
{
return $this->compositeValues;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/TestBundle/Document/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Content implements \JsonSerializable
* @var Collection<Field>
*/
#[ODM\ReferenceMany(targetDocument: Field::class, mappedBy: 'content', strategy: 'set', cascade: ['persist'])]
private Collection|iterable $fields;
private Collection $fields;
#[ODM\Field(type: 'string')]
private string $status = ContentStatus::DRAFT;

Expand Down
Loading
Loading