mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-04 22:04:59 +00:00
DX: fix phstan & cs
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user