ci: add php cs fixer

This commit is contained in:
Maël Gangloff
2024-08-02 23:24:52 +02:00
parent cd5060ed6a
commit b460e8aaa6
41 changed files with 1413 additions and 440 deletions

View File

@@ -31,7 +31,7 @@ use Symfony\Component\Uid\Uuid;
denormalizationContext: ['groups' => 'connector:create'],
name: 'create'
),
new Delete()
new Delete(),
]
)]
#[ORM\Entity(repositoryClass: ConnectorRepository::class)]
@@ -46,7 +46,6 @@ class Connector
#[ORM\JoinColumn(nullable: false)]
private ?User $user = null;
#[Groups(['connector:list', 'connector:create', 'watchlist:list'])]
#[ORM\Column(enumType: ConnectorProvider::class)]
private ?ConnectorProvider $provider = null;
@@ -61,7 +60,6 @@ class Connector
#[ORM\OneToMany(targetEntity: WatchList::class, mappedBy: 'connector')]
private Collection $watchLists;
public function __construct()
{
$this->id = Uuid::v4();
@@ -138,5 +136,4 @@ class Connector
return $this;
}
}

View File

@@ -6,7 +6,6 @@ use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use App\Controller\DomainRefreshController;
use App\Repository\DomainRepository;
use DateTimeImmutable;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
@@ -27,7 +26,7 @@ use Symfony\Component\Serializer\Attribute\SerializedName;
),
*/
new Get(
uriTemplate: '/domains/{ldhName}', # Do not delete this line, otherwise Symfony interprets the TLD of the domain name as a return type
uriTemplate: '/domains/{ldhName}', // Do not delete this line, otherwise Symfony interprets the TLD of the domain name as a return type
controller: DomainRefreshController::class,
normalizationContext: [
'groups' => [
@@ -36,11 +35,11 @@ use Symfony\Component\Serializer\Attribute\SerializedName;
'domain-entity:entity',
'nameserver-entity:nameserver',
'nameserver-entity:entity',
'tld:item'
]
'tld:item',
],
],
read: false
)
),
]
)]
class Domain
@@ -91,10 +90,10 @@ class Domain
private Collection $nameservers;
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
private ?DateTimeImmutable $createdAt = null;
private ?\DateTimeImmutable $createdAt = null;
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
private ?DateTimeImmutable $updatedAt = null;
private ?\DateTimeImmutable $updatedAt = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(referencedColumnName: 'tld', nullable: false)]
@@ -111,8 +110,8 @@ class Domain
$this->domainEntities = new ArrayCollection();
$this->watchLists = new ArrayCollection();
$this->nameservers = new ArrayCollection();
$this->createdAt = new DateTimeImmutable('now');
$this->updatedAt = new DateTimeImmutable('now');
$this->createdAt = new \DateTimeImmutable('now');
$this->updatedAt = new \DateTimeImmutable('now');
$this->deleted = false;
}
@@ -264,7 +263,7 @@ class Domain
return $this;
}
public function getUpdatedAt(): ?DateTimeImmutable
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updatedAt;
}
@@ -273,27 +272,25 @@ class Domain
#[ORM\PreUpdate]
public function updateTimestamps(): void
{
$this->setUpdatedAt(new DateTimeImmutable('now'));
if ($this->getCreatedAt() === null) {
$this->setCreatedAt(new DateTimeImmutable('now'));
$this->setUpdatedAt(new \DateTimeImmutable('now'));
if (null === $this->getCreatedAt()) {
$this->setCreatedAt(new \DateTimeImmutable('now'));
}
}
private function setUpdatedAt(?DateTimeImmutable $updatedAt): void
private function setUpdatedAt(?\DateTimeImmutable $updatedAt): void
{
$this->updatedAt = $updatedAt;
}
public function getCreatedAt(): ?DateTimeImmutable
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
private function setCreatedAt(?DateTimeImmutable $createdAt): void
private function setCreatedAt(?\DateTimeImmutable $createdAt): void
{
$this->createdAt = $createdAt;
}
public function getTld(): ?Tld

View File

@@ -27,7 +27,6 @@ class DomainEntity
#[Groups(['domain-entity:entity', 'domain-entity:domain'])]
private array $roles = [];
public function getDomain(): ?Domain
{
return $this->domain;
@@ -66,5 +65,4 @@ class DomainEntity
return $this;
}
}

View File

@@ -31,16 +31,14 @@ use Symfony\Component\Serializer\Attribute\SerializedName;
'domain-entity:domain',
'domain:list',
'nameserver-entity:nameserver',
'nameserver:list'
]
'nameserver:list',
],
]
)
),
]
)]
class Entity
{
#[ORM\Id]
#[ORM\Column(length: 255)]
#[Groups(['entity:list', 'entity:item', 'domain:item'])]
@@ -193,5 +191,4 @@ class Entity
return $this;
}
}

View File

@@ -8,12 +8,10 @@ use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: EntityEventRepository::class)]
class EntityEvent extends Event
{
#[ORM\ManyToOne(targetEntity: Entity::class, inversedBy: 'events')]
#[ORM\JoinColumn(referencedColumnName: 'handle', nullable: false)]
private ?Entity $entity = null;
public function getEntity(): ?Entity
{
return $this->entity;

View File

@@ -2,8 +2,6 @@
namespace App\Entity;
use App\Config\EventAction;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Attribute\Groups;
@@ -21,8 +19,7 @@ class Event
#[ORM\Column(type: 'datetime_immutable')]
#[Groups(['event:list'])]
private ?DateTimeImmutable $date = null;
private ?\DateTimeImmutable $date = null;
public function getId(): ?int
{
@@ -41,16 +38,15 @@ class Event
return $this;
}
public function getDate(): ?DateTimeImmutable
public function getDate(): ?\DateTimeImmutable
{
return $this->date;
}
public function setDate(DateTimeImmutable $date): static
public function setDate(\DateTimeImmutable $date): static
{
$this->date = $date;
return $this;
}
}

View File

@@ -19,8 +19,8 @@ use Symfony\Component\Serializer\Attribute\SerializedName;
uriTemplate: '/nameservers',
normalizationContext: [
'groups' => [
'nameserver:list'
]
'nameserver:list',
],
]
),
new Get(
@@ -30,15 +30,14 @@ use Symfony\Component\Serializer\Attribute\SerializedName;
'nameserver:item',
'nameserver-entity:entity',
'entity:list',
"event:list"
]
'event:list',
],
]
)
),
]
)]
class Nameserver
{
#[ORM\Id]
#[ORM\Column(length: 255)]
#[Groups(['nameserver:item', 'nameserver:list', 'domain:item'])]
@@ -133,5 +132,4 @@ class Nameserver
return $this;
}
}

View File

@@ -23,7 +23,6 @@ class NameserverEntity
#[Groups(['nameserver-entity:entity'])]
private ?Entity $entity = null;
#[ORM\Column(type: Types::SIMPLE_ARRAY)]
#[Groups(['nameserver-entity:entity', 'nameserver-entity:nameserver'])]
private array $roles = [];
@@ -82,5 +81,4 @@ class NameserverEntity
return $this;
}
}

View File

@@ -3,30 +3,27 @@
namespace App\Entity;
use App\Repository\RdapServerRepository;
use DateTimeImmutable;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: RdapServerRepository::class)]
class RdapServer
{
#[ORM\Id]
#[ORM\Column(length: 255)]
private ?string $url = null;
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
private ?DateTimeImmutable $updatedAt = null;
private ?\DateTimeImmutable $updatedAt = null;
#[ORM\Id]
#[ORM\ManyToOne(inversedBy: 'rdapServers')]
#[ORM\JoinColumn(referencedColumnName: 'tld', nullable: false)]
private ?Tld $tld = null;
public function __construct()
{
$this->updatedAt = new DateTimeImmutable('now');
$this->updatedAt = new \DateTimeImmutable('now');
}
public function getUrl(): ?string
@@ -41,12 +38,12 @@ class RdapServer
return $this;
}
public function getUpdatedAt(): ?DateTimeImmutable
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updatedAt;
}
public function setUpdatedAt(DateTimeImmutable $updatedAt): static
public function setUpdatedAt(\DateTimeImmutable $updatedAt): static
{
$this->updatedAt = $updatedAt;
@@ -57,7 +54,7 @@ class RdapServer
#[ORM\PreUpdate]
public function updateTimestamps(): void
{
$this->setUpdatedAt(new DateTimeImmutable('now'));
$this->setUpdatedAt(new \DateTimeImmutable('now'));
}
public function getTld(): ?Tld

View File

@@ -9,7 +9,6 @@ use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use App\Config\TldType;
use App\Repository\TldRepository;
use DateTimeImmutable;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
@@ -26,7 +25,7 @@ use Symfony\Component\Serializer\Attribute\Groups;
new Get(
uriTemplate: '/tld/{tld}',
normalizationContext: ['groups' => ['tld:item']]
)
),
]
)]
#[ApiFilter(SearchFilter::class)]
@@ -35,7 +34,7 @@ class Tld
{
#[ORM\Id]
#[ORM\Column(length: 63)]
#[Groups(["tld:list", "tld:item"])]
#[Groups(['tld:list', 'tld:item'])]
private ?string $tld = null;
/**
* @var Collection<int, RdapServer>
@@ -44,31 +43,31 @@ class Tld
private Collection $rdapServers;
#[ORM\Column(nullable: true)]
#[Groups(["tld:list", "tld:item"])]
#[Groups(['tld:list', 'tld:item'])]
private ?bool $contractTerminated = null;
#[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)]
#[Groups(["tld:item"])]
private ?DateTimeImmutable $dateOfContractSignature = null;
#[Groups(['tld:item'])]
private ?\DateTimeImmutable $dateOfContractSignature = null;
#[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)]
#[Groups(["tld:item"])]
private ?DateTimeImmutable $delegationDate = null;
#[Groups(['tld:item'])]
private ?\DateTimeImmutable $delegationDate = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(["tld:list", "tld:item"])]
#[Groups(['tld:list', 'tld:item'])]
private ?string $registryOperator = null;
#[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)]
#[Groups(["tld:item"])]
private ?DateTimeImmutable $removalDate = null;
#[Groups(['tld:item'])]
private ?\DateTimeImmutable $removalDate = null;
#[ORM\Column(nullable: true)]
#[Groups(["tld:list", "tld:item"])]
#[Groups(['tld:list', 'tld:item'])]
private ?bool $specification13 = null;
#[ORM\Column(length: 10, enumType: TldType::class)]
#[Groups(["tld:item"])]
#[Groups(['tld:item'])]
private ?TldType $type = null;
public function __construct()
@@ -130,24 +129,24 @@ class Tld
return $this;
}
public function getDateOfContractSignature(): ?DateTimeImmutable
public function getDateOfContractSignature(): ?\DateTimeImmutable
{
return $this->dateOfContractSignature;
}
public function setDateOfContractSignature(?DateTimeImmutable $dateOfContractSignature): static
public function setDateOfContractSignature(?\DateTimeImmutable $dateOfContractSignature): static
{
$this->dateOfContractSignature = $dateOfContractSignature;
return $this;
}
public function getDelegationDate(): ?DateTimeImmutable
public function getDelegationDate(): ?\DateTimeImmutable
{
return $this->delegationDate;
}
public function setDelegationDate(?DateTimeImmutable $delegationDate): static
public function setDelegationDate(?\DateTimeImmutable $delegationDate): static
{
$this->delegationDate = $delegationDate;
@@ -166,12 +165,12 @@ class Tld
return $this;
}
public function getRemovalDate(): ?DateTimeImmutable
public function getRemovalDate(): ?\DateTimeImmutable
{
return $this->removalDate;
}
public function setRemovalDate(?DateTimeImmutable $removalDate): static
public function setRemovalDate(?\DateTimeImmutable $removalDate): static
{
$this->removalDate = $removalDate;

View File

@@ -16,16 +16,16 @@ use Symfony\Component\Serializer\Attribute\Groups;
#[ORM\Entity(repositoryClass: UserRepository::class)]
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_EMAIL', fields: ['email'])]
#[ORM\Table(name: "`user`")]
#[ORM\Table(name: '`user`')]
#[UniqueEntity(fields: ['email'], message: 'There is already an account with this email')]
#[ApiResource(
operations: [
new Get(
uriTemplate: '/me',
controller: MeController::class,
normalizationContext: ["groups" => "user:list"],
normalizationContext: ['groups' => 'user:list'],
read: false
)
),
]
)]
class User implements UserInterface, PasswordAuthenticatedUserInterface
@@ -94,13 +94,13 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
*/
public function getUserIdentifier(): string
{
return (string)$this->email;
return (string) $this->email;
}
/**
* @return list<string>
* @see UserInterface
*
* @see UserInterface
*/
public function getRoles(): array
{
@@ -112,7 +112,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
}
/**
* @param array $roles
* @return User
*/
public function setRoles(array $roles): static

View File

@@ -40,12 +40,12 @@ use Symfony\Component\Uid\Uuid;
'text/calendar' => [
'schema' => [
'type' => 'string',
'format' => 'text'
]
]
]
]
]
'format' => 'text',
],
],
],
],
],
],
read: false,
deserialize: false,
@@ -61,7 +61,7 @@ use Symfony\Component\Uid\Uuid;
normalizationContext: ['groups' => 'watchlist:item'],
denormalizationContext: ['groups' => 'watchlist:update']
),
new Delete()
new Delete(),
],
)]
class WatchList
@@ -90,14 +90,13 @@ class WatchList
*/
#[ORM\OneToMany(targetEntity: WatchListTrigger::class, mappedBy: 'watchList', cascade: ['persist'], orphanRemoval: true)]
#[Groups(['watchlist:list', 'watchlist:item', 'watchlist:create', 'watchlist:update'])]
#[SerializedName("triggers")]
#[SerializedName('triggers')]
private Collection $watchListTriggers;
#[ORM\ManyToOne(inversedBy: 'watchLists')]
#[Groups(['watchlist:list', 'watchlist:item', 'watchlist:create', 'watchlist:update'])]
private ?Connector $connector = null;
public function __construct()
{
$this->token = Uuid::v4();