Skip to content

Commit

Permalink
Merge pull request #8504 from greg0ire/cs-20210223
Browse files Browse the repository at this point in the history
CS batch 18/an estimated 26
  • Loading branch information
greg0ire committed Feb 23, 2021
2 parents ae19f40 + 2dce5b2 commit 89f57de
Show file tree
Hide file tree
Showing 56 changed files with 331 additions and 185 deletions.
5 changes: 4 additions & 1 deletion tests/Doctrine/Tests/Models/Company/CompanyEmployee.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ class CompanyEmployee extends CompanyPerson
*/
private $department;

/** @Column(type="datetime", nullable=true) */
/**
* @var DateTime|null
* @Column(type="datetime", nullable=true)
*/
private $startDate;

/**
Expand Down
5 changes: 4 additions & 1 deletion tests/Doctrine/Tests/Models/DDC1590/DDC1590Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ abstract class DDC1590Entity
*/
protected $id;

/** @Column(type="datetime") */
/**
* @var DateTime
* @Column(type="datetime")
*/
protected $created_at;

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/Doctrine/Tests/Models/GH7141/GH7141Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
namespace Doctrine\Tests\Models\GH7141;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;

class GH7141Article
{
/** @psalm-var Collection<int, mixed> */
private $tags;

public function __construct()
Expand Down
2 changes: 2 additions & 0 deletions tests/Doctrine/Tests/Models/GH7316/GH7316Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
namespace Doctrine\Tests\Models\GH7316;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;

class GH7316Article
{
/** @psalm-var Collection<int, mixed> */
private $tags;

public function __construct()
Expand Down
6 changes: 5 additions & 1 deletion tests/Doctrine/Tests/Models/Generic/BooleanModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class BooleanModel
* @GeneratedValue(strategy="AUTO")
*/
public $id;
/** @Column(type="boolean") */

/**
* @var bool
* @Column(type="boolean")
*/
public $booleanField;
}
18 changes: 15 additions & 3 deletions tests/Doctrine/Tests/Models/Generic/DateTimeModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,22 @@ class DateTimeModel
* @GeneratedValue
*/
public $id;
/** @Column(name="col_datetime", type="datetime", nullable=true) */

/**
* @var DateTime|null
* @Column(name="col_datetime", type="datetime", nullable=true)
*/
public $datetime;
/** @Column(name="col_date", type="date", nullable=true) */

/**
* @var DateTime|null
* @Column(name="col_date", type="date", nullable=true)
*/
public $date;
/** @Column(name="col_time", type="time", nullable=true) */

/**
* @var DateTime|null
* @Column(name="col_time", type="time", nullable=true)
*/
public $time;
}
11 changes: 9 additions & 2 deletions tests/Doctrine/Tests/Models/Generic/DecimalModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@ class DecimalModel
* @GeneratedValue(strategy="AUTO")
*/
public $id;
/** @Column(name="`decimal`", type="decimal", scale=2, precision=5) */

/**
* @var float
* @Column(name="`decimal`", type="decimal", scale=2, precision=5)
*/
public $decimal;

/** @Column(name="`high_scale`", type="decimal", scale=4, precision=14) */
/**
* @var float
* @Column(name="`high_scale`", type="decimal", scale=4, precision=14)
*/
public $highScale;
}
11 changes: 9 additions & 2 deletions tests/Doctrine/Tests/Models/Generic/SerializationModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@ class SerializationModel
* @GeneratedValue(strategy="AUTO")
*/
public $id;
/** @Column(name="the_array", type="array", nullable=true) */

/**
* @var mixed[]
* @Column(name="the_array", type="array", nullable=true)
*/
public $array;

/** @Column(name="the_obj", type="object", nullable=true) */
/**
* @var object
* @Column(name="the_obj", type="object", nullable=true)
*/
public $object;
}
4 changes: 3 additions & 1 deletion tests/Doctrine/Tests/Models/GeoNames/Admin1.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Admin1
public $id;

/**
* @var Country
* @Id
* @ManyToOne(targetEntity="Country")
* @JoinColumn(name="country", referencedColumnName="id")
Expand All @@ -28,6 +29,7 @@ class Admin1
public $country;

/**
* @psalm-var Collection<int, Admin1AlternateName>
* @OneToMany(targetEntity="Admin1AlternateName", mappedBy="admin1")
* @Cache
*/
Expand All @@ -39,7 +41,7 @@ class Admin1
*/
public $name;

public function __construct($id, $name, Country $country)
public function __construct(int $id, string $name, Country $country)
{
$this->id = $id;
$this->name = $name;
Expand Down
5 changes: 3 additions & 2 deletions tests/Doctrine/Tests/Models/GeoNames/Admin1AlternateName.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
class Admin1AlternateName
{
/**
* @var string
* @var int
* @Id
* @Column(type="string", length=25)
* @GeneratedValue(strategy="NONE")
*/
public $id;

/**
* @var Admin1
* @ManyToOne(targetEntity="Admin1", inversedBy="names")
* @JoinColumns({
* @JoinColumn(name="admin1", referencedColumnName="id"),
Expand All @@ -35,7 +36,7 @@ class Admin1AlternateName
*/
public $name;

public function __construct($id, $name, Admin1 $admin1)
public function __construct(int $id, string $name, Admin1 $admin1)
{
$this->id = $id;
$this->name = $name;
Expand Down
4 changes: 3 additions & 1 deletion tests/Doctrine/Tests/Models/GeoNames/City.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ class City
public $id;

/**
* @var Country
* @ManyToOne(targetEntity="Country")
* @JoinColumn(name="country", referencedColumnName="id")
* @Cache
*/
public $country;

/**
* @var Admin1
* @ManyToOne(targetEntity="Admin1")
* @JoinColumns({
* @JoinColumn(name="admin1", referencedColumnName="id"),
Expand All @@ -42,7 +44,7 @@ class City
*/
public $name;

public function __construct($id, $name)
public function __construct(int $id, string $name)
{
$this->id = $id;
$this->name = $name;
Expand Down
17 changes: 12 additions & 5 deletions tests/Doctrine/Tests/Models/Global/GlobalNamespaceModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

declare(strict_types=1);

use Doctrine\Common\Collections\Collection;

/**
* @Entity
* @Table(name="articles")
*/
class DoctrineGlobal_Article
class DoctrineGlobalArticle
{
/**
* @var int
Expand All @@ -21,11 +23,15 @@ class DoctrineGlobal_Article
*/
protected $headline;

/** @column(type="text") */
/**
* @var string
* @Column(type="text")
*/
protected $text;

/**
* @ManyToMany(targetEntity="DoctrineGlobal_User")
* @psalm-var Collection<int, DoctrineGlobalUser>
* @ManyToMany(targetEntity="DoctrineGlobalUser")
* @JoinTable(name="author_articles",
* joinColumns={@JoinColumn(name="article_id", referencedColumnName="id")},
* inverseJoinColumns={@JoinColumn(name="author_id", referencedColumnName="id", unique=true)}
Expand All @@ -34,7 +40,8 @@ class DoctrineGlobal_Article
protected $author;

/**
* @ManyToMany(targetEntity="DoctrineGlobal_User")
* @psalm-var Collection<int, DoctrineGlobalUser>
* @ManyToMany(targetEntity="DoctrineGlobalUser")
* @JoinTable(name="editor_articles",
* joinColumns={@JoinColumn(name="article_id", referencedColumnName="id")},
* inverseJoinColumns={@JoinColumn(name="editor_id", referencedColumnName="id", unique=true)}
Expand All @@ -47,7 +54,7 @@ class DoctrineGlobal_Article
* @Entity
* @Table(name="users")
*/
class DoctrineGlobal_User
class DoctrineGlobalUser
{
/**
* @Id
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/Legacy/LegacyArticle.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class LegacyArticle

/**
* @var LegacyUser
* @ManyToOne(targetEntity="LegacyUser", inversedBy="_articles")
* @ManyToOne(targetEntity="LegacyUser", inversedBy="articles")
* @JoinColumn(name="iUserId", referencedColumnName="iUserId")
*/
public $user;
Expand Down
21 changes: 12 additions & 9 deletions tests/Doctrine/Tests/Models/Legacy/LegacyCar.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,35 @@ class LegacyCar
* @GeneratedValue
* @Column(name="iCarId", type="integer", nullable=false)
*/
public $_id;
public $id;

/**
* @psalm-var Collection<int, LegacyUser>
* @ManyToMany(targetEntity="LegacyUser", mappedBy="_cars")
* @ManyToMany(targetEntity="LegacyUser", mappedBy="cars")
*/
public $_users;
public $users;

/**
* @var string
* @Column(name="sDescription", type="string", length=255, unique=true)
*/
public $_description;
public $description;

public function getDescription()
public function getDescription(): string
{
return $this->_description;
return $this->description;
}

public function addUser(LegacyUser $user): void
{
$this->_users[] = $user;
$this->users[] = $user;
}

public function getUsers()
/**
* @psalm-return Collection<int, LegacyUser>
*/
public function getUsers(): Collection
{
return $this->_users;
return $this->users;
}
}

0 comments on commit 89f57de

Please sign in to comment.