mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-28 01:25:00 +00:00
Rector changes and immplementations of required methods
This commit is contained in:
@@ -16,7 +16,7 @@ use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
class ChillCustomFieldsBundle extends Bundle
|
||||
{
|
||||
public function build(\Symfony\Component\DependencyInjection\ContainerBuilder $container)
|
||||
public function build(\Symfony\Component\DependencyInjection\ContainerBuilder $container): void
|
||||
{
|
||||
parent::build($container);
|
||||
$container->addCompilerPass(new CustomFieldCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
|
||||
|
@@ -29,6 +29,7 @@ use Symfony\Component\Yaml\Parser;
|
||||
* Class for the command 'chill:custom_fields:populate_group' that
|
||||
* Create custom fields from a yml file.
|
||||
*/
|
||||
#[\Symfony\Component\Console\Attribute\AsCommand(name: 'chill:custom_fields:populate_group')]
|
||||
class CreateFieldsOnGroupCommand extends Command
|
||||
{
|
||||
protected static $defaultDescription = 'Create custom fields from a yml file';
|
||||
@@ -51,7 +52,7 @@ class CreateFieldsOnGroupCommand extends Command
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('chill:custom_fields:populate_group')
|
||||
$this
|
||||
->addArgument(
|
||||
self::ARG_PATH,
|
||||
InputOption::VALUE_REQUIRED,
|
||||
@@ -133,7 +134,7 @@ class CreateFieldsOnGroupCommand extends Command
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
private function _addFields(CustomFieldsGroup $group, $values, OutputInterface $output)
|
||||
private function _addFields(CustomFieldsGroup $group, $values, OutputInterface $output): void
|
||||
{
|
||||
$em = $this->entityManager;
|
||||
|
||||
|
@@ -35,7 +35,7 @@ class CustomFieldController extends AbstractController
|
||||
* Creates a new CustomField entity.
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/customfield/new', name: 'customfield_create')]
|
||||
public function createAction(Request $request)
|
||||
public function createAction(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$entity = new CustomField();
|
||||
$form = $this->createCreateForm($entity, $request->query->get('type', null));
|
||||
@@ -65,7 +65,7 @@ class CustomFieldController extends AbstractController
|
||||
* Displays a form to edit an existing CustomField entity.
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/customfield/edit', name: 'customfield_edit')]
|
||||
public function editAction(mixed $id)
|
||||
public function editAction(mixed $id): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
|
||||
@@ -87,7 +87,7 @@ class CustomFieldController extends AbstractController
|
||||
* Displays a form to create a new CustomField entity.
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/customfield/new', name: 'customfield_new')]
|
||||
public function newAction(Request $request)
|
||||
public function newAction(Request $request): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$entity = new CustomField();
|
||||
|
||||
@@ -117,7 +117,7 @@ class CustomFieldController extends AbstractController
|
||||
* Edits an existing CustomField entity.
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/customfield/update', name: 'customfield_update')]
|
||||
public function updateAction(Request $request, mixed $id)
|
||||
public function updateAction(Request $request, mixed $id): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
|
||||
|
@@ -46,7 +46,7 @@ class CustomFieldsGroupController extends AbstractController
|
||||
* Creates a new CustomFieldsGroup entity.
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/customfieldsgroup/create', name: 'customfieldsgroup_create')]
|
||||
public function createAction(Request $request)
|
||||
public function createAction(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$entity = new CustomFieldsGroup();
|
||||
$form = $this->createCreateForm($entity);
|
||||
@@ -76,7 +76,7 @@ class CustomFieldsGroupController extends AbstractController
|
||||
* Displays a form to edit an existing CustomFieldsGroup entity.
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/customfieldsgroup/{id}/edit', name: 'customfieldsgroup_edit')]
|
||||
public function editAction(mixed $id)
|
||||
public function editAction(mixed $id): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
|
||||
@@ -98,7 +98,7 @@ class CustomFieldsGroupController extends AbstractController
|
||||
* Lists all CustomFieldsGroup entities.
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/customfieldsgroup/', name: 'customfieldsgroup')]
|
||||
public function indexAction()
|
||||
public function indexAction(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
|
||||
@@ -124,7 +124,7 @@ class CustomFieldsGroupController extends AbstractController
|
||||
* Set the CustomField Group with id $cFGroupId as default.
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/customfieldsgroup/makedefault', name: 'customfieldsgroup_makedefault')]
|
||||
public function makeDefaultAction(Request $request)
|
||||
public function makeDefaultAction(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse
|
||||
{
|
||||
$form = $this->createMakeDefaultForm(null);
|
||||
$form->handleRequest($request);
|
||||
@@ -168,7 +168,7 @@ class CustomFieldsGroupController extends AbstractController
|
||||
* Displays a form to create a new CustomFieldsGroup entity.
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/customfieldsgroup/new', name: 'customfieldsgroup_new')]
|
||||
public function newAction()
|
||||
public function newAction(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$entity = new CustomFieldsGroup();
|
||||
$form = $this->createCreateForm($entity);
|
||||
@@ -189,7 +189,7 @@ class CustomFieldsGroupController extends AbstractController
|
||||
*
|
||||
* @param int $id
|
||||
*/
|
||||
public function renderFormAction($id, Request $request)
|
||||
public function renderFormAction($id, Request $request): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
|
||||
@@ -232,7 +232,7 @@ class CustomFieldsGroupController extends AbstractController
|
||||
* Finds and displays a CustomFieldsGroup entity.
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/customfieldsgroup/{id}/show', name: 'customfieldsgroup_show')]
|
||||
public function showAction(mixed $id)
|
||||
public function showAction(mixed $id): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
|
||||
@@ -255,7 +255,7 @@ class CustomFieldsGroupController extends AbstractController
|
||||
* Edits an existing CustomFieldsGroup entity.
|
||||
*/
|
||||
#[Route(path: '/{_locale}/admin/customfieldsgroup/{id}/update', name: 'customfieldsgroup_update')]
|
||||
public function updateAction(Request $request, mixed $id)
|
||||
public function updateAction(Request $request, mixed $id): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$em = $this->managerRegistry->getManager();
|
||||
|
||||
@@ -358,7 +358,7 @@ class CustomFieldsGroupController extends AbstractController
|
||||
*
|
||||
* @return \Symfony\Component\Form\Form
|
||||
*/
|
||||
private function createMakeDefaultForm(?CustomFieldsGroup $group = null)
|
||||
private function createMakeDefaultForm(?CustomFieldsGroup $group = null): \Symfony\Component\Form\FormInterface
|
||||
{
|
||||
return $this->createFormBuilder($group, [
|
||||
'method' => 'POST',
|
||||
|
@@ -50,7 +50,7 @@ class CustomFieldChoice extends AbstractCustomField
|
||||
return $cf->getOptions()[self::ALLOW_OTHER];
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, CustomField $customField)
|
||||
public function buildForm(FormBuilderInterface $builder, CustomField $customField): void
|
||||
{
|
||||
// prepare choices
|
||||
$choices = [];
|
||||
@@ -266,7 +266,7 @@ class CustomFieldChoice extends AbstractCustomField
|
||||
*
|
||||
* @return string html representation
|
||||
*/
|
||||
public function render($value, CustomField $customField, $documentType = 'html')
|
||||
public function render($value, CustomField $customField, $documentType = 'html'): string
|
||||
{
|
||||
// extract the data. They are under a _choice key if they are stored with allow_other
|
||||
$data = $value['_choices'] ?? $value;
|
||||
|
@@ -47,7 +47,7 @@ class CustomFieldDate extends AbstractCustomField
|
||||
private readonly TranslatableStringHelper $translatableStringHelper,
|
||||
) {}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, CustomField $customField)
|
||||
public function buildForm(FormBuilderInterface $builder, CustomField $customField): void
|
||||
{
|
||||
$fieldOptions = $this->prepareFieldOptions($customField);
|
||||
|
||||
@@ -64,7 +64,7 @@ class CustomFieldDate extends AbstractCustomField
|
||||
);
|
||||
}
|
||||
|
||||
public function buildOptionsForm(FormBuilderInterface $builder)
|
||||
public function buildOptionsForm(FormBuilderInterface $builder): \Symfony\Component\Form\FormBuilderInterface
|
||||
{
|
||||
$validatorFunction = static function ($value, ExecutionContextInterface $context) {
|
||||
try {
|
||||
|
@@ -30,7 +30,7 @@ class CustomFieldLongChoice extends AbstractCustomField
|
||||
private readonly \Twig\Environment $templating,
|
||||
) {}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, CustomField $customField)
|
||||
public function buildForm(FormBuilderInterface $builder, CustomField $customField): void
|
||||
{
|
||||
$options = $customField->getOptions();
|
||||
$entries = $this->optionRepository->findFilteredByKey(
|
||||
@@ -63,7 +63,7 @@ class CustomFieldLongChoice extends AbstractCustomField
|
||||
->addModelTransformer(new CustomFieldDataTransformer($this, $customField));
|
||||
}
|
||||
|
||||
public function buildOptionsForm(FormBuilderInterface $builder)
|
||||
public function buildOptionsForm(FormBuilderInterface $builder): \Symfony\Component\Form\FormBuilderInterface
|
||||
{
|
||||
// create a selector between different keys
|
||||
$keys = $this->optionRepository->getKeys();
|
||||
@@ -93,7 +93,7 @@ class CustomFieldLongChoice extends AbstractCustomField
|
||||
return 'Long choice field';
|
||||
}
|
||||
|
||||
public function render($value, CustomField $customField, $documentType = 'html')
|
||||
public function render($value, CustomField $customField, $documentType = 'html'): string
|
||||
{
|
||||
$option = $this->deserialize($value, $customField);
|
||||
$template = '@ChillCustomFields/CustomFieldsRendering/choice_long.'
|
||||
|
@@ -44,7 +44,7 @@ class CustomFieldNumber extends AbstractCustomField
|
||||
private readonly TranslatableStringHelper $translatableStringHelper,
|
||||
) {}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, CustomField $customField)
|
||||
public function buildForm(FormBuilderInterface $builder, CustomField $customField): void
|
||||
{
|
||||
$options = $customField->getOptions();
|
||||
|
||||
@@ -58,7 +58,7 @@ class CustomFieldNumber extends AbstractCustomField
|
||||
$builder->add($customField->getSlug(), $type, $fieldOptions);
|
||||
}
|
||||
|
||||
public function buildOptionsForm(FormBuilderInterface $builder)
|
||||
public function buildOptionsForm(FormBuilderInterface $builder): \Symfony\Component\Form\FormBuilderInterface
|
||||
{
|
||||
return $builder
|
||||
->add(self::MIN, NumberType::class, [
|
||||
@@ -93,7 +93,7 @@ class CustomFieldNumber extends AbstractCustomField
|
||||
return 'Number field';
|
||||
}
|
||||
|
||||
public function render($value, CustomField $customField, $documentType = 'html')
|
||||
public function render($value, CustomField $customField, $documentType = 'html'): string
|
||||
{
|
||||
$template = '@ChillCustomFields/CustomFieldsRendering/number.'
|
||||
.$documentType.'.twig';
|
||||
|
@@ -37,7 +37,7 @@ class CustomFieldText extends AbstractCustomField
|
||||
* if maxLength < 256 THEN the form type is 'text'
|
||||
* if not, THEN the form type is textarea
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, CustomField $customField)
|
||||
public function buildForm(FormBuilderInterface $builder, CustomField $customField): void
|
||||
{
|
||||
$options = $customField->getOptions();
|
||||
|
||||
@@ -60,7 +60,7 @@ class CustomFieldText extends AbstractCustomField
|
||||
]);
|
||||
}
|
||||
|
||||
public function buildOptionsForm(FormBuilderInterface $builder)
|
||||
public function buildOptionsForm(FormBuilderInterface $builder): \Symfony\Component\Form\FormBuilderInterface
|
||||
{
|
||||
return $builder
|
||||
->add(self::MAX_LENGTH, IntegerType::class, ['empty_data' => 256])
|
||||
@@ -84,7 +84,7 @@ class CustomFieldText extends AbstractCustomField
|
||||
return 'Text field';
|
||||
}
|
||||
|
||||
public function render($value, CustomField $customField, $documentType = 'html')
|
||||
public function render($value, CustomField $customField, $documentType = 'html'): string
|
||||
{
|
||||
$template = '@ChillCustomFields/CustomFieldsRendering/text.html.twig';
|
||||
|
||||
|
@@ -34,7 +34,7 @@ class CustomFieldTitle extends AbstractCustomField
|
||||
private readonly TranslatableStringHelper $translatableStringHelper,
|
||||
) {}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, CustomField $customField)
|
||||
public function buildForm(FormBuilderInterface $builder, CustomField $customField): void
|
||||
{
|
||||
$builder->add($customField->getSlug(), CustomFieldsTitleType::class, [
|
||||
'label' => false,
|
||||
@@ -46,7 +46,7 @@ class CustomFieldTitle extends AbstractCustomField
|
||||
]);
|
||||
}
|
||||
|
||||
public function buildOptionsForm(FormBuilderInterface $builder)
|
||||
public function buildOptionsForm(FormBuilderInterface $builder): \Symfony\Component\Form\FormBuilderInterface
|
||||
{
|
||||
return $builder->add(
|
||||
self::TYPE,
|
||||
@@ -76,7 +76,7 @@ class CustomFieldTitle extends AbstractCustomField
|
||||
return false;
|
||||
}
|
||||
|
||||
public function render($value, CustomField $customField, $documentType = 'html')
|
||||
public function render($value, CustomField $customField, $documentType = 'html'): string
|
||||
{
|
||||
return $this->templating
|
||||
->render(
|
||||
|
@@ -76,7 +76,7 @@ class LoadOption extends AbstractFixture implements OrderedFixtureInterface
|
||||
->setInternalKey($parent->getKey().'-'.$this->counter);
|
||||
}
|
||||
|
||||
private function loadingCompanies(ObjectManager $manager)
|
||||
private function loadingCompanies(ObjectManager $manager): void
|
||||
{
|
||||
echo "Loading companies \n";
|
||||
$companiesParents = [
|
||||
@@ -120,7 +120,7 @@ class LoadOption extends AbstractFixture implements OrderedFixtureInterface
|
||||
}
|
||||
}
|
||||
|
||||
private function loadingWords(ObjectManager $manager)
|
||||
private function loadingWords(ObjectManager $manager): void
|
||||
{
|
||||
echo "Loading some words...\n";
|
||||
|
||||
|
@@ -24,7 +24,7 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
*/
|
||||
class ChillCustomFieldsExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
public function load(array $configs, ContainerBuilder $container): void
|
||||
{
|
||||
$configuration = new Configuration();
|
||||
$config = $this->processConfiguration($configuration, $configs);
|
||||
@@ -54,7 +54,7 @@ class ChillCustomFieldsExtension extends Extension implements PrependExtensionIn
|
||||
/** (non-PHPdoc).
|
||||
* @see \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface::prepend()
|
||||
*/
|
||||
public function prepend(ContainerBuilder $container)
|
||||
public function prepend(ContainerBuilder $container): void
|
||||
{
|
||||
// add form layout to twig resources
|
||||
$twigConfig = [
|
||||
|
@@ -17,7 +17,7 @@ use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
class CustomFieldCompilerPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container)
|
||||
public function process(ContainerBuilder $container): void
|
||||
{
|
||||
if (!$container->hasDefinition('chill.custom_field.provider')) {
|
||||
throw new \LogicException('service chill.custom_field.provider is not defined.');
|
||||
|
@@ -62,7 +62,7 @@ class CustomField
|
||||
*
|
||||
* @return CustomFieldsGroup
|
||||
*/
|
||||
public function getCustomFieldsGroup()
|
||||
public function getCustomFieldsGroup(): ?\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup
|
||||
{
|
||||
return $this->customFieldGroup;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ class CustomField
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ class CustomField
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getOptions()
|
||||
public function getOptions(): array
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
@@ -116,7 +116,7 @@ class CustomField
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getOrdering()
|
||||
public function getOrdering(): ?float
|
||||
{
|
||||
return $this->ordering;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ class CustomField
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getRequired()
|
||||
public function getRequired(): bool
|
||||
{
|
||||
return $this->isRequired();
|
||||
}
|
||||
@@ -134,7 +134,7 @@ class CustomField
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
public function getSlug(): ?string
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
@@ -144,7 +144,7 @@ class CustomField
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
public function getType(): ?string
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
@@ -154,7 +154,7 @@ class CustomField
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isActive()
|
||||
public function isActive(): bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
@@ -164,7 +164,7 @@ class CustomField
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isRequired()
|
||||
public function isRequired(): bool
|
||||
{
|
||||
return $this->required;
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ class Option
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getActive()
|
||||
public function getActive(): bool
|
||||
{
|
||||
return $this->isActive();
|
||||
}
|
||||
@@ -65,7 +65,7 @@ class Option
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getChildren()
|
||||
public function getChildren(): \Doctrine\Common\Collections\Collection
|
||||
{
|
||||
return $this->children;
|
||||
}
|
||||
@@ -73,7 +73,7 @@ class Option
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ class Option
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getInternalKey()
|
||||
public function getInternalKey(): string
|
||||
{
|
||||
return $this->internalKey;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ class Option
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getKey()
|
||||
public function getKey(): ?string
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ class Option
|
||||
/**
|
||||
* @return Option
|
||||
*/
|
||||
public function getParent()
|
||||
public function getParent(): ?\Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ class Option
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getText()
|
||||
public function getText(): ?array
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ class Option
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isActive()
|
||||
public function isActive(): bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
@@ -37,7 +37,7 @@ class CustomFieldsDefaultGroup
|
||||
*
|
||||
* @return CustomFieldsGroup
|
||||
*/
|
||||
public function getCustomFieldsGroup()
|
||||
public function getCustomFieldsGroup(): ?\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup
|
||||
{
|
||||
return $this->customFieldsGroup;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ class CustomFieldsDefaultGroup
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEntity()
|
||||
public function getEntity(): ?string
|
||||
{
|
||||
return $this->entity;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ class CustomFieldsDefaultGroup
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
@@ -93,7 +93,7 @@ class CustomFieldsGroup
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getCustomFields()
|
||||
public function getCustomFields(): \Doctrine\Common\Collections\Collection
|
||||
{
|
||||
return $this->customFields;
|
||||
}
|
||||
@@ -103,7 +103,7 @@ class CustomFieldsGroup
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEntity()
|
||||
public function getEntity(): ?string
|
||||
{
|
||||
return $this->entity;
|
||||
}
|
||||
@@ -113,7 +113,7 @@ class CustomFieldsGroup
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
@@ -146,7 +146,7 @@ class CustomFieldsGroup
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getOptions()
|
||||
public function getOptions(): array
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
@@ -154,7 +154,7 @@ class CustomFieldsGroup
|
||||
/**
|
||||
* Remove customField.
|
||||
*/
|
||||
public function removeCustomField(CustomField $customField)
|
||||
public function removeCustomField(CustomField $customField): void
|
||||
{
|
||||
$this->customFields->removeElement($customField);
|
||||
}
|
||||
|
@@ -47,7 +47,7 @@ class OptionRepository extends EntityRepository
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getKeys()
|
||||
public function getKeys(): array
|
||||
{
|
||||
$keys = $this->createQueryBuilder('option')
|
||||
->select('option.key')
|
||||
|
@@ -32,7 +32,7 @@ class CustomFieldType extends AbstractType
|
||||
{
|
||||
public function __construct(private readonly CustomFieldProvider $customFieldProvider, private readonly ObjectManager $om, private readonly TranslatableStringHelper $translatableStringHelper) {}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$customFieldsList = [];
|
||||
|
||||
@@ -91,7 +91,7 @@ class CustomFieldType extends AbstractType
|
||||
/**
|
||||
* @param OptionsResolverInterface $resolver
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => \Chill\CustomFieldsBundle\Entity\CustomField::class,
|
||||
@@ -106,7 +106,7 @@ class CustomFieldType extends AbstractType
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBlockPrefix()
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'custom_field_choice';
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ class CustomFieldsGroupType extends AbstractType
|
||||
) {}
|
||||
|
||||
// TODO : details about the function
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
// prepare translation
|
||||
$entities = [];
|
||||
@@ -86,7 +86,7 @@ class CustomFieldsGroupType extends AbstractType
|
||||
);
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => CustomFieldsGroup::class,
|
||||
|
@@ -19,7 +19,7 @@ class CustomFieldDataTransformer implements DataTransformerInterface
|
||||
{
|
||||
public function __construct(private readonly CustomFieldInterface $customFieldDefinition, private readonly CustomField $customField) {}
|
||||
|
||||
public function reverseTransform($value)
|
||||
public function reverseTransform($value): mixed
|
||||
{
|
||||
return $this->customFieldDefinition->serialize(
|
||||
$value,
|
||||
@@ -27,7 +27,7 @@ class CustomFieldDataTransformer implements DataTransformerInterface
|
||||
);
|
||||
}
|
||||
|
||||
public function transform($value)
|
||||
public function transform($value): mixed
|
||||
{
|
||||
return $this->customFieldDefinition->deserialize(
|
||||
$value,
|
||||
|
@@ -54,7 +54,7 @@ class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function transform($customFieldsGroup)
|
||||
public function transform($customFieldsGroup): mixed
|
||||
{
|
||||
if (null === $customFieldsGroup) {
|
||||
return '';
|
||||
|
@@ -39,7 +39,7 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
|
||||
$this->customField = $customFieldsByLabel;
|
||||
}
|
||||
|
||||
public function reverseTransform($customFieldsArray)
|
||||
public function reverseTransform($customFieldsArray): mixed
|
||||
{
|
||||
/*
|
||||
echo "<br> - - 7 - <br>";
|
||||
@@ -101,7 +101,7 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
|
||||
return json_encode($customFieldsArrayRet, \JSON_THROW_ON_ERROR);
|
||||
}
|
||||
|
||||
public function transform($customFieldsJSON)
|
||||
public function transform($customFieldsJSON): mixed
|
||||
{
|
||||
echo $customFieldsJSON;
|
||||
|
||||
|
@@ -26,7 +26,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
*/
|
||||
abstract class PostTextExtension extends AbstractTypeExtension
|
||||
{
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
public function buildView(FormView $view, FormInterface $form, array $options): void
|
||||
{
|
||||
if (\array_key_exists('post_text', $options)) {
|
||||
// set the post text variable to the view
|
||||
@@ -34,7 +34,7 @@ abstract class PostTextExtension extends AbstractTypeExtension
|
||||
}
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefined(['post_text']);
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ class ChoiceWithOtherType extends AbstractType
|
||||
/** (non-PHPdoc).
|
||||
* @see \Symfony\Component\Form\AbstractType::buildForm()
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
// add an 'other' entry in choices array
|
||||
$options['choices'][$this->otherValueLabel] = '_other';
|
||||
@@ -44,7 +44,7 @@ class ChoiceWithOtherType extends AbstractType
|
||||
/** (non-PHPdoc).
|
||||
* @see \Symfony\Component\Form\AbstractType::configureOptions()
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver
|
||||
->setRequired(['choices'])
|
||||
|
@@ -24,7 +24,7 @@ class ChoicesListType extends AbstractType
|
||||
/** (non-PHPdoc).
|
||||
* @see \Symfony\Component\Form\AbstractType::buildForm()
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder->add('name', TranslatableStringFormType::class)
|
||||
->add('active', CheckboxType::class, [
|
||||
@@ -52,7 +52,7 @@ class ChoicesListType extends AbstractType
|
||||
/**
|
||||
* @see \Symfony\Component\Form\FormTypeInterface::getName()
|
||||
*/
|
||||
public function getBlockPrefix()
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'cf_choices_list';
|
||||
}
|
||||
|
@@ -16,12 +16,12 @@ use Symfony\Component\Form\Extension\Core\Type\CollectionType;
|
||||
|
||||
class ChoicesType extends AbstractType
|
||||
{
|
||||
public function getBlockPrefix()
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'cf_choices';
|
||||
}
|
||||
|
||||
public function getParent()
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return CollectionType::class;
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ class CustomFieldType extends AbstractType
|
||||
$this->customFieldCompiler = $compiler;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
foreach ($options['group']->getActiveCustomFields() as $cf) {
|
||||
$this->customFieldCompiler
|
||||
@@ -39,7 +39,7 @@ class CustomFieldType extends AbstractType
|
||||
}
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver
|
||||
->setRequired(['group'])
|
||||
|
@@ -16,9 +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): void {}
|
||||
|
||||
public function getBlockPrefix()
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'custom_field_title';
|
||||
}
|
||||
|
@@ -52,7 +52,7 @@ class LinkedCustomFieldsType extends AbstractType
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function appendChoice(FormEvent $event)
|
||||
public function appendChoice(FormEvent $event): void
|
||||
{
|
||||
$rootForm = $this->getRootForm($event->getForm());
|
||||
$group = $rootForm->getData();
|
||||
@@ -80,7 +80,7 @@ class LinkedCustomFieldsType extends AbstractType
|
||||
);
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$this->choiceName = $builder->getName();
|
||||
$this->options = $options;
|
||||
@@ -91,12 +91,12 @@ class LinkedCustomFieldsType extends AbstractType
|
||||
);
|
||||
}
|
||||
|
||||
public function getBlockPrefix()
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'custom_fields_group_linked_custom_fields';
|
||||
}
|
||||
|
||||
public function getParent()
|
||||
public function getParent(): ?string
|
||||
{
|
||||
return ChoiceType::class;
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||
$this->authorizationChecker = $authorizationChecker;
|
||||
}
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters): void
|
||||
{
|
||||
if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) {
|
||||
return;
|
||||
|
@@ -47,7 +47,7 @@ class CustomFieldProvider implements ContainerAwareInterface
|
||||
* @param type $type The type of the service (that is used in the form to
|
||||
* add this type)
|
||||
*/
|
||||
public function addCustomField($serviceName, $type)
|
||||
public function addCustomField($serviceName, $type): void
|
||||
{
|
||||
$this->servicesByType[$type] = $serviceName;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ class CustomFieldProvider implements ContainerAwareInterface
|
||||
*
|
||||
* @return array array of the known custom fields indexed by the type
|
||||
*/
|
||||
public function getAllFields()
|
||||
public function getAllFields(): array
|
||||
{
|
||||
return $this->servicesByType;
|
||||
}
|
||||
@@ -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): void
|
||||
{
|
||||
if (null === $container) {
|
||||
throw new \LogicException('container should not be null');
|
||||
|
@@ -13,12 +13,12 @@ namespace Chill\CustomFieldsBundle\Service;
|
||||
|
||||
class CustomFieldsHelperException extends \Exception
|
||||
{
|
||||
public static function customFieldsGroupNotFound($entity)
|
||||
public static function customFieldsGroupNotFound($entity): \Chill\CustomFieldsBundle\Service\CustomFieldsHelperException
|
||||
{
|
||||
return new CustomFieldsHelperException("The customFieldsGroups associated with {$entity} are not found");
|
||||
}
|
||||
|
||||
public static function slugIsMissing()
|
||||
public static function slugIsMissing(): \Chill\CustomFieldsBundle\Service\CustomFieldsHelperException
|
||||
{
|
||||
return new CustomFieldsHelperException('The slug is missing');
|
||||
}
|
||||
|
@@ -78,7 +78,7 @@ class CustomFieldRenderingTwig extends AbstractExtension
|
||||
*
|
||||
* @return string HTML representation of the custom field label
|
||||
*/
|
||||
public function renderLabel(Environment $env, CustomField $customField, array $params = [])
|
||||
public function renderLabel(Environment $env, CustomField $customField, array $params = []): string
|
||||
{
|
||||
$resolvedParams = array_merge($this->defaultParams, $params);
|
||||
|
||||
|
@@ -80,7 +80,7 @@ final class CustomFieldsGroupRenderingTwig extends AbstractExtension
|
||||
* @return string HTML representation of the custom field group value, as described in
|
||||
* the CustomFieldInterface. Is HTML safe
|
||||
*/
|
||||
public function renderWidget(Environment $env, array $fields, $customFielsGroup, $documentType = 'html', array $params = [])
|
||||
public function renderWidget(Environment $env, array $fields, $customFielsGroup, $documentType = 'html', array $params = []): string
|
||||
{
|
||||
$resolvedParams = array_merge($this->defaultParams, $params);
|
||||
|
||||
|
@@ -28,7 +28,7 @@ final class ConfigCustomizablesEntitiesTest extends KernelTestCase
|
||||
*
|
||||
* @internal use a custom config environment
|
||||
*/
|
||||
public function testNotEmptyConfig()
|
||||
public function testNotEmptyConfig(): void
|
||||
{
|
||||
self::bootKernel(['environment' => 'test_customizable_entities_test_not_empty_config']);
|
||||
$customizableEntities = self::$kernel->getContainer()
|
||||
@@ -51,7 +51,7 @@ final class ConfigCustomizablesEntitiesTest extends KernelTestCase
|
||||
* In this case, parameter 'chill_custom_fields.customizables_entities'
|
||||
* should be an empty array in container
|
||||
*/
|
||||
public function testNotPresentInConfig()
|
||||
public function testNotPresentInConfig(): void
|
||||
{
|
||||
self::bootKernel(['environment' => 'test']);
|
||||
$customizableEntities = self::$kernel->getContainer()
|
||||
|
@@ -24,7 +24,7 @@ final class CustomFieldsGroupControllerTest extends WebTestCase
|
||||
/**
|
||||
* @doesNotPerformAssertions
|
||||
*/
|
||||
public function testCompleteScenario()
|
||||
public function testCompleteScenario(): void
|
||||
{
|
||||
self::bootKernel(['environment' => 'test_customizable_entities_test_not_empty_config']);
|
||||
// Create a new client to browse the application
|
||||
@@ -40,7 +40,7 @@ final class CustomFieldsGroupControllerTest extends WebTestCase
|
||||
$this->editCustomFieldsGroup($client);
|
||||
}
|
||||
|
||||
private function createCustomFieldsGroup(Client &$client)
|
||||
private function createCustomFieldsGroup(Client &$client): void
|
||||
{
|
||||
// Create a new entry in the database
|
||||
$crawler = $client->request('GET', '/fr/admin/customfieldsgroup/');
|
||||
@@ -71,7 +71,7 @@ final class CustomFieldsGroupControllerTest extends WebTestCase
|
||||
);
|
||||
}
|
||||
|
||||
private function editCustomFieldsGroup(Client $client)
|
||||
private function editCustomFieldsGroup(Client $client): void
|
||||
{
|
||||
$crawler = $client->request('GET', '/fr/admin/customfieldsgroup/');
|
||||
$links = $crawler->selectLink('Modifier');
|
||||
|
@@ -29,7 +29,7 @@ trait CustomFieldTestHelper
|
||||
*
|
||||
* @return Crawler
|
||||
*/
|
||||
public function getCrawlerForField(CustomField $field, $locale = 'en')
|
||||
public function getCrawlerForField(CustomField $field, $locale = 'en'): \Symfony\Component\DomCrawler\Crawler
|
||||
{
|
||||
$kernel = static::$kernel;
|
||||
|
||||
|
@@ -133,7 +133,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase
|
||||
*
|
||||
* @dataProvider serializedRepresentationDataProvider
|
||||
*/
|
||||
public function testDeserializeMultipleChoiceWithOther($data)
|
||||
public function testDeserializeMultipleChoiceWithOther($data): void
|
||||
{
|
||||
$customField = $this->generateCustomField([
|
||||
CustomFieldChoice::ALLOW_OTHER => true,
|
||||
@@ -156,7 +156,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase
|
||||
* - the case when the selected value is `_other`
|
||||
* - result is null
|
||||
*/
|
||||
public function testDeserializeMultipleChoiceWithOtherOtherCases()
|
||||
public function testDeserializeMultipleChoiceWithOtherOtherCases(): void
|
||||
{
|
||||
$customField = $this->generateCustomField([
|
||||
CustomFieldChoice::ALLOW_OTHER => true,
|
||||
@@ -219,7 +219,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase
|
||||
*
|
||||
* @dataProvider serializedRepresentationDataProvider
|
||||
*/
|
||||
public function testDeserializeMultipleChoiceWithoutOther($data)
|
||||
public function testDeserializeMultipleChoiceWithoutOther($data): void
|
||||
{
|
||||
$customField = $this->generateCustomField([
|
||||
CustomFieldChoice::ALLOW_OTHER => false,
|
||||
@@ -238,7 +238,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase
|
||||
* Covered cases :
|
||||
* - NULL values
|
||||
*/
|
||||
public function testDeserializeMultipleChoiceWithoutOtherOtherCases()
|
||||
public function testDeserializeMultipleChoiceWithoutOtherOtherCases(): void
|
||||
{
|
||||
$customField = $this->generateCustomField([
|
||||
CustomFieldChoice::ALLOW_OTHER => false,
|
||||
@@ -280,7 +280,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase
|
||||
*
|
||||
* @dataProvider serializedRepresentationDataProvider
|
||||
*/
|
||||
public function testDeserializeSingleChoiceWithOther($data)
|
||||
public function testDeserializeSingleChoiceWithOther($data): void
|
||||
{
|
||||
$customField = $this->generateCustomField([
|
||||
CustomFieldChoice::ALLOW_OTHER => true,
|
||||
@@ -298,7 +298,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase
|
||||
* - Test if the selected value is '_other
|
||||
* - Test with null data
|
||||
*/
|
||||
public function testDeserializeSingleChoiceWithOtherOtherCases()
|
||||
public function testDeserializeSingleChoiceWithOtherOtherCases(): void
|
||||
{
|
||||
$customField = $this->generateCustomField([
|
||||
CustomFieldChoice::ALLOW_OTHER => true,
|
||||
@@ -359,7 +359,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase
|
||||
*
|
||||
* @dataProvider serializedRepresentationDataProvider
|
||||
*/
|
||||
public function testDeserializeSingleChoiceWithoutOther($data)
|
||||
public function testDeserializeSingleChoiceWithoutOther($data): void
|
||||
{
|
||||
$customField = $this->generateCustomField([
|
||||
CustomFieldChoice::ALLOW_OTHER => false,
|
||||
@@ -371,7 +371,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase
|
||||
$this->assertSame('my-value', $deserialized);
|
||||
}
|
||||
|
||||
public function testDeserializeSingleChoiceWithoutOtherDataIsNull()
|
||||
public function testDeserializeSingleChoiceWithoutOtherDataIsNull(): void
|
||||
{
|
||||
$customField = $this->generateCustomField([
|
||||
CustomFieldChoice::ALLOW_OTHER => false,
|
||||
@@ -400,7 +400,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase
|
||||
/**
|
||||
* @dataProvider emptyDataProvider
|
||||
*/
|
||||
public function testIsEmptyValueEmpty(mixed $data)
|
||||
public function testIsEmptyValueEmpty(mixed $data): void
|
||||
{
|
||||
$customField = $this->generateCustomField([
|
||||
CustomFieldChoice::ALLOW_OTHER => false,
|
||||
@@ -422,7 +422,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase
|
||||
*
|
||||
* @dataProvider serializedRepresentationDataProvider
|
||||
*/
|
||||
public function testIsEmptyValueNotEmpty(mixed $data)
|
||||
public function testIsEmptyValueNotEmpty(mixed $data): void
|
||||
{
|
||||
$customField = $this->generateCustomField([
|
||||
CustomFieldChoice::ALLOW_OTHER => false,
|
||||
|
@@ -52,7 +52,7 @@ final class CustomFieldsNumberTest extends \Symfony\Bundle\FrameworkBundle\Test\
|
||||
->push($request);
|
||||
}
|
||||
|
||||
public function testCreateInvalidFormValueGreaterThanMaximum()
|
||||
public function testCreateInvalidFormValueGreaterThanMaximum(): void
|
||||
{
|
||||
$cf = $this->createCustomFieldNumber([
|
||||
'min' => null,
|
||||
@@ -72,7 +72,7 @@ final class CustomFieldsNumberTest extends \Symfony\Bundle\FrameworkBundle\Test\
|
||||
$this->assertEquals(1, \count($form['default']->getErrors()));
|
||||
}
|
||||
|
||||
public function testCreateInvalidFormValueLowerThanMinimum()
|
||||
public function testCreateInvalidFormValueLowerThanMinimum(): void
|
||||
{
|
||||
$cf = $this->createCustomFieldNumber([
|
||||
'min' => 1000,
|
||||
@@ -92,7 +92,7 @@ final class CustomFieldsNumberTest extends \Symfony\Bundle\FrameworkBundle\Test\
|
||||
$this->assertEquals(1, \count($form['default']->getErrors()));
|
||||
}
|
||||
|
||||
public function testCreateValidForm()
|
||||
public function testCreateValidForm(): void
|
||||
{
|
||||
$cf = $this->createCustomFieldNumber([
|
||||
'min' => null,
|
||||
@@ -111,7 +111,7 @@ final class CustomFieldsNumberTest extends \Symfony\Bundle\FrameworkBundle\Test\
|
||||
$this->assertEquals(10, $form['default']->getData());
|
||||
}
|
||||
|
||||
public function testRequiredFieldIsFalse()
|
||||
public function testRequiredFieldIsFalse(): void
|
||||
{
|
||||
$cf = $this->createCustomFieldNumber([
|
||||
'min' => 1000,
|
||||
@@ -136,7 +136,7 @@ final class CustomFieldsNumberTest extends \Symfony\Bundle\FrameworkBundle\Test\
|
||||
);
|
||||
}
|
||||
|
||||
public function testRequiredFieldIsTrue()
|
||||
public function testRequiredFieldIsTrue(): void
|
||||
{
|
||||
$cf = $this->createCustomFieldNumber([
|
||||
'min' => 1000,
|
||||
|
@@ -34,7 +34,7 @@ final class CustomFieldsTextTest extends WebTestCase
|
||||
->get('chill.custom_field.provider');
|
||||
}
|
||||
|
||||
public function testCustomFieldsTextExists()
|
||||
public function testCustomFieldsTextExists(): void
|
||||
{
|
||||
$customField = $this->customFieldProvider->getCustomFieldByType('text');
|
||||
|
||||
@@ -48,7 +48,7 @@ final class CustomFieldsTextTest extends WebTestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testFormTextNew()
|
||||
public function testFormTextNew(): void
|
||||
{
|
||||
$client = self::createClient();
|
||||
|
||||
@@ -60,7 +60,7 @@ final class CustomFieldsTextTest extends WebTestCase
|
||||
$this->assertTrue($form->has('custom_field_choice[options][maxLength]'));
|
||||
}
|
||||
|
||||
public function testPublicFormRenderingLengthLessThan256()
|
||||
public function testPublicFormRenderingLengthLessThan256(): void
|
||||
{
|
||||
$customField = new CustomField();
|
||||
$customField->setType('text')
|
||||
@@ -76,7 +76,7 @@ final class CustomFieldsTextTest extends WebTestCase
|
||||
$this->assertCount(1, $crawler->filter("label:contains('my label')"));
|
||||
}
|
||||
|
||||
public function testPublicFormRenderingLengthMoreThan25()
|
||||
public function testPublicFormRenderingLengthMoreThan25(): void
|
||||
{
|
||||
$customField = new CustomField();
|
||||
$customField->setType('text')
|
||||
|
@@ -38,7 +38,7 @@ final class PostTextIntegerExtensionTest extends KernelTestCase
|
||||
->createBuilder('form', null);
|
||||
}
|
||||
|
||||
public function testCreateView()
|
||||
public function testCreateView(): void
|
||||
{
|
||||
$form = $this->formBuilder->add('test', IntegerType::class, [
|
||||
'post_text' => 'my text',
|
||||
|
@@ -38,7 +38,7 @@ final class PostTextNumberExtensionTest extends KernelTestCase
|
||||
->createBuilder('form', null);
|
||||
}
|
||||
|
||||
public function testCreateView()
|
||||
public function testCreateView(): void
|
||||
{
|
||||
$form = $this->formBuilder->add('test', NumberType::class, [
|
||||
'post_text' => 'my text',
|
||||
|
@@ -23,7 +23,7 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
*/
|
||||
final class RoutingLoaderTest extends WebTestCase
|
||||
{
|
||||
public function testRoutesAreLoaded()
|
||||
public function testRoutesAreLoaded(): void
|
||||
{
|
||||
$client = self::createClient();
|
||||
|
||||
|
@@ -43,7 +43,7 @@ final class CustomFieldsHelperTest extends KernelTestCase
|
||||
->setType('text');
|
||||
}
|
||||
|
||||
public function testIsEmptyValue()
|
||||
public function testIsEmptyValue(): void
|
||||
{
|
||||
// not empty value
|
||||
$data = [
|
||||
@@ -60,7 +60,7 @@ final class CustomFieldsHelperTest extends KernelTestCase
|
||||
$this->assertTrue($this->cfHelper->isEmptyValue($data, $this->randomCFText));
|
||||
}
|
||||
|
||||
public function testRenderCustomField()
|
||||
public function testRenderCustomField(): void
|
||||
{
|
||||
$data = [
|
||||
$this->randomCFText->getSlug() => 'Sample text',
|
||||
|
@@ -45,7 +45,7 @@ final class CustomFieldRenderingTwigTest extends KernelTestCase
|
||||
->push($request->reveal());
|
||||
}
|
||||
|
||||
public function testIsEmpty()
|
||||
public function testIsEmpty(): void
|
||||
{
|
||||
$cf = $this->getSimpleCustomFieldText();
|
||||
|
||||
@@ -68,7 +68,7 @@ final class CustomFieldRenderingTwigTest extends KernelTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function testLabelRendering()
|
||||
public function testLabelRendering(): void
|
||||
{
|
||||
$cf = $this->getSimpleCustomFieldText();
|
||||
|
||||
@@ -81,7 +81,7 @@ final class CustomFieldRenderingTwigTest extends KernelTestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testWidgetRendering()
|
||||
public function testWidgetRendering(): void
|
||||
{
|
||||
$cf = $this->getSimpleCustomFieldText();
|
||||
$fields = [
|
||||
|
@@ -47,7 +47,7 @@ final class CustomFieldsGroupRenderingTwigTest extends KernelTestCase
|
||||
->push($request->reveal());
|
||||
}
|
||||
|
||||
public function testRenderingWidget()
|
||||
public function testRenderingWidget(): void
|
||||
{
|
||||
$cfGroup = $this->getCustomFieldsGroup();
|
||||
|
||||
@@ -62,7 +62,7 @@ final class CustomFieldsGroupRenderingTwigTest extends KernelTestCase
|
||||
$this->assertContains('Yes', $text);
|
||||
}
|
||||
|
||||
public function testRenderingWidgetDoNotShowEmpty()
|
||||
public function testRenderingWidgetDoNotShowEmpty(): void
|
||||
{
|
||||
$cfGroup = $this->getCustomFieldsGroup();
|
||||
$cfGroup->addCustomField($this->getSimpleCustomFieldText('empty', 'Do not answer'));
|
||||
|
Reference in New Issue
Block a user