fixes after merge of master into upgrade-sf4

This commit is contained in:
2024-02-12 22:31:16 +01:00
parent 37af488f69
commit f889d67e94
664 changed files with 795 additions and 1980 deletions

View File

@@ -14,6 +14,7 @@ namespace Chill\CustomFieldsBundle\Controller;
use Chill\CustomFieldsBundle\Entity\CustomField;
use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup;
use Chill\CustomFieldsBundle\Form\CustomFieldType;
use Symfony\Bridge\Doctrine\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
@@ -25,9 +26,10 @@ use Symfony\Contracts\Translation\TranslatorInterface;
*/
class CustomFieldController extends AbstractController
{
public function __construct(private readonly TranslatorInterface $translator)
{
}
public function __construct(
private readonly TranslatorInterface $translator,
private readonly ManagerRegistry $managerRegistry,
) {}
/**
* Creates a new CustomField entity.

View File

@@ -43,8 +43,7 @@ class CustomFieldChoice extends AbstractCustomField
* @var TranslatableStringHelper Helper that find the string in current locale from an array of translation
*/
private readonly TranslatableStringHelper $translatableStringHelper
) {
}
) {}
public function allowOtherChoice(CustomField $cf)
{

View File

@@ -45,8 +45,7 @@ class CustomFieldDate extends AbstractCustomField
public function __construct(
private readonly Environment $templating,
private readonly TranslatableStringHelper $translatableStringHelper
) {
}
) {}
public function buildForm(FormBuilderInterface $builder, CustomField $customField)
{

View File

@@ -52,7 +52,7 @@ interface CustomFieldInterface
*
* @param mixed $value the value passed throug the deserialize function
*/
public function isEmptyValue($value, CustomField $customField);
public function isEmptyValue(mixed $value, CustomField $customField);
/**
* Return a repsentation of the value of the CustomField.
@@ -62,7 +62,7 @@ interface CustomFieldInterface
*
* @return string an html representation of the value
*/
public function render($value, CustomField $customField, $documentType = 'html');
public function render(mixed $value, CustomField $customField, $documentType = 'html');
/**
* Transform the value into a format that can be stored in DB.

View File

@@ -28,8 +28,7 @@ class CustomFieldLongChoice extends AbstractCustomField
private readonly OptionRepository $optionRepository,
private readonly TranslatableStringHelper $translatableStringHelper,
private readonly \Twig\Environment $templating,
) {
}
) {}
public function buildForm(FormBuilderInterface $builder, CustomField $customField)
{

View File

@@ -42,8 +42,7 @@ class CustomFieldNumber extends AbstractCustomField
public function __construct(
private readonly Environment $templating,
private readonly TranslatableStringHelper $translatableStringHelper
) {
}
) {}
public function buildForm(FormBuilderInterface $builder, CustomField $customField)
{

View File

@@ -29,8 +29,7 @@ class CustomFieldText extends AbstractCustomField
public function __construct(
private readonly Environment $templating,
private readonly TranslatableStringHelper $translatableStringHelper
) {
}
) {}
/**
* Create a form according to the maxLength option.

View File

@@ -32,8 +32,7 @@ class CustomFieldTitle extends AbstractCustomField
* @var TranslatableStringHelper Helper that find the string in current locale from an array of translation
*/
private readonly TranslatableStringHelper $translatableStringHelper
) {
}
) {}
public function buildForm(FormBuilderInterface $builder, CustomField $customField)
{

View File

@@ -30,9 +30,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class CustomFieldType extends AbstractType
{
public function __construct(private readonly CustomFieldProvider $customFieldProvider, private readonly ObjectManager $om, private readonly TranslatableStringHelper $translatableStringHelper)
{
}
public function __construct(private readonly CustomFieldProvider $customFieldProvider, private readonly ObjectManager $om, private readonly TranslatableStringHelper $translatableStringHelper) {}
public function buildForm(FormBuilderInterface $builder, array $options)
{

View File

@@ -27,8 +27,7 @@ class CustomFieldsGroupType extends AbstractType
private readonly array $customizableEntities,
// TODO : add comment about this variable
private readonly TranslatorInterface $translator
) {
}
) {}
// TODO : details about the function
public function buildForm(FormBuilderInterface $builder, array $options)

View File

@@ -17,9 +17,7 @@ use Symfony\Component\Form\DataTransformerInterface;
class CustomFieldDataTransformer implements DataTransformerInterface
{
public function __construct(private readonly CustomFieldInterface $customFieldDefinition, private readonly CustomField $customField)
{
}
public function __construct(private readonly CustomFieldInterface $customFieldDefinition, private readonly CustomField $customField) {}
public function reverseTransform($value)
{

View File

@@ -18,9 +18,7 @@ use Symfony\Component\Form\Exception\TransformationFailedException;
class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
{
public function __construct(private readonly ObjectManager $om)
{
}
public function __construct(private readonly ObjectManager $om) {}
/**
* Transforms a string (id) to an object (CustomFieldsGroup).

View File

@@ -16,9 +16,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class CustomFieldsTitleType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
}
public function buildForm(FormBuilderInterface $builder, array $options) {}
public function getBlockPrefix()
{

View File

@@ -42,9 +42,7 @@ class LinkedCustomFieldsType extends AbstractType
*/
private array $options = [];
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper)
{
}
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {}
/**
* append Choice on POST_SET_DATA event.

View File

@@ -29,9 +29,7 @@ class CustomFieldsHelper
* @param CustomFieldProvider $provider The customfield provider that
* contains all the declared custom fields
*/
public function __construct(private readonly EntityManagerInterface $em, private readonly CustomFieldProvider $provider)
{
}
public function __construct(private readonly EntityManagerInterface $em, private readonly CustomFieldProvider $provider) {}
public function isEmptyValue(array $fields, CustomField $customField)
{

View File

@@ -31,9 +31,7 @@ class CustomFieldRenderingTwig extends AbstractExtension
'label_layout' => '@ChillCustomFields/CustomField/render_label.html.twig',
];
public function __construct(private readonly CustomFieldsHelper $customFieldsHelper)
{
}
public function __construct(private readonly CustomFieldsHelper $customFieldsHelper) {}
/**
* (non-PHPdoc).