apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -35,8 +35,8 @@ final readonly class ClosingMotiveRender implements ChillEntityRenderInterface
public function renderBox($entity, array $options): string
{
return
$this->getDefaultOpeningBox('closing-motive') .
$this->renderString($entity, $options) .
$this->getDefaultOpeningBox('closing-motive').
$this->renderString($entity, $options).
$this->getDefaultClosingBox();
}
@@ -60,7 +60,7 @@ final readonly class ClosingMotiveRender implements ChillEntityRenderInterface
if ($motive->hasParent()) {
if ('' !== $existing) {
$str = $str . self::SEPARATOR . $existing;
$str = $str.self::SEPARATOR.$existing;
}
$str = $this->renderStringRecursive(
@@ -71,11 +71,11 @@ final readonly class ClosingMotiveRender implements ChillEntityRenderInterface
}
if ('' !== $existing) {
$str = $str . self::SEPARATOR . $existing;
$str = $str.self::SEPARATOR.$existing;
}
if ($motive->isLeaf() && $motive->isCanceledAccompanyingPeriod()) {
$str = $str . ' ' . $this->translator->trans('( Canceled period )');
$str = $str.' '.$this->translator->trans('( Canceled period )');
}
return $str;

View File

@@ -11,16 +11,11 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Templating\Entity;
use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender;
use Chill\MainBundle\Templating\Entity\BoxUtilsChillEntityRenderTrait;
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
use Chill\PersonBundle\Entity\Person;
use Symfony\Component\Templating\EngineInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use function array_key_exists;
/**
* Render a Person.
*/
@@ -50,12 +45,12 @@ class PersonRender implements PersonRenderInterface
];
return
$this->getDefaultOpeningBox('person') .
$this->getDefaultOpeningBox('person').
$this->engine->render('@ChillPerson/Entity/person.html.twig', [
'person' => $person,
'render' => $options['render'] ?? 'raw',
'options' => $params,
]) .
]).
$this->getDefaultClosingBox();
}
@@ -63,19 +58,19 @@ class PersonRender implements PersonRenderInterface
{
$options = array_merge(['addAge' => true], $options);
if (null !== $person->getAge() && $person->getDeathDate() === null && $options['addAge']) {
return $person->getFirstName() . ' ' . $person->getLastName()
. $this->addAltNames($person, false) . ' (' . $this->translator->trans('years_old', ['age' => $person->getAge()]) . ')';
if (null !== $person->getAge() && null === $person->getDeathDate() && $options['addAge']) {
return $person->getFirstName().' '.$person->getLastName()
.$this->addAltNames($person, false).' ('.$this->translator->trans('years_old', ['age' => $person->getAge()]).')';
}
if (null !== $person->getDeathDate() && $options['addAge']) {
return $person->getFirstName() . ' ' . $person->getLastName()
. ' (‡)'
. $this->addAltNames($person, false);
return $person->getFirstName().' '.$person->getLastName()
.' (‡)'
.$this->addAltNames($person, false);
}
return $person->getFirstName() . ' ' . $person->getLastName()
. $this->addAltNames($person, false);
return $person->getFirstName().' '.$person->getLastName()
.$this->addAltNames($person, false);
}
public function supports($entity, array $options): bool
@@ -93,7 +88,7 @@ class PersonRender implements PersonRenderInterface
foreach ($person->getAltNames()->getIterator() as $altName) {
/** @var \Chill\PersonBundle\Entity\PersonAltName $altName */
if (array_key_exists($altName->getKey(), $altNames)) {
if (\array_key_exists($altName->getKey(), $altNames)) {
if ($isFirst) {
$str .= ' (';
$isFirst = false;
@@ -102,7 +97,7 @@ class PersonRender implements PersonRenderInterface
}
if ($addSpan) {
$str .= '<span class="altname altname-' . $altName->getKey() . '">';
$str .= '<span class="altname altname-'.$altName->getKey().'">';
}
$str .= $altName->getLabel();

View File

@@ -25,10 +25,10 @@ final readonly class ResourceKindRender implements ChillEntityRenderInterface
public function renderBox($entity, array $options): string
{
return
'<span class="resource">' .
'<span class="resource">'.
$this->translatableStringHelper->localize(
$entity->getTitle()
) .
).
'</span>';
}

View File

@@ -14,11 +14,7 @@ namespace Chill\PersonBundle\Templating\Entity;
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Symfony\Component\Templating\EngineInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use function array_merge;
use function array_reverse;
use function implode;
/**
* @implements ChillEntityRenderInterface<SocialAction>
@@ -51,7 +47,7 @@ class SocialActionRender implements ChillEntityRenderInterface
public function renderBox($socialAction, array $options): string
{
$options = array_merge(self::DEFAULT_ARGS, $options);
$options = \array_merge(self::DEFAULT_ARGS, $options);
// give some help to twig: an array of parents
$parents = $this->buildParents($socialAction);
@@ -65,7 +61,7 @@ class SocialActionRender implements ChillEntityRenderInterface
public function renderString($socialAction, array $options): string
{
/** @var SocialAction $socialAction */
$options = array_merge(self::DEFAULT_ARGS, $options);
$options = \array_merge(self::DEFAULT_ARGS, $options);
$titles = [$this->translatableStringHelper->localize($socialAction->getTitle())];
while ($socialAction->hasParent()) {
@@ -75,12 +71,12 @@ class SocialActionRender implements ChillEntityRenderInterface
);
}
$titles = array_reverse($titles);
$titles = \array_reverse($titles);
$title = implode($options[self::SEPARATOR_KEY], $titles);
$title = \implode($options[self::SEPARATOR_KEY], $titles);
if ($options[self::SHOW_AND_CHILDREN] && $socialAction->hasChildren()) {
$title .= ' (' . $this->translator->trans($options[self::AND_CHILDREN_MENTION]) . ')';
$title .= ' ('.$this->translator->trans($options[self::AND_CHILDREN_MENTION]).')';
}
return $title;

View File

@@ -14,10 +14,7 @@ namespace Chill\PersonBundle\Templating\Entity;
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
use Symfony\Component\Templating\EngineInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use function array_reverse;
use function implode;
/**
* @implements ChillEntityRenderInterface<SocialIssue>
@@ -75,12 +72,12 @@ final readonly class SocialIssueRender implements ChillEntityRenderInterface
);
}
$titles = array_reverse($titles);
$titles = \array_reverse($titles);
$title = implode($options[self::SEPARATOR_KEY], $titles);
$title = \implode($options[self::SEPARATOR_KEY], $titles);
if ($options[self::SHOW_AND_CHILDREN] && $socialIssue->hasChildren()) {
$title .= ' (' . $this->translator->trans($options[self::AND_CHILDREN_MENTION]) . ')';
$title .= ' ('.$this->translator->trans($options[self::AND_CHILDREN_MENTION]).')';
}
return $title;