Skip to content

Commit

Permalink
Merge pull request #2363 from franmomu/add_types_2
Browse files Browse the repository at this point in the history
Add more missing property type hints
  • Loading branch information
malarzm authored Sep 2, 2021
2 parents 0f64911 + 489632a commit 34426e3
Show file tree
Hide file tree
Showing 117 changed files with 1,849 additions and 429 deletions.
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,6 @@ parameters:
count: 2
path: tests/Doctrine/ODM/MongoDB/Tests/Functional/QueryTest.php

-
message: "#^Comparison operation \"\\<\" between \\(array\\|float\\|int\\) and 0 results in an error\\.$#"
count: 1
path: tests/Doctrine/ODM/MongoDB/Tests/Functional/Ticket/GH1275Test.php

-
message: "#^Cannot call method current\\(\\) on array\\|int\\|object\\.$#"
count: 1
Expand Down
6 changes: 5 additions & 1 deletion tests/Doctrine/ODM/MongoDB/Tests/Functional/AlsoLoadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,11 @@ public function testMethodAlsoLoadGrandparentInheritance(): void
/** @ODM\Document */
class AlsoLoadDocument
{
/** @ODM\Id */
/**
* @ODM\Id
*
* @var string|null
*/
public $id;

/**
Expand Down
64 changes: 51 additions & 13 deletions tests/Doctrine/ODM/MongoDB/Tests/Functional/AtomicSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Doctrine\ODM\MongoDB\Tests\Functional;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ODM\MongoDB\APM\CommandLogger;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
use Doctrine\ODM\MongoDB\Tests\BaseTest;
Expand Down Expand Up @@ -552,17 +553,26 @@ public function testUpdatedEmbeddedDocumentAndDirtyCollectionInside(): void
*/
class AtomicSetUser
{
/** @ODM\Id */
/**
* @ODM\Id
*
* @var ObjectId|null
*/
public $id;

/**
* @ODM\Field(type="string")
*
* @var string|null
* @var string
*/
public $name;

/** @ODM\Field(type="int") @ODM\Version */
/**
* @ODM\Field(type="int")
* @ODM\Version
*
* @var int
*/
public $version = 1;

/**
Expand All @@ -572,22 +582,42 @@ class AtomicSetUser
*/
public $surname;

/** @ODM\EmbedMany(strategy="atomicSet", targetDocument=Documents\Phonenumber::class) */
/**
* @ODM\EmbedMany(strategy="atomicSet", targetDocument=Documents\Phonenumber::class)
*
* @var Collection<int, Phonenumber>
*/
public $phonenumbers;

/** @ODM\EmbedMany(strategy="atomicSetArray", targetDocument=Documents\Phonenumber::class) */
/**
* @ODM\EmbedMany(strategy="atomicSetArray", targetDocument=Documents\Phonenumber::class)
*
* @var Collection<int, Phonenumber>
*/
public $phonenumbersArray;

/** @ODM\EmbedMany(strategy="atomicSet", targetDocument=Documents\Phonebook::class) */
/**
* @ODM\EmbedMany(strategy="atomicSet", targetDocument=Documents\Phonebook::class)
*
* @var Collection<int, Phonebook>
*/
public $phonebooks;

/** @ODM\EmbedMany(strategy="atomicSet", targetDocument=AtomicSetInception::class) */
/**
* @ODM\EmbedMany(strategy="atomicSet", targetDocument=AtomicSetInception::class)
*
* @var Collection<int, AtomicSetInception>
*/
public $inception;

/** @ODM\ReferenceMany(strategy="atomicSetArray", targetDocument=AtomicSetUser::class) */
/**
* @ODM\ReferenceMany(strategy="atomicSetArray", targetDocument=AtomicSetUser::class)
*
* @var Collection<int, AtomicSetUser>|array<AtomicSetUser>
*/
public $friends;

public function __construct($name)
public function __construct(string $name)
{
$this->name = $name;
$this->phonenumbers = new ArrayCollection();
Expand All @@ -605,17 +635,25 @@ class AtomicSetInception
/**
* @ODM\Field(type="string")
*
* @var string|null
* @var string
*/
public $value;

/** @ODM\EmbedOne(targetDocument=AtomicSetInception::class) */
/**
* @ODM\EmbedOne(targetDocument=AtomicSetInception::class)
*
* @var AtomicSetInception|null
*/
public $one;

/** @ODM\EmbedMany(targetDocument=AtomicSetInception::class) */
/**
* @ODM\EmbedMany(targetDocument=AtomicSetInception::class)
*
* @var Collection<int, AtomicSetInception>
*/
public $many;

public function __construct($value)
public function __construct(string $value)
{
$this->value = $value;
$this->many = new ArrayCollection();
Expand Down
6 changes: 5 additions & 1 deletion tests/Doctrine/ODM/MongoDB/Tests/Functional/BinDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ public function provideData(): array
/** @ODM\Document */
class BinDataTestUser
{
/** @ODM\Id */
/**
* @ODM\Id
*
* @var string|null
*/
public $id;

/** @ODM\Field(type="bin") */
Expand Down
Loading

0 comments on commit 34426e3

Please sign in to comment.