DX: fix phstan & cs

This commit is contained in:
2023-03-05 17:43:44 +01:00
parent 4dbb195b45
commit 8695099819
25 changed files with 119 additions and 349 deletions

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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
{

View File

@@ -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;

View File

@@ -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';

View File

@@ -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 */