apply rector rules: php up to php82

This commit is contained in:
2023-07-19 23:16:01 +02:00
parent 7b637d1287
commit 023a29cb78
744 changed files with 1369 additions and 1381 deletions

View File

@@ -19,7 +19,7 @@ use Symfony\Component\Security\Core\Security;
final class PrivateCommentDataMapper extends AbstractType implements DataMapperInterface
{
public function __construct(private Security $security)
public function __construct(private readonly Security $security)
{
}

View File

@@ -16,7 +16,7 @@ use Symfony\Component\Form\DataMapperInterface;
class ScopePickerDataMapper implements DataMapperInterface
{
public function __construct(private ?Scope $scope = null)
public function __construct(private readonly ?Scope $scope = null)
{
}

View File

@@ -29,12 +29,12 @@ use function call_user_func;
*/
class IdToEntityDataTransformer implements DataTransformerInterface
{
private Closure $getId;
private readonly Closure $getId;
/**
* @param Closure $getId
*/
public function __construct(private ObjectRepository $repository, private bool $multiple = false, ?callable $getId = null)
public function __construct(private readonly ObjectRepository $repository, private readonly bool $multiple = false, ?callable $getId = null)
{
$this->getId = $getId ?? static fn (object $o) => $o->getId();
}

View File

@@ -15,7 +15,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class CustomizeFormEvent extends \Symfony\Component\EventDispatcher\Event
{
public const NAME = 'chill_main.customize_form';
final public const NAME = 'chill_main.customize_form';
public function __construct(protected string $type, protected FormBuilderInterface $builder)
{

View File

@@ -24,7 +24,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
final class LocationFormType extends AbstractType
{
public function __construct(private TranslatableStringHelper $translatableStringHelper)
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper)
{
}

View File

@@ -24,7 +24,7 @@ use function count;
class PermissionsGroupType extends AbstractType
{
public const FLAG_SCOPE = 'permissions_group';
final public const FLAG_SCOPE = 'permissions_group';
/**
* @var PermissionsGroupFlagProvider[]

View File

@@ -20,9 +20,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class ChillPhoneNumberType extends AbstractType
{
private string $defaultCarrierCode;
private readonly string $defaultCarrierCode;
private PhoneNumberUtil $phoneNumberUtil;
private readonly PhoneNumberUtil $phoneNumberUtil;
public function __construct(ParameterBagInterface $parameterBag)
{

View File

@@ -44,7 +44,7 @@ class ComposedRoleScopeType extends AbstractType
private $rolesWithoutScope = [];
public function __construct(
private TranslatableStringHelper $translatableStringHelper,
private readonly TranslatableStringHelper $translatableStringHelper,
RoleProvider $roleProvider
) {
$this->roles = $roleProvider->getRoles();

View File

@@ -15,7 +15,7 @@ use Chill\MainBundle\Repository\AddressRepository;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
final class AddressToIdDataTransformer implements DataTransformerInterface
final readonly class AddressToIdDataTransformer implements DataTransformerInterface
{
public function __construct(private AddressRepository $addressRepository)
{

View File

@@ -23,7 +23,7 @@ use function count;
class CenterTransformer implements DataTransformerInterface
{
public function __construct(private CenterRepository $centerRepository, private bool $multiple = false)
public function __construct(private readonly CenterRepository $centerRepository, private readonly bool $multiple = false)
{
}
@@ -40,7 +40,7 @@ class CenterTransformer implements DataTransformerInterface
$ids = [];
if ($this->multiple) {
$ids = explode(',', $id);
$ids = explode(',', (string) $id);
} else {
$ids[] = (int) $id;
}

View File

@@ -25,7 +25,7 @@ use function array_key_exists;
class EntityToJsonTransformer implements DataTransformerInterface
{
public function __construct(private DenormalizerInterface $denormalizer, private SerializerInterface $serializer, private bool $multiple, private string $type)
public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly bool $multiple, private readonly string $type)
{
}
@@ -35,7 +35,7 @@ class EntityToJsonTransformer implements DataTransformerInterface
return null;
}
$denormalized = json_decode($value, true, 512, JSON_THROW_ON_ERROR);
$denormalized = json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR);
if ($this->multiple) {
if (null === $denormalized) {

View File

@@ -17,7 +17,7 @@ use Symfony\Component\Form\DataTransformerInterface;
class MultipleObjectsToIdTransformer implements DataTransformerInterface
{
public function __construct(private EntityManagerInterface $em, private ?string $class = null)
public function __construct(private readonly EntityManagerInterface $em, private readonly ?string $class = null)
{
}

View File

@@ -17,7 +17,7 @@ use Symfony\Component\Form\Exception\TransformationFailedException;
class ObjectToIdTransformer implements DataTransformerInterface
{
public function __construct(private EntityManagerInterface $em, private ?string $class = null)
public function __construct(private readonly EntityManagerInterface $em, private readonly ?string $class = null)
{
}

View File

@@ -20,7 +20,7 @@ use function is_int;
class PostalCodeToIdTransformer implements DataTransformerInterface
{
public function __construct(private PostalCodeRepositoryInterface $postalCodeRepository)
public function __construct(private readonly PostalCodeRepositoryInterface $postalCodeRepository)
{
}

View File

@@ -18,7 +18,7 @@ use Symfony\Component\Form\Exception\TransformationFailedException;
class ScopeTransformer implements DataTransformerInterface
{
public function __construct(private EntityManagerInterface $em)
public function __construct(private readonly EntityManagerInterface $em)
{
}

View File

@@ -20,13 +20,13 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class ExportType extends AbstractType
{
public const AGGREGATOR_KEY = 'aggregators';
final public const AGGREGATOR_KEY = 'aggregators';
public const EXPORT_KEY = 'export';
final public const EXPORT_KEY = 'export';
public const FILTER_KEY = 'filters';
final public const FILTER_KEY = 'filters';
public const PICK_FORMATTER_KEY = 'pick_formatter';
final public const PICK_FORMATTER_KEY = 'pick_formatter';
/**
* @var ExportManager

View File

@@ -19,7 +19,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class FilterType extends AbstractType
{
public const ENABLED_FIELD = 'enabled';
final public const ENABLED_FIELD = 'enabled';
public function __construct()
{

View File

@@ -35,9 +35,9 @@ final class PickCenterType extends AbstractType
public const CENTERS_IDENTIFIERS = 'c';
public function __construct(
private ExportManager $exportManager,
private RegroupmentRepository $regroupmentRepository,
private AuthorizationHelperForCurrentUserInterface $authorizationHelper
private readonly ExportManager $exportManager,
private readonly RegroupmentRepository $regroupmentRepository,
private readonly AuthorizationHelperForCurrentUserInterface $authorizationHelper
) {
}

View File

@@ -43,7 +43,7 @@ use function uniqid;
*/
final class PickAddressType extends AbstractType
{
public function __construct(private AddressToIdDataTransformer $addressToIdDataTransformer, private TranslatorInterface $translator)
public function __construct(private readonly AddressToIdDataTransformer $addressToIdDataTransformer, private readonly TranslatorInterface $translator)
{
}

View File

@@ -21,7 +21,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class PickCivilityType extends AbstractType
{
public function __construct(private TranslatableStringHelper $translatableStringHelper)
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper)
{
}

View File

@@ -19,7 +19,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class PickLocationTypeType extends AbstractType
{
public function __construct(private TranslatableStringHelper $translatableStringHelper)
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper)
{
}

View File

@@ -21,7 +21,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class PickPostalCodeType extends AbstractType
{
public function __construct(private PostalCodeToIdTransformer $postalCodeToIdTransformer)
public function __construct(private readonly PostalCodeToIdTransformer $postalCodeToIdTransformer)
{
}

View File

@@ -55,7 +55,7 @@ class PickRollingDateType extends AbstractType
'class' => RollingDate::class,
'empty_data' => new RollingDate(RollingDate::T_TODAY),
'constraints' => [
new Callback([$this, 'validate']),
new Callback($this->validate(...)),
],
]);
}

View File

@@ -27,7 +27,7 @@ use Symfony\Component\Serializer\SerializerInterface;
*/
class PickUserDynamicType extends AbstractType
{
public function __construct(private DenormalizerInterface $denormalizer, private SerializerInterface $serializer, private NormalizerInterface $normalizer)
public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly NormalizerInterface $normalizer)
{
}

View File

@@ -20,7 +20,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class PickUserLocationType extends AbstractType
{
public function __construct(private TranslatableStringHelper $translatableStringHelper, private LocationRepository $locationRepository)
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly LocationRepository $locationRepository)
{
}

View File

@@ -42,7 +42,7 @@ use function count;
*/
class ScopePickerType extends AbstractType
{
public function __construct(private AuthorizationHelperInterface $authorizationHelper, private Security $security, private TranslatableStringHelperInterface $translatableStringHelper)
public function __construct(private readonly AuthorizationHelperInterface $authorizationHelper, private readonly Security $security, private readonly TranslatableStringHelperInterface $translatableStringHelper)
{
}

View File

@@ -29,7 +29,7 @@ use const SORT_STRING;
*/
class Select2CountryType extends AbstractType
{
public function __construct(private RequestStack $requestStack, private ObjectManager $em, protected TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag)
public function __construct(private readonly RequestStack $requestStack, private readonly ObjectManager $em, protected TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag)
{
}

View File

@@ -29,7 +29,7 @@ use const SORT_STRING;
*/
class Select2LanguageType extends AbstractType
{
public function __construct(private RequestStack $requestStack, private ObjectManager $em, protected TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag)
public function __construct(private readonly RequestStack $requestStack, private readonly ObjectManager $em, protected TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag)
{
}

View File

@@ -28,7 +28,7 @@ class TranslatableStringFormType extends AbstractType
private $frameworkTranslatorFallback; // The langagues used for the translation
public function __construct(private array $availableLanguages, Translator $translator)
public function __construct(private readonly array $availableLanguages, Translator $translator)
{
$this->frameworkTranslatorFallback = $translator->getFallbackLocales();
}

View File

@@ -49,7 +49,7 @@ class UserPickerType extends AbstractType
TokenStorageInterface $tokenStorage,
protected UserRepository $userRepository,
protected UserACLAwareRepositoryInterface $userACLAwareRepository,
private UserRender $userRender
private readonly UserRender $userRender
) {
$this->authorizationHelper = $authorizationHelper;
$this->tokenStorage = $tokenStorage;

View File

@@ -35,7 +35,7 @@ use Symfony\Component\Validator\Constraints\Regex;
class UserType extends AbstractType
{
public function __construct(private TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag)
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, protected ParameterBagInterface $parameterBag)
{
}

View File

@@ -36,7 +36,7 @@ use function array_key_exists;
class WorkflowStepType extends AbstractType
{
public function __construct(private EntityWorkflowManager $entityWorkflowManager, private Registry $registry, private TranslatableStringHelperInterface $translatableStringHelper)
public function __construct(private readonly EntityWorkflowManager $entityWorkflowManager, private readonly Registry $registry, private readonly TranslatableStringHelperInterface $translatableStringHelper)
{
}