mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-27 00:55:01 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -14,8 +14,6 @@ namespace Chill\BudgetBundle\Entity;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use DateTime;
|
||||
use DateTimeImmutable;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Ramsey\Uuid\Type\Decimal;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
@@ -29,9 +27,11 @@ abstract class AbstractElement
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="amount", type="decimal", precision=10, scale=2)
|
||||
*
|
||||
* @Assert\GreaterThan(
|
||||
* value=0
|
||||
* )
|
||||
*
|
||||
* @Assert\NotNull(
|
||||
* message="The amount cannot be empty"
|
||||
* )
|
||||
@@ -45,12 +45,13 @@ abstract class AbstractElement
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="endDate", type="datetime_immutable", nullable=true)
|
||||
*
|
||||
* @Assert\GreaterThan(
|
||||
* propertyPath="startDate",
|
||||
* message="The budget element's end date must be after the start date"
|
||||
* )
|
||||
*/
|
||||
private ?DateTimeImmutable $endDate = null;
|
||||
private ?\DateTimeImmutable $endDate = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(
|
||||
@@ -68,16 +69,17 @@ abstract class AbstractElement
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="startDate", type="datetime_immutable")
|
||||
*
|
||||
* @Assert\Date
|
||||
*/
|
||||
private DateTimeImmutable $startDate;
|
||||
private \DateTimeImmutable $startDate;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="type", type="string", length=255)
|
||||
*/
|
||||
private string $type = '';
|
||||
|
||||
/*Getters and Setters */
|
||||
/* Getters and Setters */
|
||||
|
||||
public function getAmount(): float
|
||||
{
|
||||
@@ -89,7 +91,7 @@ abstract class AbstractElement
|
||||
return $this->comment;
|
||||
}
|
||||
|
||||
public function getEndDate(): ?DateTimeImmutable
|
||||
public function getEndDate(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->endDate;
|
||||
}
|
||||
@@ -104,7 +106,7 @@ abstract class AbstractElement
|
||||
return $this->person;
|
||||
}
|
||||
|
||||
public function getStartDate(): DateTimeImmutable
|
||||
public function getStartDate(): \DateTimeImmutable
|
||||
{
|
||||
return $this->startDate;
|
||||
}
|
||||
@@ -130,17 +132,17 @@ abstract class AbstractElement
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setComment(?string $comment = null): self
|
||||
public function setComment(string $comment = null): self
|
||||
{
|
||||
$this->comment = $comment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setEndDate(?DateTimeInterface $endDate = null): self
|
||||
public function setEndDate(\DateTimeInterface $endDate = null): self
|
||||
{
|
||||
if ($endDate instanceof DateTime) {
|
||||
$this->endDate = DateTimeImmutable::createFromMutable($endDate);
|
||||
if ($endDate instanceof \DateTime) {
|
||||
$this->endDate = \DateTimeImmutable::createFromMutable($endDate);
|
||||
} elseif (null === $endDate) {
|
||||
$this->endDate = null;
|
||||
} else {
|
||||
@@ -164,10 +166,10 @@ abstract class AbstractElement
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setStartDate(DateTimeInterface $startDate): self
|
||||
public function setStartDate(\DateTimeInterface $startDate): self
|
||||
{
|
||||
if ($startDate instanceof DateTime) {
|
||||
$this->startDate = DateTimeImmutable::createFromMutable($startDate);
|
||||
if ($startDate instanceof \DateTime) {
|
||||
$this->startDate = \DateTimeImmutable::createFromMutable($startDate);
|
||||
} elseif (null === $startDate) {
|
||||
$this->startDate = null;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user