cs: Enable more risky rules.

This commit is contained in:
Pol Dellaiera
2021-11-30 11:37:57 +01:00
parent c8195e6df5
commit a9188355c5
193 changed files with 306 additions and 63 deletions

View File

@@ -19,6 +19,7 @@ use DateTimeImmutable;
use Doctrine\Persistence\ObjectManager;
use function array_pop;
use function array_rand;
use function count;
class LoadAccompanyingPeriodWork extends \Doctrine\Bundle\FixturesBundle\Fixture implements \Doctrine\Common\DataFixtures\DependentFixtureInterface
{

View File

@@ -40,6 +40,7 @@ use Nelmio\Alice\Loader\NativeLoader;
use Nelmio\Alice\ObjectSet;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\Workflow\Registry;
use function count;
use function random_int;
use function ucfirst;
@@ -273,7 +274,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
$this->cacheCenters = $this->centerRepository->findAll();
}
return $this->cacheCenters[\array_rand($this->cacheCenters)];
return $this->cacheCenters[array_rand($this->cacheCenters)];
}
/**
@@ -291,7 +292,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
return null;
}
return $this->cacheCountries[\array_rand($this->cacheCountries)];
return $this->cacheCountries[array_rand($this->cacheCountries)];
}
/**
@@ -475,7 +476,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
private function getPostalCode(): PostalCode
{
$ref = LoadPostalCodes::$refs[\array_rand(LoadPostalCodes::$refs)];
$ref = LoadPostalCodes::$refs[array_rand(LoadPostalCodes::$refs)];
return $this->getReference($ref);
}
@@ -522,7 +523,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
$this->cacheSocialIssues = $this->socialIssueRepository->findAll();
}
return $this->cacheSocialIssues[\array_rand($this->cacheSocialIssues)];
return $this->cacheSocialIssues[array_rand($this->cacheSocialIssues)];
}
private function getRandomUser(): User
@@ -531,7 +532,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
$this->cacheUsers = $this->userRepository->findAll();
}
return $this->cacheUsers[\array_rand($this->cacheUsers)];
return $this->cacheUsers[array_rand($this->cacheUsers)];
}
/*

View File

@@ -20,6 +20,7 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ObjectManager;
use function count;
class LoadRelationships extends Fixture implements DependentFixtureInterface
{
@@ -49,7 +50,7 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface
->setFromPerson($this->getRandomPerson($this->em))
->setToPerson($this->getRandomPerson($this->em))
->setRelation($this->getReference(LoadRelations::RELATION_KEY .
\random_int(0, count(LoadRelations::RELATIONS) - 1)))
random_int(0, count(LoadRelations::RELATIONS) - 1)))
->setReverse((bool) random_int(0, 1))
->setCreatedBy($user)
->setUpdatedBy($user)