apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -11,7 +11,6 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Service\DocGenerator;
use Chill\DocGeneratorBundle\Context\Exception\UnexpectedTypeException;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
use Chill\DocGeneratorBundle\Service\Context\BaseContextData;
use Chill\DocStoreBundle\Entity\DocumentCategory;
@@ -29,15 +28,12 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Chill\PersonBundle\Entity\Person\PersonResource;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Entity\Person\ResidentialAddress;
use Chill\PersonBundle\Repository\PersonRepository;
use Chill\PersonBundle\Repository\ResidentialAddressRepository;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
use Chill\ThirdPartyBundle\Repository\ThirdPartyRepository;
use DateTime;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use LogicException;
use Service\DocGenerator\PersonContextTest;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
@@ -46,10 +42,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use function array_key_exists;
use function count;
/**
* @see PersonContextTest
@@ -79,7 +72,7 @@ final class PersonContext implements PersonContextInterface
public function adminFormReverseTransform(array $data): array
{
if (array_key_exists('category', $data)) {
if (\array_key_exists('category', $data)) {
$data['category'] = [
'idInsideBundle' => $data['category']->getIdInsideBundle(),
'bundleId' => $data['category']->getBundleId(),
@@ -98,7 +91,7 @@ final class PersonContext implements PersonContextInterface
'thirdPartyLabel' => $data['thirdPartyLabel'] ?? $this->translator->trans('Third party'),
];
if (array_key_exists('category', $data)) {
if (\array_key_exists('category', $data)) {
$r['category'] = $this->documentCategoryRepository->find($data['category']);
}
@@ -197,7 +190,7 @@ final class PersonContext implements PersonContextInterface
if ($template->getOptions()['thirdParty']) {
$data['thirdParty'] = $this->normalizer->normalize($contextGenerationData['thirdParty'], 'docgen', [
'docgen:expects' => ThirdParty::class,
'groups' => 'docgen:read'
'groups' => 'docgen:read',
]);
}
@@ -285,12 +278,12 @@ final class PersonContext implements PersonContextInterface
->setTitle(
$contextGenerationData['title'] ?? $this->translatableStringHelper->localize($template->getName())
)
->setDate(new DateTime())
->setDate(new \DateTime())
->setDescription($this->translatableStringHelper->localize($template->getName()))
->setPerson($entity)
->setObject($storedObject);
if (array_key_exists('category', $template->getOptions())) {
if (\array_key_exists('category', $template->getOptions())) {
$doc
->setCategory(
$this->documentCategoryRepository->find(
@@ -309,8 +302,8 @@ final class PersonContext implements PersonContextInterface
$this->centerResolverManager->resolveCenters($entity)
);
if (1 !== count($scopes)) {
throw new LogicException('at this step, it should have only one scope');
if (1 !== \count($scopes)) {
throw new \LogicException('at this step, it should have only one scope');
}
$doc->setScope($scopes[0]);
@@ -321,7 +314,7 @@ final class PersonContext implements PersonContextInterface
private function isScopeNecessary(Person $person): bool
{
if ($this->showScopes && 1 < count(
if ($this->showScopes && 1 < \count(
$this->authorizationHelper->getReachableScopes(
$this->security->getUser(),
PersonDocumentVoter::CREATE,