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

@@ -22,6 +22,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use function array_merge;
abstract class AbstractCRUDController extends AbstractController

View File

@@ -23,6 +23,7 @@ use Symfony\Component\Serializer\Exception\NotEncodableValueException;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Component\Validator\ConstraintViolationListInterface;
use function array_merge;
use function ucfirst;

View File

@@ -28,6 +28,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Component\Translation\TranslatorInterface;
use function array_key_exists;
use function array_merge;

View File

@@ -13,6 +13,7 @@ namespace Chill\MainBundle\CRUD\Resolver;
use Doctrine\ORM\EntityManagerInterface;
use LogicException;
use function array_key_exists;
use function strtoupper;

View File

@@ -16,11 +16,13 @@ use Symfony\Component\Config\Loader\Loader;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use function array_filter;
use function array_keys;
use function array_search;
use function count;
use function in_array;
use const ARRAY_FILTER_USE_BOTH;
class CRUDRoutesLoader extends Loader
@@ -139,7 +141,9 @@ class CRUDRoutesLoader extends Loader
$methods = array_keys(array_filter(
$action['methods'],
static function ($value, $key) { return $value; },
static function ($value, $key) {
return $value;
},
ARRAY_FILTER_USE_BOTH
));

View File

@@ -32,6 +32,7 @@ use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
use Symfony\Component\Validator\ConstraintViolationListInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use function array_key_exists;
use function array_keys;
use function array_merge;
@@ -308,8 +309,10 @@ class ChillImportUsersCommand extends Command
$permissionGroupsByName = [];
foreach ($this->em->getRepository(PermissionsGroup::class)
->findAll() as $permissionGroup) {
foreach (
$this->em->getRepository(PermissionsGroup::class)
->findAll() as $permissionGroup
) {
$permissionGroupsByName[$permissionGroup->getName()] = $permissionGroup;
}
@@ -338,11 +341,13 @@ class ChillImportUsersCommand extends Command
$this->tempOutput->writeln('You have chosen ' . implode(', ', $keys));
if ($helper->ask(
$this->tempInput,
$this->tempOutput,
new ConfirmationQuestion('Are you sure ?', true)
)) {
if (
$helper->ask(
$this->tempInput,
$this->tempOutput,
new ConfirmationQuestion('Are you sure ?', true)
)
) {
foreach ($keys as $key) {
$this->permissionGroups[$alias][] = $permissionGroupsByName[$key];
}

View File

@@ -26,6 +26,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use function array_key_exists;
use function array_merge;
use function in_array;
@@ -141,8 +142,10 @@ class ChillUserSendRenewPasswordCodeCommand extends Command
$headers = $reader->getHeader();
if (false === in_array('username', $headers, true)
&& false === in_array('email', $headers, true)) {
if (
false === in_array('username', $headers, true)
&& false === in_array('email', $headers, true)
) {
throw new InvalidArgumentException('The csv file does not have an '
. 'username or email header');
}

View File

@@ -17,6 +17,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Intl\Intl;
use function in_array;
/*

View File

@@ -24,6 +24,7 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use function count;
class LoadPostalCodesCommand extends Command
@@ -88,13 +89,15 @@ class LoadPostalCodesCommand extends Command
$num = 0;
$line = 0;
while (false !== ($row = fgetcsv(
$csv,
0,
$input->getOption('delimiter'),
$input->getOption('enclosure'),
$input->getOption('escape')
))) {
while (
false !== ($row = fgetcsv(
$csv,
0,
$input->getOption('delimiter'),
$input->getOption('enclosure'),
$input->getOption('escape')
))
) {
try {
$this->addPostalCode($row, $output);
++$num;

View File

@@ -23,6 +23,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use function trim;
final class AddressReferenceAPIController extends ApiController

View File

@@ -12,7 +12,6 @@ declare(strict_types=1);
namespace Chill\MainBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
class AdminController extends AbstractController

View File

@@ -14,7 +14,6 @@ namespace Chill\MainBundle\Controller;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Form\CenterType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;

View File

@@ -25,6 +25,7 @@ use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Translation\TranslatorInterface;
use function count;
use function serialize;
use function unserialize;
@@ -484,11 +485,13 @@ class ExportController extends AbstractController
$data = $form->getData();
// check ACL
if ($exportManager->isGrantedForElement(
$export,
null,
$exportManager->getPickedCenters($data['centers'])
) === false) {
if (
$exportManager->isGrantedForElement(
$export,
null,
$exportManager->getPickedCenters($data['centers'])
) === false
) {
throw $this->createAccessDeniedException('you do not have '
. 'access to this export for those centers');
}

View File

@@ -18,6 +18,7 @@ use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use function array_key_exists;
use function json_decode;

View File

@@ -26,6 +26,7 @@ use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Security\Core\Role\RoleHierarchy;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use function array_key_exists;
/**

View File

@@ -18,6 +18,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use function array_map;
/**
@@ -54,12 +55,12 @@ class PostalCodeController extends AbstractController
->createQuery(
sprintf(
'SELECT p.id AS id, p.name AS name, p.code AS code, '
. 'country.name AS country_name, '
. 'country.countryCode AS country_code '
. 'FROM %s p '
. 'JOIN p.country country '
. 'WHERE LOWER(p.name) LIKE LOWER(:pattern) OR LOWER(p.code) LIKE LOWER(:pattern) '
. 'ORDER BY code',
. 'country.name AS country_name, '
. 'country.countryCode AS country_code '
. 'FROM %s p '
. 'JOIN p.country country '
. 'WHERE LOWER(p.name) LIKE LOWER(:pattern) OR LOWER(p.code) LIKE LOWER(:pattern) '
. 'ORDER BY code',
PostalCode::class
)
)

View File

@@ -27,6 +27,7 @@ use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Contracts\Translation\TranslatorInterface;
use function count;
use function key;
use function reset;

View File

@@ -17,6 +17,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Security;
use function count;
class TimelineCenterController extends AbstractController

View File

@@ -18,6 +18,7 @@ use Doctrine\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Intl\Intl;
use function in_array;
/**
@@ -51,7 +52,7 @@ class LoadLanguages extends AbstractFixture implements ContainerAwareInterface,
if (
!in_array($code, $this->regionalVersionToInclude, true)
&& !in_array($code, $this->ancientToExclude, true)
) {
) {
$lang = (new Language())
->setId($code)
->setName($this->prepareName($code));

View File

@@ -17,6 +17,7 @@ use Chill\MainBundle\Entity\PostalCode;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use function strtolower;
use function ucwords;

View File

@@ -20,6 +20,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Security\Core\Encoder\EncoderFactory;
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
use function str_replace;
/**

View File

@@ -44,6 +44,7 @@ use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use function count;
/**

View File

@@ -15,6 +15,7 @@ use LogicException;
use RuntimeException;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use function count;
/**

View File

@@ -21,6 +21,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
use UnexpectedValueException;
use function array_key_exists;
use function count;
use function get_class;
@@ -373,8 +374,10 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface
private function isPlaceAllowedForWidget($place, $widgetAlias, ContainerBuilder $container)
{
if ($this->widgetServices[$widgetAlias] instanceof WidgetFactoryInterface) {
if (in_array($place, $this->widgetServices[$widgetAlias]
->getAllowedPlaces(), true)) {
if (
in_array($place, $this->widgetServices[$widgetAlias]
->getAllowedPlaces(), true)
) {
return true;
}
} else {

View File

@@ -41,8 +41,10 @@ class TrackCreateUpdateSubscriber implements EventSubscriber
{
$object = $args->getObject();
if ($object instanceof TrackCreationInterface
&& $this->security->getUser() instanceof User) {
if (
$object instanceof TrackCreationInterface
&& $this->security->getUser() instanceof User
) {
$object->setCreatedBy($this->security->getUser());
$object->setCreatedAt(new DateTimeImmutable('now'));
}
@@ -59,8 +61,10 @@ class TrackCreateUpdateSubscriber implements EventSubscriber
protected function onUpdate(object $object): void
{
if ($object instanceof TrackUpdateInterface
&& $this->security->getUser() instanceof User) {
if (
$object instanceof TrackUpdateInterface
&& $this->security->getUser() instanceof User
) {
$object->setUpdatedBy($this->security->getUser());
$object->setUpdatedAt(new DateTimeImmutable('now'));
}

View File

@@ -13,6 +13,7 @@ namespace Chill\MainBundle\Doctrine\Model;
use Exception;
use JsonSerializable;
use function json_encode;
class Point implements JsonSerializable

View File

@@ -16,6 +16,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\DBAL\Types\DateIntervalType;
use Exception;
use function count;
use function current;
use function preg_match;

View File

@@ -18,6 +18,7 @@ use RuntimeException;
use Symfony\Component\Security\Core\User\AdvancedUserInterface;
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use function in_array;
/**

View File

@@ -26,6 +26,7 @@ use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use UnexpectedValueException;
use function array_key_exists;
use function count;
use function get_class;
@@ -122,8 +123,10 @@ class ExportManager
public function &getFiltersApplyingOn(ExportInterface $export, ?array $centers = null)
{
foreach ($this->filters as $alias => $filter) {
if (in_array($filter->applyOn(), $export->supportsModifiers(), true)
&& $this->isGrantedForElement($filter, $export, $centers)) {
if (
in_array($filter->applyOn(), $export->supportsModifiers(), true)
&& $this->isGrantedForElement($filter, $export, $centers)
) {
yield $alias => $filter;
}
}
@@ -143,8 +146,10 @@ class ExportManager
}
foreach ($this->aggregators as $alias => $aggregator) {
if (in_array($aggregator->applyOn(), $export->supportsModifiers(), true)
&& $this->isGrantedForElement($aggregator, $export, $centers)) {
if (
in_array($aggregator->applyOn(), $export->supportsModifiers(), true)
&& $this->isGrantedForElement($aggregator, $export, $centers)
) {
yield $alias => $aggregator;
}
}

View File

@@ -20,6 +20,7 @@ use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Contracts\Translation\TranslatorInterface;
use function array_key_exists;
use function array_slice;
use function call_user_func;

View File

@@ -19,6 +19,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Translation\TranslatorInterface;
use function array_key_exists;
use function array_keys;
use function array_map;
@@ -198,7 +199,9 @@ class CSVListFormatter implements FormatterInterface
foreach ($keys as $key) {
// get an array with all values for this key if possible
$values = array_map(static function ($v) use ($key) { return $v[$key]; }, $this->result);
$values = array_map(static function ($v) use ($key) {
return $v[$key];
}, $this->result);
// store the label in the labelsCache property
$this->labelsCache[$key] = $export->getLabels($key, $values, $this->exportData);
}

View File

@@ -18,6 +18,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Translation\TranslatorInterface;
use function array_map;
use function count;
@@ -186,7 +187,9 @@ class CSVPivotedListFormatter implements FormatterInterface
foreach ($keys as $key) {
// get an array with all values for this key if possible
$values = array_map(static function ($v) use ($key) { return $v[$key]; }, $this->result);
$values = array_map(static function ($v) use ($key) {
return $v[$key];
}, $this->result);
// store the label in the labelsCache property
$this->labelsCache[$key] = $export->getLabels($key, $values, $this->exportData);
}

View File

@@ -20,6 +20,7 @@ use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Translation\TranslatorInterface;
use function array_map;
use function array_merge;
use function array_multisort;

View File

@@ -24,6 +24,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Translation\TranslatorInterface;
use function array_key_exists;
use function array_keys;
use function array_map;
@@ -257,7 +258,9 @@ class SpreadsheetListFormatter implements FormatterInterface
foreach ($keys as $key) {
// get an array with all values for this key if possible
$values = array_map(static function ($v) use ($key) { return $v[$key]; }, $this->result);
$values = array_map(static function ($v) use ($key) {
return $v[$key];
}, $this->result);
// store the label in the labelsCache property
$this->labelsCache[$key] = $export->getLabels($key, $values, $this->exportData);
}

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

View File

@@ -18,6 +18,7 @@ use Swift_Message;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Twig\Environment;
use function call_user_func;
/**

View File

@@ -123,11 +123,11 @@ class PaginatorFactory
{
return array_merge(
$this->router->getContext()->getParameters(),
// get the route parameters
// get the route parameters
$this->requestStack
->getCurrentRequest()
->attributes->get('_route_params'),
// get the query parameters
// get the query parameters
$this->requestStack
->getCurrentRequest()->query->all()
);

View File

@@ -17,6 +17,7 @@ use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\ServerException;
use Psr\Cache\CacheItemPoolInterface;
use Psr\Log\LoggerInterface;
use function array_key_exists;
use function in_array;
use function json_decode;
@@ -58,13 +59,14 @@ class PhonenumberHelper
$this->logger = $logger;
$this->cachePool = $cachePool;
if (array_key_exists('twilio_sid', $config)
if (
array_key_exists('twilio_sid', $config)
&& !empty($config['twilio_sid'])
&& strlen($config['twilio_sid']) > 2
&& array_key_exists('twilio_secret', $config)
&& !empty($config['twilio_secret'])
&& strlen($config['twilio_secret']) > 2
) {
) {
$this->twilioClient = new Client([
'auth' => [$config['twilio_sid'], $config['twilio_secret']],
]);

View File

@@ -20,6 +20,7 @@ use Doctrine\ORM\Query\ResultSetMapping;
use Doctrine\ORM\Query\ResultSetMappingBuilder;
use Doctrine\Persistence\ObjectRepository;
use RuntimeException;
use function explode;
use function implode;
use function strtr;

View File

@@ -17,6 +17,7 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectRepository;
use function count;
final class UserRepository implements ObjectRepository

View File

@@ -16,6 +16,7 @@ use Knp\Menu\ItemInterface;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Translation\TranslatorInterface;
use function array_key_exists;
use function array_merge;
use function array_values;

View File

@@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\MainBundle\Search;
use DateTime;
use function array_key_exists;
use function strpos;

View File

@@ -14,6 +14,7 @@ namespace Chill\MainBundle\Search\Entity;
use Chill\MainBundle\Repository\UserRepository;
use Chill\MainBundle\Search\SearchApiInterface;
use Chill\MainBundle\Search\SearchApiQuery;
use function array_map;
use function in_array;

View File

@@ -16,6 +16,7 @@ use Chill\MainBundle\Serializer\Model\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query\ResultSetMappingBuilder;
use function array_map;
use function array_merge;
use function count;

View File

@@ -13,6 +13,7 @@ namespace Chill\MainBundle\Search;
use RuntimeException;
use Throwable;
use function implode;
class SearchApiNoQueryException extends RuntimeException

View File

@@ -276,8 +276,10 @@ class SearchProvider
//remove from search pattern
$this->mustBeExtracted[] = $matches[0][$key];
//strip parenthesis
if (mb_substr($match, 0, 1) === '"'
&& mb_substr($match, mb_strlen($match) - 1) === '"') {
if (
mb_substr($match, 0, 1) === '"'
&& mb_substr($match, mb_strlen($match) - 1) === '"'
) {
$match = trim(mb_substr($match, 1, mb_strlen($match) - 2));
}
$terms[$matches[1][$key]] = $match;

View File

@@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\MainBundle\Search\Utils;
use DateTimeImmutable;
use function preg_match_all;
use function strtr;
use function trim;

View File

@@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\MainBundle\Search\Utils;
use LogicException;
use function count;
use function implode;
use function preg_match;

View File

@@ -13,8 +13,10 @@ namespace Chill\MainBundle\Security\Authorization;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use function get_class;
use function in_array;
use const E_USER_DEPRECATED;
/**

View File

@@ -23,6 +23,7 @@ use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Security\Core\User\UserInterface;
use Traversable;
use UnexpectedValueException;
use function array_merge;
use function get_class;

View File

@@ -13,6 +13,7 @@ namespace Chill\MainBundle\Security\Authorization;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface;
use function in_array;
final class DefaultVoterHelper implements VoterHelperInterface

View File

@@ -14,6 +14,7 @@ namespace Chill\MainBundle\Security;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Security\Core\Role\RoleHierarchyInterface;
use function array_keys;
use function in_array;

View File

@@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\User;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
use function in_array;
class PasswordRecoverVoter extends Voter

View File

@@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Notification\Mailer;
use DateTimeInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use function array_merge;
class RecoverPasswordHelper

View File

@@ -17,6 +17,7 @@ use DateTimeImmutable;
use DateTimeInterface;
use Psr\Log\LoggerInterface;
use UnexpectedValueException;
use function bin2hex;
use function hash;
use function hex2bin;

View File

@@ -13,6 +13,7 @@ namespace Chill\MainBundle\Security\Resolver;
use Chill\MainBundle\Entity\Center;
use UnexpectedValueException;
use function get_class;
use function is_array;

View File

@@ -17,6 +17,7 @@ use Symfony\Component\Serializer\Exception\InvalidArgumentException;
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use function array_key_exists;
class CenterNormalizer implements DenormalizerInterface, NormalizerInterface

View File

@@ -20,6 +20,7 @@ use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use function array_key_exists;
use function is_array;

View File

@@ -16,6 +16,7 @@ use Symfony\Component\Serializer\Exception\RuntimeException;
use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
use function count;
use function implode;

View File

@@ -16,6 +16,7 @@ use Doctrine\ORM\Mapping\ClassMetadata;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use function array_key_exists;
use function count;
use function is_array;

View File

@@ -13,8 +13,8 @@ namespace Chill\MainBundle\Serializer\Normalizer;
use Chill\MainBundle\Doctrine\Model\Point;
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use function count;
use function is_array;

View File

@@ -13,7 +13,6 @@ namespace Chill\MainBundle\Templating;
use Parsedown;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
/**

View File

@@ -15,6 +15,7 @@ use DateTimeInterface;
use Twig\Environment;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
use function array_merge;
class ChillTwigHelper extends AbstractExtension

View File

@@ -13,6 +13,7 @@ namespace Chill\MainBundle\Templating\Entity;
use Chill\MainBundle\Entity\Address;
use Symfony\Component\Templating\EngineInterface;
use function array_merge;
use function strtr;

View File

@@ -14,6 +14,7 @@ namespace Chill\MainBundle\Templating\Entity;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Chill\MainBundle\Repository\UserRepository;
use Symfony\Component\Templating\EngineInterface;
use function array_merge;
class CommentRender extends AbstractChillEntityRender

View File

@@ -14,6 +14,7 @@ namespace Chill\MainBundle\Templating\Entity;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Symfony\Component\Templating\EngineInterface;
use function array_merge;
class UserRender implements ChillEntityRenderInterface

View File

@@ -15,6 +15,7 @@ use Chill\MainBundle\Form\Type\Listing\FilterOrderType;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use function array_merge;
use function count;

View File

@@ -55,11 +55,13 @@ class FilterOrderHelperBuilder
$helper->setSearchBox($this->searchBoxFields);
foreach ($this->checkboxes as $name => [
'choices' => $choices,
'default' => $default,
'trans' => $trans,
]) {
foreach (
$this->checkboxes as $name => [
'choices' => $choices,
'default' => $default,
'trans' => $trans,
]
) {
$helper->addCheckbox($name, $choices, $default, $trans);
}

View File

@@ -14,6 +14,7 @@ namespace Chill\MainBundle\Templating;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Contracts\Translation\TranslatorInterface;
use function array_key_exists;
final class TranslatableStringHelper implements TranslatableStringHelperInterface

View File

@@ -16,6 +16,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Twig\Environment;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
use function array_key_exists;
use function ksort;

View File

@@ -15,6 +15,7 @@ use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\QueryBuilder;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Traversable;
use function call_user_func;
use function count;
use function is_array;

View File

@@ -19,6 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Role\Role;
use Traversable;
use function call_user_func;
use function count;
use function is_array;

View File

@@ -14,6 +14,7 @@ namespace Chill\MainBundle\Test\Export;
use Doctrine\ORM\QueryBuilder;
use Exception;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use function count;
use function get_class;
use function is_array;

View File

@@ -18,6 +18,7 @@ use Doctrine\ORM\Query;
use Doctrine\ORM\Query\ResultSetMapping;
use LogicException;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use function array_key_exists;
use function is_string;
@@ -291,7 +292,7 @@ class TimelineBuilder implements ContainerAwareInterface
$data = $this->getTemplateData(
$result['type'],
$entitiesByType[$result['type']][$result['id']], //the entity
$context,
$context,
$args
);

View File

@@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\MainBundle\Util;
use UnexpectedValueException;
use function array_key_exists;
/**

View File

@@ -15,6 +15,7 @@ use DateTimeImmutable;
use DateTimeInterface;
use DateTimeZone;
use LogicException;
use function array_diff;
use function array_flip;
use function array_intersect_key;
@@ -24,6 +25,7 @@ use function array_unique;
use function array_values;
use function count;
use function ksort;
use const PHP_INT_MAX;
/**

View File

@@ -14,6 +14,7 @@ namespace Chill\MainBundle\Validator\Constraints\Entity;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
use function call_user_func;
class UserCircleConsistencyValidator extends ConstraintValidator

View File

@@ -16,6 +16,7 @@ use Doctrine\Migrations\AbstractMigration;
use Doctrine\ORM\Query\ResultSetMapping;
use RuntimeException;
use Symfony\Component\DependencyInjection\ContainerInterface;
use function count;
/**