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

@@ -13,33 +13,32 @@ namespace Chill\MainBundle\Templating\Entity;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Chill\MainBundle\Repository\UserRepository;
use Chill\MainBundle\Repository\UserRepositoryInterface;
use Symfony\Component\Templating\EngineInterface;
use function array_merge;
class CommentRender extends AbstractChillEntityRender
/**
* @implements ChillEntityRenderInterface<CommentEmbeddable>
*/
class CommentRender implements ChillEntityRenderInterface
{
use BoxUtilsChillEntityRenderTrait;
/**
* @var EngineInterface
*/
private $engine;
/**
* @var \Chill\MainBundle\Repository\UserRepository
*/
private $userRepository;
private UserRepositoryInterface $userRepository;
public function __construct(
UserRepository $userRepository,
UserRepositoryInterface $userRepository,
EngineInterface $engine
) {
$this->userRepository = $userRepository;
$this->engine = $engine;
}
/**
* @param CommentEmbeddable $entity
*/
public function renderBox($entity, array $options): string
{
// default options
@@ -50,7 +49,7 @@ class CommentRender extends AbstractChillEntityRender
'metadata' => true,
], $options);
if ($entity->getUserId()) {
if (null !== $entity->getUserId()) {
$user = $this->userRepository->find($entity->getUserId());
}
@@ -67,9 +66,6 @@ class CommentRender extends AbstractChillEntityRender
);
}
/**
* @param CommentEmbeddable $entity
*/
public function renderString($entity, array $options): string
{
return $entity->getComment();