Skip to content

Commit

Permalink
Merge pull request #8510 from greg0ire/cs-20210224
Browse files Browse the repository at this point in the history
CS batch 19/an estimated 26
  • Loading branch information
greg0ire committed Feb 24, 2021
2 parents 89f57de + 0bce247 commit e40ac3e
Show file tree
Hide file tree
Showing 39 changed files with 273 additions and 136 deletions.
17 changes: 11 additions & 6 deletions tests/Doctrine/Tests/Models/Company/CompanyFlexContract.php
Expand Up @@ -4,6 +4,7 @@

namespace Doctrine\Tests\Models\Company;

use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping\ClassMetadataInfo;

/**
Expand Down Expand Up @@ -58,12 +59,13 @@ class CompanyFlexContract extends CompanyContract
private $hoursWorked = 0;

/**
* @column(type="integer")
* @var int
* @Column(type="integer")
*/
private $pricePerHour = 0;

/**
* @psalm-var Collection<int, CompanyManager>
* @ManyToMany(targetEntity="CompanyManager", inversedBy="managedContracts", fetch="EXTRA_LAZY")
* @JoinTable(name="company_contract_managers",
* joinColumns={@JoinColumn(name="contract_id", referencedColumnName="id", onDelete="CASCADE")},
Expand All @@ -77,27 +79,30 @@ public function calculatePrice(): int
return $this->hoursWorked * $this->pricePerHour;
}

public function getHoursWorked()
public function getHoursWorked(): int
{
return $this->hoursWorked;
}

public function setHoursWorked($hoursWorked): void
public function setHoursWorked(int $hoursWorked): void
{
$this->hoursWorked = $hoursWorked;
}

public function getPricePerHour()
public function getPricePerHour(): int
{
return $this->pricePerHour;
}

public function setPricePerHour($pricePerHour): void
public function setPricePerHour(int $pricePerHour): void
{
$this->pricePerHour = $pricePerHour;
}

public function getManagers()
/**
* @psalm-return Collection<int, CompanyManager>
*/
public function getManagers(): Collection
{
return $this->managers;
}
Expand Down
Expand Up @@ -26,12 +26,12 @@ public function calculatePrice(): int
return max($this->maxPrice, parent::calculatePrice());
}

public function getMaxPrice()
public function getMaxPrice(): int
{
return $this->maxPrice;
}

public function setMaxPrice($maxPrice): void
public function setMaxPrice(int $maxPrice): void
{
$this->maxPrice = $maxPrice;
}
Expand Down
Expand Up @@ -10,6 +10,7 @@

class CompanyFlexUltraContractListener
{
/** @psalm-var list<mixed[]> */
public $prePersistCalls;

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/Doctrine/Tests/Models/Company/CompanyManager.php
Expand Up @@ -31,17 +31,17 @@ class CompanyManager extends CompanyEmployee
*/
public $managedContracts;

public function getTitle()
public function getTitle(): string
{
return $this->title;
}

public function setTitle($title): void
public function setTitle(string $title): void
{
$this->title = $title;
}

public function getCar()
public function getCar(): CompanyCar
{
return $this->car;
}
Expand Down
9 changes: 6 additions & 3 deletions tests/Doctrine/Tests/Models/Company/CompanyRaffle.php
Expand Up @@ -7,15 +7,18 @@
/** @Entity @Table(name="company_raffles") */
class CompanyRaffle extends CompanyEvent
{
/** @Column */
/**
* @var string
* @Column
*/
private $data;

public function setData($data): void
public function setData(string $data): void
{
$this->data = $data;
}

public function getData()
public function getData(): string
{
return $this->data;
}
Expand Down
Expand Up @@ -5,6 +5,7 @@
namespace Doctrine\Tests\Models\CustomType;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\Tests\DbalTypes\CustomIdObject;

/**
Expand All @@ -19,7 +20,10 @@ class CustomIdObjectTypeParent
*/
public $id;

/** @OneToMany(targetEntity="Doctrine\Tests\Models\CustomType\CustomIdObjectTypeChild", cascade={"persist", "remove"}, mappedBy="parent") */
/**
* @psalm-var Collection<int, CustomIdObjectTypeChild>
* @OneToMany(targetEntity="Doctrine\Tests\Models\CustomType\CustomIdObjectTypeChild", cascade={"persist", "remove"}, mappedBy="parent")
*/
public $children;

public function __construct(CustomIdObject $id)
Expand Down
5 changes: 4 additions & 1 deletion tests/Doctrine/Tests/Models/CustomType/CustomTypeChild.php
Expand Up @@ -17,6 +17,9 @@ class CustomTypeChild
*/
public $id;

/** @Column(type="upper_case_string") */
/**
* @var string
* @Column(type="upper_case_string")
*/
public $lowerCaseString = 'foo';
}
14 changes: 12 additions & 2 deletions tests/Doctrine/Tests/Models/CustomType/CustomTypeParent.php
Expand Up @@ -20,7 +20,10 @@ class CustomTypeParent
*/
public $id;

/** @Column(type="negative_to_positive", nullable=true) */
/**
* @var int
* @Column(type="negative_to_positive", nullable=true)
*/
public $customInteger;

/**
Expand All @@ -36,6 +39,7 @@ class CustomTypeParent
private $friendsWithMe;

/**
* @psalm-var Collection<int, CustomTypeParent>
* @ManyToMany(targetEntity="Doctrine\Tests\Models\CustomType\CustomTypeParent", inversedBy="friendsWithMe")
* @JoinTable(
* name="customtype_parent_friends",
Expand All @@ -57,7 +61,10 @@ public function addMyFriend(CustomTypeParent $friend): void
$friend->addFriendWithMe($this);
}

public function getMyFriends()
/**
* @psalm-return Collection<int, CustomTypeParent>
*/
public function getMyFriends(): Collection
{
return $this->myFriends;
}
Expand All @@ -67,6 +74,9 @@ public function addFriendWithMe(CustomTypeParent $friend): void
$this->getFriendsWithMe()->add($friend);
}

/**
* @psalm-return Collection<int, CustomTypeParent>
*/
public function getFriendsWithMe()
{
return $this->friendsWithMe;
Expand Down
10 changes: 8 additions & 2 deletions tests/Doctrine/Tests/Models/CustomType/CustomTypeUpperCase.php
Expand Up @@ -17,9 +17,15 @@ class CustomTypeUpperCase
*/
public $id;

/** @Column(type="upper_case_string") */
/**
* @var string
* @Column(type="upper_case_string")
*/
public $lowerCaseString;

/** @Column(type="upper_case_string", name="named_lower_case_string", nullable = true) */
/**
* @var string
* @Column(type="upper_case_string", name="named_lower_case_string", nullable = true)
*/
public $namedLowerCaseString;
}
17 changes: 11 additions & 6 deletions tests/Doctrine/Tests/Models/DDC117/DDC117ApproveChanges.php
Expand Up @@ -25,6 +25,7 @@ class DDC117ApproveChanges
private $articleDetails;

/**
* @var DDC117Reference
* @ManyToOne(targetEntity="DDC117Reference")
* @JoinColumns({
* @JoinColumn(name="source_id", referencedColumnName="source_id"),
Expand All @@ -34,6 +35,7 @@ class DDC117ApproveChanges
private $reference;

/**
* @var DDC117Translation
* @ManyToOne(targetEntity="DDC117Translation")
* @JoinColumns({
* @JoinColumn(name="trans_article_id", referencedColumnName="article_id"),
Expand All @@ -42,29 +44,32 @@ class DDC117ApproveChanges
*/
private $translation;

public function __construct($details, $reference, $translation)
{
public function __construct(
DDC117ArticleDetails $details,
DDC117Reference $reference,
DDC117Translation $translation
) {
$this->articleDetails = $details;
$this->reference = $reference;
$this->translation = $translation;
}

public function getId()
public function getId(): int
{
return $this->id;
}

public function getArticleDetails()
public function getArticleDetails(): DDC117ArticleDetails
{
return $this->articleDetails;
}

public function getReference()
public function getReference(): DDC117Reference
{
return $this->reference;
}

public function getTranslation()
public function getTranslation(): DDC117Translation
{
return $this->translation;
}
Expand Down
7 changes: 5 additions & 2 deletions tests/Doctrine/Tests/Models/DDC117/DDC117Editor.php
Expand Up @@ -5,6 +5,7 @@
namespace Doctrine\Tests\Models\DDC117;

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

/**
* @Entity
Expand All @@ -20,12 +21,13 @@ class DDC117Editor
public $id;

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

/**
* @psalm-var Collection<int, DDC117Translation>
* @ManyToMany(targetEntity="DDC117Translation", inversedBy="reviewedByEditors")
* @JoinTable(
* inverseJoinColumns={
Expand All @@ -40,6 +42,7 @@ class DDC117Editor
public $reviewingTranslations;

/**
* @var DDC117Translation
* @ManyToOne(targetEntity="DDC117Translation", inversedBy="lastTranslatedBy")
* @JoinColumns({
* @JoinColumn(name="lt_article_id", referencedColumnName="article_id"),
Expand All @@ -48,7 +51,7 @@ class DDC117Editor
*/
public $lastTranslation;

public function __construct($name = '')
public function __construct(?string $name = '')
{
$this->name = $name;
$this->reviewingTranslations = new ArrayCollection();
Expand Down
15 changes: 3 additions & 12 deletions tests/Doctrine/Tests/Models/DDC1590/DDC1590Entity.php
Expand Up @@ -24,31 +24,22 @@ abstract class DDC1590Entity
* @var DateTime
* @Column(type="datetime")
*/
protected $created_at;
protected $createdAt;

/**
* Get id
*/
public function getId(): int
{
return $this->id;
}

/**
* Set createdAt
*/
public function setCreatedAt(DateTime $createdAt): DDC1590User
{
$this->created_at = $createdAt;
$this->createdAt = $createdAt;

return $this;
}

/**
* Get createdAt
*/
public function getCreatedAt(): DateTime
{
return $this->created_at;
return $this->createdAt;
}
}
10 changes: 6 additions & 4 deletions tests/Doctrine/Tests/Models/DDC2372/DDC2372Address.php
Expand Up @@ -13,33 +13,35 @@ class DDC2372Address
* @GeneratedValue(strategy="AUTO")
*/
private $id;

/**
* @var string
* @Column(type="string", length=255)
*/
private $street;

/**
* @var User
* @OneToOne(targetEntity="User", mappedBy="address")
*/
private $user;

public function getId()
public function getId(): int
{
return $this->id;
}

public function getStreet()
public function getStreet(): string
{
return $this->street;
}

public function setStreet($street): void
public function setStreet(string $street): void
{
$this->street = $street;
}

public function getUser()
public function getUser(): User
{
return $this->user;
}
Expand Down

0 comments on commit e40ac3e

Please sign in to comment.