forked from wallabag/wallabag
Move to PHPStan level 4
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
namespace Wallabag\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Hateoas\Configuration\Annotation as Hateoas;
|
||||
use JMS\Serializer\Annotation\Exclude;
|
||||
@ -233,11 +234,14 @@ class Entry
|
||||
#[Groups(['export_all'])]
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @var Collection<Tag>
|
||||
*/
|
||||
#[ORM\JoinTable(name: 'entry_tag')]
|
||||
#[ORM\JoinColumn(name: 'entry_id', referencedColumnName: 'id', onDelete: 'cascade')]
|
||||
#[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id', onDelete: 'cascade')]
|
||||
#[ORM\ManyToMany(targetEntity: Tag::class, inversedBy: 'entries', cascade: ['persist'])]
|
||||
private $tags;
|
||||
private Collection $tags;
|
||||
|
||||
/*
|
||||
* @param User $user
|
||||
@ -589,7 +593,7 @@ class Entry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
public function getDomainName()
|
||||
{
|
||||
@ -597,7 +601,7 @@ class Entry
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $domainName
|
||||
* @param string|null $domainName
|
||||
*/
|
||||
public function setDomainName($domainName)
|
||||
{
|
||||
@ -605,7 +609,7 @@ class Entry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ArrayCollection
|
||||
* @return Collection
|
||||
*/
|
||||
public function getTags()
|
||||
{
|
||||
@ -696,7 +700,7 @@ class Entry
|
||||
/**
|
||||
* Get previewPicture.
|
||||
*
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPreviewPicture()
|
||||
{
|
||||
@ -706,7 +710,7 @@ class Entry
|
||||
/**
|
||||
* Set language.
|
||||
*
|
||||
* @param string $language
|
||||
* @param string|null $language
|
||||
*
|
||||
* @return Entry
|
||||
*/
|
||||
@ -720,7 +724,7 @@ class Entry
|
||||
/**
|
||||
* Get language.
|
||||
*
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
public function getLanguage()
|
||||
{
|
||||
@ -808,7 +812,7 @@ class Entry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTimeInterface
|
||||
* @return \DateTimeInterface|null
|
||||
*/
|
||||
public function getPublishedAt()
|
||||
{
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
namespace Wallabag\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Gedmo\Mapping\Annotation as Gedmo;
|
||||
use JMS\Serializer\Annotation\ExclusionPolicy;
|
||||
@ -41,8 +42,11 @@ class Tag implements \Stringable
|
||||
#[Expose]
|
||||
private $slug;
|
||||
|
||||
/**
|
||||
* @var Collection<Entry>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: Entry::class, mappedBy: 'tags', cascade: ['persist'])]
|
||||
private $entries;
|
||||
private Collection $entries;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -121,7 +125,7 @@ class Tag implements \Stringable
|
||||
/**
|
||||
* Get entries for this tag.
|
||||
*
|
||||
* @return ArrayCollection<Entry>
|
||||
* @return Collection<Entry>
|
||||
*/
|
||||
public function getEntries()
|
||||
{
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
namespace Wallabag\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use FOS\UserBundle\Model\User as BaseUser;
|
||||
use JMS\Serializer\Annotation\Accessor;
|
||||
@ -117,16 +118,16 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @var ArrayCollection&iterable<SiteCredential>
|
||||
* @var Collection<SiteCredential>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: SiteCredential::class, mappedBy: 'user', cascade: ['remove'])]
|
||||
protected $siteCredentials;
|
||||
protected Collection $siteCredentials;
|
||||
|
||||
/**
|
||||
* @var ArrayCollection&iterable<Client>
|
||||
* @var Collection<Client>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: Client::class, mappedBy: 'user', cascade: ['remove'])]
|
||||
protected $clients;
|
||||
protected Collection $clients;
|
||||
|
||||
/**
|
||||
* @see getFirstClient() below
|
||||
@ -162,6 +163,8 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI
|
||||
{
|
||||
parent::__construct();
|
||||
$this->entries = new ArrayCollection();
|
||||
$this->siteCredentials = new ArrayCollection();
|
||||
$this->clients = new ArrayCollection();
|
||||
$this->roles = ['ROLE_USER'];
|
||||
}
|
||||
|
||||
@ -216,7 +219,7 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ArrayCollection<Entry>
|
||||
* @return Collection<Entry>
|
||||
*/
|
||||
public function getEntries()
|
||||
{
|
||||
@ -338,13 +341,15 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI
|
||||
*/
|
||||
public function addClient(Client $client)
|
||||
{
|
||||
$this->clients[] = $client;
|
||||
if (!$this->clients->contains($client)) {
|
||||
$this->clients->add($client);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ArrayCollection<Client>
|
||||
* @return Collection<Client>
|
||||
*/
|
||||
public function getClients()
|
||||
{
|
||||
@ -358,7 +363,7 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI
|
||||
*/
|
||||
public function getFirstClient()
|
||||
{
|
||||
if (!empty($this->clients)) {
|
||||
if (!$this->clients->isEmpty()) {
|
||||
return $this->clients->first();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user