DX: apply rector rules up to php8.0

This commit is contained in:
2023-04-15 01:05:37 +02:00
parent d8870e906f
commit dde3002100
714 changed files with 2348 additions and 9263 deletions

View File

@@ -32,31 +32,16 @@ use function array_merge;
final class ThirdPartyController extends CRUDController
{
protected AuthorizationHelper $authorizationHelper;
protected PaginatorFactory $paginatorFactory;
protected RequestStack $requestStack;
protected ThirdPartyACLAwareRepositoryInterface $thirdPartyACLAwareRepository;
protected TranslatorInterface $translator;
private bool $askCenter;
public function __construct(
AuthorizationHelper $authorizationHelper,
TranslatorInterface $translator,
PaginatorFactory $paginatorFactory,
RequestStack $requestStack,
ThirdPartyACLAwareRepositoryInterface $thirdPartyACLAwareRepository,
protected AuthorizationHelper $authorizationHelper,
protected TranslatorInterface $translator,
protected PaginatorFactory $paginatorFactory,
protected RequestStack $requestStack,
protected ThirdPartyACLAwareRepositoryInterface $thirdPartyACLAwareRepository,
ParameterBagInterface $parameterBag
) {
$this->authorizationHelper = $authorizationHelper;
$this->translator = $translator;
$this->paginatorFactory = $paginatorFactory;
$this->requestStack = $requestStack;
$this->thirdPartyACLAwareRepository = $thirdPartyACLAwareRepository;
$this->askCenter = $parameterBag->get('chill_main')['acl']['form_show_centers'];
}

View File

@@ -88,7 +88,7 @@ use function spl_object_hash;
* "thirdparty": ThirdParty::class
* })
*/
class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Stringable
{
public const KIND_CHILD = 'child';
@@ -293,7 +293,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
/**
* @return string
*/
public function __toString()
public function __toString(): string
{
return $this->getName();
}
@@ -437,10 +437,8 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
/**
* Get comment.
*
* @return string|null
*/
public function getComment()
public function getComment(): ?string
{
return $this->comment;
}
@@ -488,9 +486,6 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
return $this->parent;
}
/**
* @return string
*/
public function getProfession(): string
{
return $this->profession;
@@ -506,10 +501,8 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
/**
* Get type.
*
* @return array|null
*/
public function getThirdPartyTypes()
public function getThirdPartyTypes(): ?array
{
return $this->thirdPartyTypes ?? [];
}
@@ -649,8 +642,6 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
/**
* @param string $acronym
*
* @return $this
*/
public function setAcronym(?string $acronym = null): ThirdParty
{
@@ -701,9 +692,6 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
return $this;
}
/**
* @return $this
*/
public function setCivility(?Civility $civility): ThirdParty
{
$this->civility = $civility;
@@ -714,11 +702,10 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
/**
* Set comment.
*
* @param string|null $comment
*
* @return ThirdParty
*/
public function setComment($comment = null)
public function setComment(?string $comment = null)
{
$this->comment = $comment;
@@ -754,11 +741,10 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
/**
* Set email.
*
* @param string|null $email
*
* @return ThirdParty
*/
public function setEmail($email = null)
public function setEmail(?string $email = null)
{
$this->email = trim((string) $email);
@@ -796,9 +782,6 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
return $this;
}
/**
* @return $this
*/
public function setParent(?ThirdParty $parent): ThirdParty
{
$this->parent = $parent;

View File

@@ -18,14 +18,8 @@ use const SORT_NUMERIC;
class LabelThirdPartyHelper
{
private ThirdPartyRender $thirdPartyRender;
private ThirdPartyRepository $thirdPartyRepository;
public function __construct(ThirdPartyRender $thirdPartyRender, ThirdPartyRepository $thirdPartyRepository)
public function __construct(private ThirdPartyRender $thirdPartyRender, private ThirdPartyRepository $thirdPartyRepository)
{
$this->thirdPartyRender = $thirdPartyRender;
$this->thirdPartyRepository = $thirdPartyRepository;
}
public function getLabel(string $key, array $values, string $header): callable

View File

@@ -38,31 +38,16 @@ use function array_key_exists;
class ThirdPartyType extends AbstractType
{
protected AuthorizationHelper $authorizationHelper;
protected EntityManagerInterface $om;
protected TokenStorageInterface $tokenStorage;
protected TranslatableStringHelper $translatableStringHelper;
protected ThirdPartyTypeManager $typesManager;
private bool $askCenter;
public function __construct(
AuthorizationHelper $authorizationHelper,
TokenStorageInterface $tokenStorage,
ThirdPartyTypeManager $typesManager,
TranslatableStringHelper $translatableStringHelper,
EntityManagerInterface $om,
protected AuthorizationHelper $authorizationHelper,
protected TokenStorageInterface $tokenStorage,
protected ThirdPartyTypeManager $typesManager,
protected TranslatableStringHelper $translatableStringHelper,
protected EntityManagerInterface $om,
ParameterBagInterface $parameterBag
) {
$this->authorizationHelper = $authorizationHelper;
$this->tokenStorage = $tokenStorage;
$this->typesManager = $typesManager;
$this->translatableStringHelper = $translatableStringHelper;
$this->om = $om;
$this->askCenter = $parameterBag->get('chill_main')['acl']['form_show_centers'];
}

View File

@@ -30,24 +30,8 @@ class PickThirdPartyTypeCategoryType extends \Symfony\Component\Form\AbstractTyp
{
private const PREFIX_TYPE = 'chill_3party.key_label.';
private ThirdPartyCategoryRepository $thirdPartyCategoryRepository;
private ThirdPartyTypeManager $thirdPartyTypeManager;
private TranslatableStringHelper $translatableStringHelper;
private TranslatorInterface $translator;
public function __construct(
ThirdPartyCategoryRepository $thirdPartyCategoryRepository,
ThirdPartyTypeManager $thirdPartyTypeManager,
TranslatableStringHelper $translatableStringHelper,
TranslatorInterface $translator
) {
$this->thirdPartyCategoryRepository = $thirdPartyCategoryRepository;
$this->thirdPartyTypeManager = $thirdPartyTypeManager;
$this->translatableStringHelper = $translatableStringHelper;
$this->translator = $translator;
public function __construct(private ThirdPartyCategoryRepository $thirdPartyCategoryRepository, private ThirdPartyTypeManager $thirdPartyTypeManager, private TranslatableStringHelper $translatableStringHelper, private TranslatorInterface $translator)
{
}
public function configureOptions(OptionsResolver $resolver)

View File

@@ -26,17 +26,8 @@ use Symfony\Component\Serializer\SerializerInterface;
*/
class PickThirdpartyDynamicType extends AbstractType
{
private DenormalizerInterface $denormalizer;
private NormalizerInterface $normalizer;
private SerializerInterface $serializer;
public function __construct(DenormalizerInterface $denormalizer, SerializerInterface $serializer, NormalizerInterface $normalizer)
public function __construct(private DenormalizerInterface $denormalizer, private SerializerInterface $serializer, private NormalizerInterface $normalizer)
{
$this->denormalizer = $denormalizer;
$this->serializer = $serializer;
$this->normalizer = $normalizer;
}
public function buildForm(FormBuilderInterface $builder, array $options)

View File

@@ -17,17 +17,8 @@ use Symfony\Component\Security\Core\Security;
final class ThirdPartyACLAwareRepository implements ThirdPartyACLAwareRepositoryInterface
{
private AuthorizationHelper $authorizationHelper;
private Security $security;
private ThirdPartyRepository $thirdPartyRepository;
public function __construct(Security $security, AuthorizationHelper $authorizationHelper, ThirdPartyRepository $thirdPartyRepository)
public function __construct(private Security $security, private AuthorizationHelper $authorizationHelper, private ThirdPartyRepository $thirdPartyRepository)
{
$this->security = $security;
$this->authorizationHelper = $authorizationHelper;
$this->thirdPartyRepository = $thirdPartyRepository;
}
public function buildQuery(?string $filterString = null): QueryBuilder

View File

@@ -49,11 +49,8 @@ FROM rows, searches
*/
class ThirdPartyApiSearch implements SearchApiInterface
{
private ThirdPartyRepository $thirdPartyRepository;
public function __construct(ThirdPartyRepository $thirdPartyRepository)
public function __construct(private ThirdPartyRepository $thirdPartyRepository)
{
$this->thirdPartyRepository = $thirdPartyRepository;
}
public function getResult(string $key, array $metadata, float $pertinence)

View File

@@ -48,20 +48,17 @@ class ThirdPartySearch implements SearchInterface
*/
protected $tokenStorage;
private ThirdPartyRepository $thirdPartyRepository;
public function __construct(
EntityManagerInterface $em,
TokenStorageInterface $tokenStorage,
AuthorizationHelper $authorizationHelper,
PaginatorFactory $paginatorFactory,
ThirdPartyRepository $thirdPartyRepository
private ThirdPartyRepository $thirdPartyRepository
) {
$this->em = $em;
$this->tokenStorage = $tokenStorage;
$this->authorizationHelper = $authorizationHelper;
$this->paginatorFactory = $paginatorFactory;
$this->thirdPartyRepository = $thirdPartyRepository;
}
public function getOrder(): int

View File

@@ -24,16 +24,8 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf
{
use NormalizerAwareTrait;
private ThirdPartyRender $thirdPartyRender;
private TranslatableStringHelperInterface $translatableStringHelper;
public function __construct(
ThirdPartyRender $thirdPartyRender,
TranslatableStringHelperInterface $translatableStringHelper
) {
$this->thirdPartyRender = $thirdPartyRender;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private ThirdPartyRender $thirdPartyRender, private TranslatableStringHelperInterface $translatableStringHelper)
{
}
public function normalize($thirdParty, $format = null, array $context = [])

View File

@@ -24,16 +24,9 @@ use Symfony\Component\Templating\EngineInterface;
class ThirdPartyRender implements ChillEntityRenderInterface
{
use BoxUtilsChillEntityRenderTrait;
protected EngineInterface $engine;
protected TranslatableStringHelper $translatableStringHelper;
public function __construct(
EngineInterface $engine,
TranslatableStringHelper $translatableStringHelper
) {
$this->engine = $engine;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(protected EngineInterface $engine, protected TranslatableStringHelper $translatableStringHelper)
{
}
public function renderBox($entity, array $options): string