mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
DX: rector rules upt to PHP 74
This commit is contained in:
@@ -828,9 +828,7 @@ class AccompanyingPeriod implements
|
||||
$collection = $this
|
||||
->getParticipationsContainsPerson($person)
|
||||
->filter(
|
||||
static function (AccompanyingPeriodParticipation $participation): bool {
|
||||
return null === $participation->getEndDate();
|
||||
}
|
||||
static fn(AccompanyingPeriodParticipation $participation): bool => null === $participation->getEndDate()
|
||||
);
|
||||
|
||||
return $collection->count() > 0 ? $collection->first() : null;
|
||||
@@ -844,9 +842,7 @@ class AccompanyingPeriod implements
|
||||
return $this
|
||||
->getParticipations()
|
||||
->filter(
|
||||
static function (AccompanyingPeriodParticipation $participation): bool {
|
||||
return null === $participation->getEndDate();
|
||||
}
|
||||
static fn(AccompanyingPeriodParticipation $participation): bool => null === $participation->getEndDate()
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -44,20 +44,20 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface
|
||||
* @Assert\NotBlank
|
||||
* @Assert\NotNull
|
||||
*/
|
||||
private ?string $content;
|
||||
private ?string $content = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime")
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private ?DateTimeInterface $createdAt;
|
||||
private ?DateTimeInterface $createdAt = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private ?User $creator;
|
||||
private ?User $creator = null;
|
||||
|
||||
/**
|
||||
* @ORM\Id
|
||||
@@ -65,20 +65,20 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface
|
||||
* @ORM\Column(type="integer")
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private ?int $id;
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime")
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
private ?DateTimeInterface $updatedAt;
|
||||
private ?DateTimeInterface $updatedAt = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
private ?User $updatedBy;
|
||||
private ?User $updatedBy = null;
|
||||
|
||||
public function getAccompanyingPeriod(): ?AccompanyingPeriod
|
||||
{
|
||||
|
@@ -200,13 +200,11 @@ class Household
|
||||
*/
|
||||
public function getCurrentAddress(?DateTime $at = null): ?Address
|
||||
{
|
||||
$at = $at ?? new DateTime('today');
|
||||
$at ??= new DateTime('today');
|
||||
|
||||
$addrs = $this->getAddresses()->filter(static function (Address $a) use ($at) {
|
||||
return $a->getValidFrom() <= $at && (
|
||||
null === $a->getValidTo() || $a->getValidTo() > $at
|
||||
);
|
||||
});
|
||||
$addrs = $this->getAddresses()->filter(static fn(Address $a) => $a->getValidFrom() <= $at && (
|
||||
null === $a->getValidTo() || $a->getValidTo() > $at
|
||||
));
|
||||
|
||||
if ($addrs->count() > 0) {
|
||||
return $addrs->first();
|
||||
@@ -338,9 +336,7 @@ class Household
|
||||
public function getCurrentPersons(?DateTimeImmutable $now = null): ReadableCollection
|
||||
{
|
||||
return $this->getCurrentMembers($now)
|
||||
->map(static function (HouseholdMember $m) {
|
||||
return $m->getPerson();
|
||||
});
|
||||
->map(static fn(HouseholdMember $m) => $m->getPerson());
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
@@ -367,9 +363,7 @@ class Household
|
||||
$membership->getStartDate(),
|
||||
$membership->getEndDate()
|
||||
)->filter(
|
||||
static function (HouseholdMember $m) use ($membership) {
|
||||
return $m->getPerson() !== $membership->getPerson();
|
||||
}
|
||||
static fn(HouseholdMember $m) => $m->getPerson() !== $membership->getPerson()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -508,9 +502,7 @@ class Household
|
||||
|
||||
usort(
|
||||
$compositionOrdered,
|
||||
static function (HouseholdComposition $a, HouseholdComposition $b) {
|
||||
return $a->getStartDate() <=> $b->getStartDate();
|
||||
}
|
||||
static fn(HouseholdComposition $a, HouseholdComposition $b) => $a->getStartDate() <=> $b->getStartDate()
|
||||
);
|
||||
|
||||
$iterator = new ArrayIterator($compositionOrdered);
|
||||
|
@@ -142,7 +142,7 @@ class HouseholdMember
|
||||
|
||||
public function isCurrent(?DateTimeImmutable $at = null): bool
|
||||
{
|
||||
$at = $at ?? new DateTimeImmutable('now');
|
||||
$at ??= new DateTimeImmutable('now');
|
||||
|
||||
return $this->getStartDate() < $at && (
|
||||
null === $this->getEndDate() || $this->getEndDate() > $at
|
||||
|
@@ -775,9 +775,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
): int {
|
||||
// TODO should be optimized to avoid loading accompanying period ?
|
||||
return $this->getAccompanyingPeriodInvolved($asParticipantOpen, $asRequestor)
|
||||
->filter(function (AccompanyingPeriod $p) {
|
||||
return $p->getStep() !== AccompanyingPeriod::STEP_DRAFT;
|
||||
})
|
||||
->filter(fn(AccompanyingPeriod $p) => $p->getStep() !== AccompanyingPeriod::STEP_DRAFT)
|
||||
->count();
|
||||
}
|
||||
|
||||
@@ -1341,9 +1339,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
|
||||
return $this->getAccompanyingPeriodParticipations()
|
||||
->matching($criteria)
|
||||
->filter(static function (AccompanyingPeriodParticipation $app) {
|
||||
return AccompanyingPeriod::STEP_CLOSED !== $app->getAccompanyingPeriod()->getStep();
|
||||
});
|
||||
->filter(static fn(AccompanyingPeriodParticipation $app) => AccompanyingPeriod::STEP_CLOSED !== $app->getAccompanyingPeriod()->getStep());
|
||||
}
|
||||
|
||||
public function getOtherPhoneNumbers(): Collection
|
||||
|
@@ -50,7 +50,7 @@ class PersonCurrentAddress
|
||||
/**
|
||||
* @ORM\Column(name="valid_to", type="date_immutable")
|
||||
*/
|
||||
protected ?DateTimeImmutable $validTo;
|
||||
protected ?DateTimeImmutable $validTo = null;
|
||||
|
||||
public function getAddress(): Address
|
||||
{
|
||||
|
@@ -55,7 +55,7 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
|
||||
* @ORM\Column(type="integer")
|
||||
* @Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private ?int $id;
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=PersonResourceKind::class, inversedBy="personResources")
|
||||
|
@@ -41,7 +41,7 @@ class PersonPhone
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private ?int $id;
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(
|
||||
@@ -59,7 +59,7 @@ class PersonPhone
|
||||
/**
|
||||
* @ORM\Column(type="text", length=40, nullable=true)
|
||||
*/
|
||||
private ?string $type;
|
||||
private ?string $type = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
@@ -45,7 +45,7 @@ class Result
|
||||
/**
|
||||
* @ORM\Column(type="datetime", nullable=true)
|
||||
*/
|
||||
private ?DateTime $desactivationDate;
|
||||
private ?DateTime $desactivationDate = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity=Goal::class, mappedBy="results")
|
||||
|
Reference in New Issue
Block a user