mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 19:13:49 +00:00
DX: apply rector rules up to php8.0
This commit is contained in:
@@ -74,7 +74,7 @@ use function in_array;
|
||||
* groups={"household_memberships"}
|
||||
* )
|
||||
*/
|
||||
class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateInterface
|
||||
class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateInterface, \Stringable
|
||||
{
|
||||
public const BOTH_GENDER = 'both';
|
||||
|
||||
@@ -554,7 +554,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->getLabel();
|
||||
}
|
||||
@@ -631,7 +631,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
* @return true | array True if the accompanying periods are not collapsing,
|
||||
* an array with data for displaying the error
|
||||
*/
|
||||
public function checkAccompanyingPeriodsAreNotCollapsing()
|
||||
public function checkAccompanyingPeriodsAreNotCollapsing(): bool|array
|
||||
{
|
||||
$periods = $this->getAccompanyingPeriodsOrdered();
|
||||
$periodsNbr = count($periods);
|
||||
@@ -1165,19 +1165,12 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
*/
|
||||
public function getGenderNumeric()
|
||||
{
|
||||
switch ($this->getGender()) {
|
||||
case self::FEMALE_GENDER:
|
||||
return 1;
|
||||
|
||||
case self::MALE_GENDER:
|
||||
return 0;
|
||||
|
||||
case self::BOTH_GENDER:
|
||||
return 2;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
return match ($this->getGender()) {
|
||||
self::FEMALE_GENDER => 1,
|
||||
self::MALE_GENDER => 0,
|
||||
self::BOTH_GENDER => 2,
|
||||
default => -1,
|
||||
};
|
||||
}
|
||||
|
||||
public function getHouseholdAddresses(): Collection
|
||||
@@ -1360,7 +1353,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
/**
|
||||
* @return PersonResource[]|Collection
|
||||
*/
|
||||
public function getResources()
|
||||
public function getResources(): array|\Doctrine\Common\Collections\Collection
|
||||
{
|
||||
return $this->resources;
|
||||
}
|
||||
@@ -1606,9 +1599,6 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Person
|
||||
*/
|
||||
public function setCFData(?array $cFData): self
|
||||
{
|
||||
$this->cFData = $cFData;
|
||||
@@ -1824,16 +1814,11 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
|
||||
$histories = $this->centerHistory->matching($criteria);
|
||||
|
||||
switch ($histories->count()) {
|
||||
case 0:
|
||||
return null;
|
||||
|
||||
case 1:
|
||||
return $histories->first();
|
||||
|
||||
default:
|
||||
throw new UnexpectedValueException('It should not contains more than one center at a time');
|
||||
}
|
||||
return match ($histories->count()) {
|
||||
0 => null,
|
||||
1 => $histories->first(),
|
||||
default => throw new UnexpectedValueException('It should not contains more than one center at a time'),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user