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

@@ -20,6 +20,7 @@ use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use function ctype_digit;
final class ChillPersonMoveCommand extends Command

View File

@@ -39,6 +39,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\FormFactoryInterface;
use function array_key_exists;
use function count;
use function file_get_contents;
@@ -46,6 +47,7 @@ use function get_class;
use function in_array;
use function is_array;
use function json_decode;
use const JSON_PRETTY_PRINT;
use const LC_TIME;
@@ -417,13 +419,15 @@ final class ImportPeopleFromCSVCommand extends Command
$line = $this->line = 1;
try {
while (false !== ($row = fgetcsv(
$csv,
$input->getOption('length'),
$input->getOption('delimiter'),
$input->getOption('enclosure'),
$input->getOption('escape')
))) {
while (
false !== ($row = fgetcsv(
$csv,
$input->getOption('length'),
$input->getOption('delimiter'),
$input->getOption('enclosure'),
$input->getOption('escape')
))
) {
$this->logger->debug('Processing line ' . $this->line);
if (1 === $line) {
@@ -450,8 +454,10 @@ final class ImportPeopleFromCSVCommand extends Command
$this->eventDispatcher->dispatch('chill_person.person_import', $event);
if ($this->input->getOption('force') === true
&& false === $event->skipPerson) {
if (
$this->input->getOption('force') === true
&& false === $event->skipPerson
) {
$this->em->persist($person);
}
@@ -602,8 +608,10 @@ final class ImportPeopleFromCSVCommand extends Command
->getResult();
if (count($postalCodes) >= 1) {
if ($postalCodes[0]->getCode() === $postalCode
&& $postalCodes[0]->getName() === $locality) {
if (
$postalCodes[0]->getCode() === $postalCode
&& $postalCodes[0]->getName() === $locality
) {
return $postalCodes[0];
}
}
@@ -625,7 +633,7 @@ final class ImportPeopleFromCSVCommand extends Command
$question = new ChoiceQuestion(
sprintf(
'Which postal code match the '
. 'name "%s" with postal code "%s" ? (default to "%s")',
. 'name "%s" with postal code "%s" ? (default to "%s")',
$locality,
$postalCode,
$names[0]
@@ -658,13 +666,15 @@ final class ImportPeopleFromCSVCommand extends Command
$csv = $this->openCSV();
// getting the first row
if (false !== ($row = fgetcsv(
$csv,
$input->getOption('length'),
$input->getOption('delimiter'),
$input->getOption('enclosure'),
$input->getOption('escape')
))) {
if (
false !== ($row = fgetcsv(
$csv,
$input->getOption('length'),
$input->getOption('delimiter'),
$input->getOption('enclosure'),
$input->getOption('escape')
))
) {
try {
$this->matchColumnToCustomField($row);
} finally {
@@ -863,7 +873,9 @@ final class ImportPeopleFromCSVCommand extends Command
if (!isset($this->cacheAnswersMapping[$cf->getSlug()][$value])) {
// try to find the answer (with array_keys and a search value
$values = array_keys(
array_map(static function ($label) { return trim(strtolower($label)); }, $answers),
array_map(static function ($label) {
return trim(strtolower($label));
}, $answers),
trim(strtolower($value)),
true
);