mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-30 02:25:00 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -21,8 +21,6 @@ use Symfony\Component\Validator\ConstraintValidator;
|
||||
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
||||
use Symfony\Component\Validator\Exception\UnexpectedValueException;
|
||||
|
||||
use function in_array;
|
||||
|
||||
class AccompanyingPeriodValidityValidator extends ConstraintValidator
|
||||
{
|
||||
public function __construct(private readonly ActivityRepository $activityRepository, private readonly SocialIssueRender $socialIssueRender, private readonly TokenStorageInterface $token) {}
|
||||
@@ -70,7 +68,7 @@ class AccompanyingPeriodValidityValidator extends ConstraintValidator
|
||||
}
|
||||
|
||||
foreach ($socialIssuesByKey as $key => $si) {
|
||||
if (!in_array($key, $periodIssuesWithAncestors, true)) {
|
||||
if (!\in_array($key, $periodIssuesWithAncestors, true)) {
|
||||
$this->context
|
||||
->buildViolation(
|
||||
$constraint->messageSocialIssueCannotBeDeleted
|
||||
|
@@ -32,7 +32,7 @@ class LocationValidityValidator extends ConstraintValidator
|
||||
throw new UnexpectedValueException($period, AccompanyingPeriod::class);
|
||||
}
|
||||
|
||||
if ($period->getLocationStatus() === 'person') {
|
||||
if ('person' === $period->getLocationStatus()) {
|
||||
if (
|
||||
null === $period->getOpenParticipationContainsPerson(
|
||||
$period->getPersonLocation()
|
||||
@@ -48,8 +48,8 @@ class LocationValidityValidator extends ConstraintValidator
|
||||
}
|
||||
|
||||
if (
|
||||
$period->getStep() !== AccompanyingPeriod::STEP_DRAFT
|
||||
&& $period->getLocationStatus() === 'none'
|
||||
AccompanyingPeriod::STEP_DRAFT !== $period->getStep()
|
||||
&& 'none' === $period->getLocationStatus()
|
||||
) {
|
||||
$this->context
|
||||
->buildViolation(
|
||||
|
@@ -20,8 +20,6 @@ use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
||||
|
||||
use function count;
|
||||
|
||||
class ParticipationOverlapValidator extends ConstraintValidator
|
||||
{
|
||||
private const MAX_PARTICIPATION = 1;
|
||||
@@ -38,11 +36,11 @@ class ParticipationOverlapValidator extends ConstraintValidator
|
||||
throw new UnexpectedTypeException($participations, 'This should be a collection');
|
||||
}
|
||||
|
||||
if (count($participations) <= self::MAX_PARTICIPATION) {
|
||||
if (\count($participations) <= self::MAX_PARTICIPATION) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (0 === count($participations)) {
|
||||
if (0 === \count($participations)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -59,7 +57,7 @@ class ParticipationOverlapValidator extends ConstraintValidator
|
||||
}
|
||||
|
||||
foreach ($participationList as $group) {
|
||||
if (count($group) > 1) {
|
||||
if (\count($group) > 1) {
|
||||
$overlaps = new DateRangeCovering(self::MAX_PARTICIPATION, $participations[0]->getStartDate()->getTimezone());
|
||||
|
||||
foreach ($group as $p) {
|
||||
|
@@ -19,9 +19,6 @@ use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
|
||||
use function count;
|
||||
use function in_array;
|
||||
|
||||
class ResourceDuplicateCheckValidator extends ConstraintValidator
|
||||
{
|
||||
public function __construct(private readonly PersonRenderInterface $personRender, private readonly ThirdPartyRender $thirdpartyRender) {}
|
||||
@@ -36,7 +33,7 @@ class ResourceDuplicateCheckValidator extends ConstraintValidator
|
||||
throw new UnexpectedTypeException($resources, Collection::class);
|
||||
}
|
||||
|
||||
if (0 === count($resources)) {
|
||||
if (0 === \count($resources)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -44,9 +41,9 @@ class ResourceDuplicateCheckValidator extends ConstraintValidator
|
||||
|
||||
foreach ($resources as $resource) {
|
||||
$id = ($resource->getResource() instanceof Person ? 'p' :
|
||||
't') . $resource->getResource()->getId();
|
||||
't').$resource->getResource()->getId();
|
||||
|
||||
if (in_array($id, $resourceList, true)) {
|
||||
if (\in_array($id, $resourceList, true)) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ name }}', $resource->getResource() instanceof Person ? $this->personRender->renderString($resource->getResource(), []) :
|
||||
$this->thirdpartyRender->renderString($resource->getResource(), []))
|
||||
|
Reference in New Issue
Block a user