mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
DX: fix phpstan errors
This commit is contained in:
@@ -407,6 +407,7 @@ class LoadPeople extends AbstractFixture implements ContainerAwareInterface, Ord
|
||||
|
||||
private function createExpectedPerson($default): Person
|
||||
{
|
||||
/** @var Person $person */
|
||||
$person = $this->loader->loadData([
|
||||
Person::class => [
|
||||
'person' => [
|
||||
@@ -439,10 +440,15 @@ class LoadPeople extends AbstractFixture implements ContainerAwareInterface, Ord
|
||||
break;
|
||||
|
||||
case 'countryOfBirth':
|
||||
$country = $this->countryRepository
|
||||
->findOneBy(['countryCode' => $value]);
|
||||
$person->setCountryOfBirth($country);
|
||||
|
||||
break;
|
||||
case 'nationality':
|
||||
$country = $this->countryRepository
|
||||
->findOneBy(['countryCode' => $value]);
|
||||
$person->{'set' . ucfirst($key)}($country);
|
||||
$person->setNationality($country);
|
||||
|
||||
break;
|
||||
|
||||
@@ -484,42 +490,6 @@ class LoadPeople extends AbstractFixture implements ContainerAwareInterface, Ord
|
||||
return $this->getReference($ref);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a random address.
|
||||
*
|
||||
* @return Address
|
||||
*/
|
||||
private function getRandomAddress()
|
||||
{
|
||||
return (new Address())
|
||||
->setStreetAddress1($this->faker->streetAddress)
|
||||
->setStreetAddress2(
|
||||
mt_rand(0, 9) > 5 ? $this->faker->streetAddress : ''
|
||||
)
|
||||
->setPoint(
|
||||
mt_rand(0, 9) > 5 ? $this->getRandomPoint() : null
|
||||
)
|
||||
->setPostcode($this->getReference(
|
||||
LoadPostalCodes::$refs[array_rand(LoadPostalCodes::$refs)]
|
||||
))
|
||||
->setValidFrom($this->faker->dateTimeBetween('-5 years'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a random point.
|
||||
*
|
||||
* @return Point
|
||||
*/
|
||||
private function getRandomPoint()
|
||||
{
|
||||
$lonBrussels = 4.35243;
|
||||
$latBrussels = 50.84676;
|
||||
$lon = $lonBrussels + 0.01 * mt_rand(-5, 5);
|
||||
$lat = $latBrussels + 0.01 * mt_rand(-5, 5);
|
||||
|
||||
return Point::fromLonLat($lon, $lat);
|
||||
}
|
||||
|
||||
private function getRandomSocialIssue(): SocialIssue
|
||||
{
|
||||
if (0 === count($this->cacheSocialIssues)) {
|
||||
|
Reference in New Issue
Block a user