fix phpstan errors on ThirdPartyRender

This commit is contained in:
Julien Fastré 2022-03-30 21:52:43 +02:00
parent ae10a8bd1c
commit 63cdc97c47
3 changed files with 6 additions and 7 deletions

View File

@ -460,8 +460,3 @@ parameters:
count: 1 count: 1
path: src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php path: src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php

View File

@ -29,8 +29,12 @@ use Symfony\Contracts\Translation\TranslatorInterface;
final class PersonResourceType extends AbstractType final class PersonResourceType extends AbstractType
{ {
private PersonRenderInterface $personRender;
private ResourceKindRender $resourceKindRender; private ResourceKindRender $resourceKindRender;
private ThirdPartyRender $thirdPartyRender;
private TranslatorInterface $translator; private TranslatorInterface $translator;
public function __construct(ResourceKindRender $resourceKindRender, PersonRenderInterface $personRender, ThirdPartyRender $thirdPartyRender, TranslatorInterface $translator) public function __construct(ResourceKindRender $resourceKindRender, PersonRenderInterface $personRender, ThirdPartyRender $thirdPartyRender, TranslatorInterface $translator)

View File

@ -71,13 +71,13 @@ class ThirdPartyRender extends AbstractChillEntityRender
$civility = ''; $civility = '';
} }
if (!empty($entity->getAcronym())) { if ('' !== (string) $entity->getAcronym()) {
$acronym = ' (' . $entity->getAcronym() . ')'; $acronym = ' (' . $entity->getAcronym() . ')';
} else { } else {
$acronym = ''; $acronym = '';
} }
$firstname = empty($entity->getFirstname()) ? '' : $entity->getFirstname(); $firstname = ('' === $entity->getFirstname()) ? '' : $entity->getFirstname();
return $civility . $firstname . ' ' . $entity->getName() . $acronym; return $civility . $firstname . ' ' . $entity->getName() . $acronym;
} }