cs: Fix code-style (using PHPCSFixer and PHPCS).

This commit is contained in:
Pol Dellaiera
2021-12-21 10:59:23 +01:00
parent b7360955f7
commit 8401ce2656
280 changed files with 742 additions and 319 deletions

View File

@@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\PostalCode;
use Chill\MainBundle\Repository\PostalCodeRepository;
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
use function call_user_func;
/**

View File

@@ -17,6 +17,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use function array_combine;
use function array_merge;
use function count;

View File

@@ -15,7 +15,6 @@ use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\PermissionsGroup;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

View File

@@ -16,10 +16,10 @@ use Chill\MainBundle\Security\RoleProvider;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use function in_array;
/**

View File

@@ -18,6 +18,7 @@ use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Traversable;
use function count;
class CenterTransformer implements DataTransformerInterface

View File

@@ -19,6 +19,7 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\GreaterThan;
use function array_diff;
use function array_values;
use function count;

View File

@@ -23,6 +23,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use function array_intersect;
use function array_key_exists;
use function array_merge;
@@ -85,7 +86,9 @@ class PickCenterType extends AbstractType
'query_builder' => static function (EntityRepository $er) use ($centers) {
$qb = $er->createQueryBuilder('c');
$ids = array_map(
static function (Center $el) { return $el->getId(); },
static function (Center $el) {
return $el->getId();
},
$centers
);
@@ -93,7 +96,9 @@ class PickCenterType extends AbstractType
},
'multiple' => true,
'expanded' => true,
'choice_label' => static function (Center $c) { return $c->getName(); },
'choice_label' => static function (Center $c) {
return $c->getName();
},
'data' => count($this->groupingCenters) > 0 ? null : $centers,
]);
@@ -122,8 +127,12 @@ class PickCenterType extends AbstractType
}
$builder->addModelTransformer(new CallbackTransformer(
function ($data) use ($centers) { return $this->transform($data, $centers); },
function ($data) use ($centers) { return $this->reverseTransform($data, $centers); }
function ($data) use ($centers) {
return $this->transform($data, $centers);
},
function ($data) use ($centers) {
return $this->reverseTransform($data, $centers);
}
));
}

View File

@@ -15,7 +15,6 @@ use Chill\MainBundle\Export\ExportManager;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**

View File

@@ -19,6 +19,7 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\HttpFoundation\RequestStack;
use function array_combine;
use function array_map;
use function count;

View File

@@ -20,6 +20,7 @@ use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Contracts\Translation\TranslatorInterface;
use function uniqid;
/**

View File

@@ -25,6 +25,7 @@ use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Security;
use function array_merge;
use function array_values;
use function count;
@@ -151,8 +152,10 @@ class PickCenterType extends AbstractType
$centers = [];
foreach ($scopes as $scope) {
foreach ($this->authorizationHelper
->getReachableCenters($this->security->getUser(), $role, $scope) as $center) {
foreach (
$this->authorizationHelper
->getReachableCenters($this->security->getUser(), $role, $scope) as $center
) {
$centers[spl_object_hash($center)] = $center;
}
}

View File

@@ -29,6 +29,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Security\Core\Security;
use function array_map;
use function count;

View File

@@ -19,6 +19,7 @@ use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\OptionsResolver\OptionsResolver;
use const SORT_FLAG_CASE;
use const SORT_STRING;

View File

@@ -19,6 +19,7 @@ use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\OptionsResolver\OptionsResolver;
use const SORT_FLAG_CASE;
use const SORT_STRING;

View File

@@ -19,6 +19,7 @@ use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Translation\Translator;
use function in_array;
class TranslatableStringFormType extends AbstractType