php style fixer

This commit is contained in:
2024-02-12 14:37:54 +01:00
parent 1b96deb4ee
commit addc623add
6 changed files with 35 additions and 22 deletions

View File

@@ -35,14 +35,15 @@ class UserRender implements ChillEntityRenderInterface
public function __construct(
private readonly TranslatableStringHelper $translatableStringHelper,
private readonly \Twig\Environment $engine, private readonly TranslatorInterface $translator,
private readonly \Twig\Environment $engine,
private readonly TranslatorInterface $translator,
private readonly ClockInterface $clock,
) {}
) {
}
/**
* @param $entity
* @param array{main_scope?: bool, user_job?: bool, absence?: bool, at_date?: null|DateTimeImmutable|DateTime} $options
* @return string
* @param array{main_scope?: bool, user_job?: bool, absence?: bool, at_date?: DateTimeImmutable|\DateTime|null} $options
*
* @throws LoaderError
* @throws RuntimeError
* @throws SyntaxError
@@ -53,7 +54,7 @@ class UserRender implements ChillEntityRenderInterface
if (null === $opts['at_date']) {
$opts['at_date'] = $this->clock->now();
} elseif ($opts['at_date'] instanceof DateTime) {
} elseif ($opts['at_date'] instanceof \DateTime) {
$opts['at_date'] = DateTimeImmutable::createFromMutable($opts['at_date']);
}
@@ -64,19 +65,17 @@ class UserRender implements ChillEntityRenderInterface
}
/**
* @param $entity
* @param array{main_scope?: bool, user_job?: bool, absence?: bool, at_date?: null|DateTimeImmutable|DateTimeMutable} $options
* @return string
* @param array{main_scope?: bool, user_job?: bool, absence?: bool, at_date?: DateTimeImmutable|DateTimeMutable|null} $options
*/
public function renderString($entity, array $options): string
{
$opts = \array_merge(self::DEFAULT_OPTIONS, $options);
// $immutableAtDate = $opts['at_date'] instanceOf DateTime ? DateTimeImmutable::createFromMutable($opts['at_date']) : $opts['at_date'];
// $immutableAtDate = $opts['at_date'] instanceOf DateTime ? DateTimeImmutable::createFromMutable($opts['at_date']) : $opts['at_date'];
if (null === $opts['at_date']) {
$opts['at_date'] = $this->clock->now();
} elseif ($opts['at_date'] instanceof DateTime) {
} elseif ($opts['at_date'] instanceof \DateTime) {
$opts['at_date'] = DateTimeImmutable::createFromMutable($opts['at_date']);
}