mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -15,19 +15,11 @@ use Chill\CustomFieldsBundle\Entity\CustomField;
|
||||
use Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option;
|
||||
use Chill\CustomFieldsBundle\EntityRepository\CustomFieldLongChoice\OptionRepository;
|
||||
use Chill\CustomFieldsBundle\Form\DataTransformer\CustomFieldDataTransformer;
|
||||
use Chill\FamilyMembersBundle\Templating\Twig;
|
||||
use Chill\MainBundle\Form\Type\Select2ChoiceType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use LogicException;
|
||||
use Symfony\Bridge\Twig\TwigEngine;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
use Symfony\Component\Templating\EngineInterface;
|
||||
use function get_class;
|
||||
use function gettype;
|
||||
use function is_object;
|
||||
|
||||
class CustomFieldLongChoice extends AbstractCustomField
|
||||
{
|
||||
final public const KEY = 'key';
|
||||
@@ -46,7 +38,7 @@ class CustomFieldLongChoice extends AbstractCustomField
|
||||
false,
|
||||
true
|
||||
);
|
||||
//create a local copy of translatable string helper
|
||||
// create a local copy of translatable string helper
|
||||
$translatableStringHelper = $this->translatableStringHelper;
|
||||
$builder->add($customField->getSlug(), Select2ChoiceType::class, [
|
||||
'choices' => $entries,
|
||||
@@ -73,7 +65,7 @@ class CustomFieldLongChoice extends AbstractCustomField
|
||||
|
||||
public function buildOptionsForm(FormBuilderInterface $builder)
|
||||
{
|
||||
//create a selector between different keys
|
||||
// create a selector between different keys
|
||||
$keys = $this->optionRepository->getKeys();
|
||||
$choices = [];
|
||||
|
||||
@@ -105,7 +97,7 @@ class CustomFieldLongChoice extends AbstractCustomField
|
||||
{
|
||||
$option = $this->deserialize($value, $customField);
|
||||
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:choice_long.'
|
||||
. $documentType . '.twig';
|
||||
.$documentType.'.twig';
|
||||
|
||||
return $this->templating
|
||||
->render($template, [
|
||||
@@ -120,9 +112,7 @@ class CustomFieldLongChoice extends AbstractCustomField
|
||||
}
|
||||
|
||||
if (!$value instanceof Option) {
|
||||
throw new LogicException('the value should be an instance of '
|
||||
. 'Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option, '
|
||||
. is_object($value) ? $value::class : gettype($value) . ' given');
|
||||
throw new \LogicException('the value should be an instance of Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option, '.\is_object($value) ? $value::class : \gettype($value).' given');
|
||||
}
|
||||
|
||||
// we place the id in array, to allow in the future multiple select
|
||||
|
Reference in New Issue
Block a user