mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-28 09:34:59 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -11,12 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Doctrine\Model;
|
||||
|
||||
use Exception;
|
||||
use JsonSerializable;
|
||||
|
||||
use function json_encode;
|
||||
|
||||
class Point implements JsonSerializable
|
||||
class Point implements \JsonSerializable
|
||||
{
|
||||
public static string $SRID = '4326';
|
||||
|
||||
@@ -28,7 +23,7 @@ class Point implements JsonSerializable
|
||||
return self::fromLonLat($array['coordinates'][0], $array['coordinates'][1]);
|
||||
}
|
||||
|
||||
throw new Exception('Unable to build a point from input data.');
|
||||
throw new \Exception('Unable to build a point from input data.');
|
||||
}
|
||||
|
||||
public static function fromGeoJson(string $geojson): self
|
||||
@@ -88,7 +83,7 @@ class Point implements JsonSerializable
|
||||
{
|
||||
$array = $this->toArrayGeoJson();
|
||||
|
||||
return json_encode($array, JSON_THROW_ON_ERROR);
|
||||
return \json_encode($array, JSON_THROW_ON_ERROR);
|
||||
}
|
||||
|
||||
public function toWKT(): string
|
||||
|
@@ -11,12 +11,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Doctrine\Model;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Description of PointException.
|
||||
*/
|
||||
class PointException extends Exception
|
||||
class PointException extends \Exception
|
||||
{
|
||||
public static function badCoordinates($lon, $lat): self
|
||||
{
|
||||
|
@@ -12,11 +12,10 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Doctrine\Model;
|
||||
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use DateTimeInterface;
|
||||
|
||||
interface TrackCreationInterface
|
||||
{
|
||||
public function setCreatedAt(DateTimeInterface $datetime): self;
|
||||
public function setCreatedAt(\DateTimeInterface $datetime): self;
|
||||
|
||||
public function setCreatedBy(User $user): self;
|
||||
}
|
||||
|
@@ -13,8 +13,6 @@ namespace Chill\MainBundle\Doctrine\Model;
|
||||
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use DateTime;
|
||||
use DateTimeImmutable;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
|
||||
@@ -22,18 +20,21 @@ trait TrackCreationTrait
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=true, options={"default": NULL})
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private ?DateTimeImmutable $createdAt = null;
|
||||
private ?\DateTimeImmutable $createdAt = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private ?User $createdBy = null;
|
||||
|
||||
public function getCreatedAt(): ?DateTimeInterface
|
||||
public function getCreatedAt(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
@@ -43,9 +44,9 @@ trait TrackCreationTrait
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
public function setCreatedAt(DateTimeInterface $datetime): self
|
||||
public function setCreatedAt(\DateTimeInterface $datetime): self
|
||||
{
|
||||
$this->createdAt = $datetime instanceof DateTime ? DateTimeImmutable::createFromMutable($datetime) : $datetime;
|
||||
$this->createdAt = $datetime instanceof \DateTime ? \DateTimeImmutable::createFromMutable($datetime) : $datetime;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@@ -12,11 +12,10 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Doctrine\Model;
|
||||
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use DateTimeInterface;
|
||||
|
||||
interface TrackUpdateInterface
|
||||
{
|
||||
public function setUpdatedAt(DateTimeInterface $datetime): self;
|
||||
public function setUpdatedAt(\DateTimeInterface $datetime): self;
|
||||
|
||||
public function setUpdatedBy(User $user): self;
|
||||
}
|
||||
|
@@ -13,8 +13,6 @@ namespace Chill\MainBundle\Doctrine\Model;
|
||||
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use DateTime;
|
||||
use DateTimeImmutable;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
|
||||
@@ -22,18 +20,21 @@ trait TrackUpdateTrait
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=true, options={"default": NULL})
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private ?DateTimeImmutable $updatedAt = null;
|
||||
private ?\DateTimeImmutable $updatedAt = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private ?User $updatedBy = null;
|
||||
|
||||
public function getUpdatedAt(): ?DateTimeInterface
|
||||
public function getUpdatedAt(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
@@ -43,9 +44,9 @@ trait TrackUpdateTrait
|
||||
return $this->updatedBy;
|
||||
}
|
||||
|
||||
public function setUpdatedAt(DateTimeInterface $datetime): self
|
||||
public function setUpdatedAt(\DateTimeInterface $datetime): self
|
||||
{
|
||||
$this->updatedAt = $datetime instanceof DateTime ? DateTimeImmutable::createFromMutable($datetime) : $datetime;
|
||||
$this->updatedAt = $datetime instanceof \DateTime ? \DateTimeImmutable::createFromMutable($datetime) : $datetime;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
Reference in New Issue
Block a user