mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
DX: fix phstan & cs
This commit is contained in:
@@ -12,14 +12,19 @@ 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\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
|
||||
|
||||
/**
|
||||
* Render closing motive.
|
||||
*
|
||||
* @implements ChillEntityRenderInterface<ClosingMotive>
|
||||
*/
|
||||
class ClosingMotiveRender extends AbstractChillEntityRender
|
||||
class ClosingMotiveRender implements ChillEntityRenderInterface
|
||||
{
|
||||
use BoxUtilsChillEntityRenderTrait;
|
||||
private const SEPARATOR = ' > ';
|
||||
|
||||
/**
|
||||
@@ -40,9 +45,6 @@ class ClosingMotiveRender extends AbstractChillEntityRender
|
||||
$this->getDefaultClosingBox();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ClosingMotive $entity
|
||||
*/
|
||||
public function renderString($entity, array $options): string
|
||||
{
|
||||
return $this->renderStringRecursive(
|
||||
@@ -57,12 +59,12 @@ class ClosingMotiveRender extends AbstractChillEntityRender
|
||||
return $entity instanceof ClosingMotive;
|
||||
}
|
||||
|
||||
protected function renderStringRecursive(ClosingMotive $motive, $existing, array $options)
|
||||
private function renderStringRecursive(ClosingMotive $motive, string $existing, array $options)
|
||||
{
|
||||
$newExisting = $this->translatableStringHelper->localize($motive->getName());
|
||||
|
||||
if ($motive->hasParent()) {
|
||||
if (!empty($existing)) {
|
||||
if ('' !== $existing) {
|
||||
$newExisting = $newExisting . self::SEPARATOR . $existing;
|
||||
}
|
||||
|
||||
@@ -73,7 +75,7 @@ class ClosingMotiveRender extends AbstractChillEntityRender
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($existing)) {
|
||||
if ('' !== $existing) {
|
||||
return $newExisting . self::SEPARATOR . $existing;
|
||||
}
|
||||
|
||||
|
@@ -12,6 +12,8 @@ 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;
|
||||
@@ -22,8 +24,9 @@ use function array_key_exists;
|
||||
/**
|
||||
* Render a Person.
|
||||
*/
|
||||
class PersonRender extends AbstractChillEntityRender implements PersonRenderInterface
|
||||
class PersonRender implements PersonRenderInterface
|
||||
{
|
||||
use BoxUtilsChillEntityRenderTrait;
|
||||
private ConfigPersonAltNamesHelper $configAltNamesHelper;
|
||||
|
||||
private EngineInterface $engine;
|
||||
@@ -40,9 +43,6 @@ class PersonRender extends AbstractChillEntityRender implements PersonRenderInte
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Person $person
|
||||
*/
|
||||
public function renderBox($person, array $options): string
|
||||
{
|
||||
$params = [
|
||||
@@ -72,9 +72,6 @@ class PersonRender extends AbstractChillEntityRender implements PersonRenderInte
|
||||
$this->getDefaultClosingBox();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Person $person
|
||||
*/
|
||||
public function renderString($person, array $options): string
|
||||
{
|
||||
$options = array_merge(['addAge' => true], $options);
|
||||
|
@@ -12,9 +12,12 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Templating\Entity;
|
||||
|
||||
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
|
||||
/**
|
||||
* Render a Person.
|
||||
*
|
||||
* @extends ChillEntityRenderInterface<Person>
|
||||
*/
|
||||
interface PersonRenderInterface extends ChillEntityRenderInterface
|
||||
{
|
||||
|
@@ -15,6 +15,9 @@ use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\PersonBundle\Entity\Person\PersonResourceKind;
|
||||
|
||||
/**
|
||||
* @implements ChillEntityRenderInterface<PersonResourceKind>
|
||||
*/
|
||||
final class ResourceKindRender implements ChillEntityRenderInterface
|
||||
{
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
@@ -20,6 +20,9 @@ use function array_merge;
|
||||
use function array_reverse;
|
||||
use function implode;
|
||||
|
||||
/**
|
||||
* @implements ChillEntityRenderInterface<SocialAction>
|
||||
*/
|
||||
class SocialActionRender implements ChillEntityRenderInterface
|
||||
{
|
||||
public const AND_CHILDREN_MENTION = 'show_and_children_mention';
|
||||
|
@@ -19,6 +19,9 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use function array_reverse;
|
||||
use function implode;
|
||||
|
||||
/**
|
||||
* @implements ChillEntityRenderInterface<SocialIssue>
|
||||
*/
|
||||
final class SocialIssueRender implements ChillEntityRenderInterface
|
||||
{
|
||||
public const AND_CHILDREN_MENTION = 'show_and_children_mention';
|
||||
@@ -53,9 +56,6 @@ final class SocialIssueRender implements ChillEntityRenderInterface
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SocialIssue $socialIssue
|
||||
*/
|
||||
public function renderBox($socialIssue, array $options): string
|
||||
{
|
||||
$options = array_merge(self::DEFAULT_ARGS, $options);
|
||||
@@ -74,9 +74,6 @@ final class SocialIssueRender implements ChillEntityRenderInterface
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SocialIssue $socialIssue
|
||||
*/
|
||||
public function renderString($socialIssue, array $options): string
|
||||
{
|
||||
/** @var SocialIssue $socialIssue */
|
||||
|
Reference in New Issue
Block a user