cs: Fix code style (safe rules only).

This commit is contained in:
Pol Dellaiera
2021-11-23 14:06:38 +01:00
parent 149d7ce991
commit 8f96a1121d
1223 changed files with 65199 additions and 64625 deletions

View File

@@ -1,12 +1,17 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Validator\Constraints\Household;
use Chill\MainBundle\Util\DateRangeCovering;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Exception\UnexpectedValueException;
class MaxHolderValidator extends ConstraintValidator
{
@@ -20,8 +25,10 @@ class MaxHolderValidator extends ConstraintValidator
return;
}
$covers = new DateRangeCovering(self::MAX_HOLDERS,
$holders[0]->getStartDate()->getTimezone());
$covers = new DateRangeCovering(
self::MAX_HOLDERS,
$holders[0]->getStartDate()->getTimezone()
);
foreach ($holders as $key => $member) {
$covers->add($member->getStartDate(), $member->getEndDate(), $key);
@@ -30,18 +37,17 @@ class MaxHolderValidator extends ConstraintValidator
$covers->compute();
if ($covers->hasIntersections()) {
foreach ($covers->getIntersections() as list($start, $end, $ids)) {
$msg = $end === null ? $constraint->messageInfinity :
foreach ($covers->getIntersections() as [$start, $end, $ids]) {
$msg = null === $end ? $constraint->messageInfinity :
$constraint->message;
$this->context->buildViolation($msg)
->setParameters([
'{{ start }}' => $start->format('d-m-Y'), // TODO fix when MessageParameter works with timezone
'{{ end }}' => $end === null ? null : $end->format('d-m-Y')
'{{ end }}' => null === $end ? null : $end->format('d-m-Y'),
])
->addViolation();
}
}
}
}