Merge branch 'master' into upgrade-sf5

This commit is contained in:
2024-02-12 21:50:34 +01:00
920 changed files with 6430 additions and 1914 deletions

View File

@@ -25,7 +25,9 @@ use Symfony\Contracts\Translation\TranslatorInterface;
*/
class CustomFieldController extends AbstractController
{
public function __construct(private readonly TranslatorInterface $translator, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
public function __construct(private readonly TranslatorInterface $translator)
{
}
/**
* Creates a new CustomField entity.

View File

@@ -365,7 +365,7 @@ class CustomFieldsGroupController extends AbstractController
*
* @return \Symfony\Component\Form\Form
*/
private function createMakeDefaultForm(CustomFieldsGroup $group = null)
private function createMakeDefaultForm(?CustomFieldsGroup $group = null)
{
return $this->createFormBuilder($group, [
'method' => 'POST',

View File

@@ -43,7 +43,8 @@ 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)
{
@@ -155,7 +156,7 @@ class CustomFieldChoice extends AbstractCustomField
return $serialized;
}
public function extractOtherValue(CustomField $cf, array $data = null)
public function extractOtherValue(CustomField $cf, ?array $data = null)
{
return $data['_other'];
}
@@ -354,7 +355,7 @@ class CustomFieldChoice extends AbstractCustomField
* If the value had an 'allow_other' = true option, the returned value
* **is not** the content of the _other field, but the `_other` string.
*/
private function guessValue(null|array|string $value)
private function guessValue(array|string|null $value)
{
if (null === $value) {
return null;

View File

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

View File

@@ -28,7 +28,8 @@ 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,7 +42,8 @@ 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,7 +29,8 @@ 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,7 +32,8 @@ 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

@@ -38,7 +38,7 @@ class CustomField
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldsGroup",
* inversedBy="customFields")
*/
private ?\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldGroup = null;
private ?CustomFieldsGroup $customFieldGroup = null;
/**
* @ORM\Id
@@ -212,7 +212,7 @@ class CustomField
*
* @return CustomField
*/
public function setCustomFieldsGroup(CustomFieldsGroup $customFieldGroup = null)
public function setCustomFieldsGroup(?CustomFieldsGroup $customFieldGroup = null)
{
$this->customFieldGroup = $customFieldGroup;

View File

@@ -63,7 +63,7 @@ class Option
*
* @ORM\JoinColumn(nullable=true)
*/
private ?\Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option $parent = null;
private ?Option $parent = null;
/**
* A json representation of text (multilingual).
@@ -182,7 +182,7 @@ class Option
/**
* @return $this
*/
public function setParent(Option $parent = null)
public function setParent(?Option $parent = null)
{
$this->parent = $parent;
$this->key = $parent->getKey();

View File

@@ -33,7 +33,7 @@ class CustomFieldsDefaultGroup
*
* sf4 check: option inversedBy="customFields" return inconsistent error mapping !!
*/
private ?\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldsGroup = null;
private ?CustomFieldsGroup $customFieldsGroup = null;
/**
* @ORM\Column(type="string", length=255)

View File

@@ -139,7 +139,7 @@ class CustomFieldsGroup
/**
* Get name.
*/
public function getName(string $language = null): array|string
public function getName(?string $language = null): array|string
{
// TODO set this in a service, PLUS twig function
if (null !== $language) {

View File

@@ -30,7 +30,9 @@ 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,7 +27,8 @@ 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,7 +17,9 @@ 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,7 +18,9 @@ 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,7 +16,9 @@ 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,7 +42,9 @@ 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

@@ -84,7 +84,7 @@ class CustomFieldProvider implements ContainerAwareInterface
*
* @see \Symfony\Component\DependencyInjection\ContainerAwareInterface::setContainer()
*/
public function setContainer(ContainerInterface $container = null)
public function setContainer(?ContainerInterface $container = null)
{
if (null === $container) {
throw new \LogicException('container should not be null');

View File

@@ -29,7 +29,9 @@ 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,7 +31,9 @@ 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).

View File

@@ -25,7 +25,7 @@ final class CustomFieldsHelperTest extends KernelTestCase
{
private ?object $cfHelper = null;
private \Chill\CustomFieldsBundle\Entity\CustomField $randomCFText;
private CustomField $randomCFText;
protected function setUp(): void
{