apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -17,7 +17,9 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
/**
* @ORM\Entity
*
* @ORM\Table(name="chill_person_relations")
*
* @DiscriminatorMap(typeProperty="type", mapping={
* "relation": Relation::class
* })
@@ -26,28 +28,36 @@ class Relation
{
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read", "docgen:read"})
*/
private ?int $id = null;
/**
* @ORM\Column(type="boolean", nullable=true)
*
* @Serializer\Groups({"read"})
*/
private bool $isActive = true;
/**
* @ORM\Column(type="json", nullable=true)
*
* @Serializer\Groups({"read"})
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
private array $reverseTitle = [];
/**
* @ORM\Column(type="json", nullable=true)
*
* @Serializer\Groups({"read"})
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
private array $title = [];

View File

@@ -16,8 +16,6 @@ use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Validator\Constraints\Relationship\RelationshipNoDuplicate;
use DateTimeImmutable;
use DateTimeInterface;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\DiscriminatorColumn;
use RuntimeException;
@@ -27,11 +25,15 @@ use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
*
* @ORM\Table(name="chill_person_relationships")
*
* @DiscriminatorColumn(name="relation_id", type="integer")
*
* @DiscriminatorMap(typeProperty="type", mapping={
* "relationship": Relationship::class
* })
*
* @RelationshipNoDuplicate
*/
class Relationship implements TrackCreationInterface, TrackUpdateInterface
@@ -39,52 +41,67 @@ class Relationship implements TrackCreationInterface, TrackUpdateInterface
/**
* @ORM\Column(type="datetime_immutable")
*/
private ?DateTimeImmutable $createdAt = null;
private ?\DateTimeImmutable $createdAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*/
private ?User $createdBy = null;
/**
* @ORM\ManyToOne(targetEntity=Person::class)
*
* @ORM\JoinColumn(nullable=false)
*
* @Assert\NotNull
*
* @Serializer\Groups({"read", "write"})
*/
private ?Person $fromPerson = null;
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read"})
*/
private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=Relation::class)
*
* @ORM\JoinColumn(nullable=false, name="relation_id", referencedColumnName="id")
*
* @Assert\NotNull
*
* @Serializer\Groups({"read", "write"})
*/
private ?Relation $relation = null;
/**
* @ORM\Column(type="boolean")
*
* @Assert\Type(
* type="bool",
* message="This must be of type boolean"
* )
*
* @Serializer\Groups({"read", "write"})
*/
private bool $reverse;
/**
* @ORM\ManyToOne(targetEntity=Person::class)
*
* @ORM\JoinColumn(nullable=false)
*
* @Assert\NotNull
*
* @Serializer\Groups({"read", "write"})
*/
private ?Person $toPerson = null;
@@ -92,14 +109,14 @@ class Relationship implements TrackCreationInterface, TrackUpdateInterface
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
private ?DateTimeImmutable $updatedAt = null;
private ?\DateTimeImmutable $updatedAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*/
private ?User $updatedBy = null;
public function getCreatedAt(): ?DateTimeImmutable
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
@@ -130,7 +147,7 @@ class Relationship implements TrackCreationInterface, TrackUpdateInterface
public function getOpposite(Person $counterpart): Person
{
if ($this->fromPerson !== $counterpart && $this->toPerson !== $counterpart) {
throw new RuntimeException('the counterpart is neither the from nor to person for this relationship');
throw new \RuntimeException('the counterpart is neither the from nor to person for this relationship');
}
if ($this->fromPerson === $counterpart) {
@@ -155,7 +172,7 @@ class Relationship implements TrackCreationInterface, TrackUpdateInterface
return $this->toPerson;
}
public function getUpdatedAt(): ?DateTimeImmutable
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updatedAt;
}
@@ -165,7 +182,7 @@ class Relationship implements TrackCreationInterface, TrackUpdateInterface
return $this->updatedBy;
}
public function setCreatedAt(DateTimeInterface $createdAt): self
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
@@ -207,7 +224,7 @@ class Relationship implements TrackCreationInterface, TrackUpdateInterface
return $this;
}
public function setUpdatedAt(?DateTimeInterface $updatedAt): self
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;