mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 02:53:50 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -21,8 +21,6 @@ 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
|
||||
{
|
||||
public function __construct(
|
||||
@@ -41,11 +39,11 @@ final class ChillPersonMoveCommand extends Command
|
||||
];
|
||||
|
||||
foreach ($deleteEntities as $key => $de) {
|
||||
$ctxt['delete_entity_' . $key] = $de;
|
||||
$ctxt['delete_entity_'.$key] = $de;
|
||||
}
|
||||
|
||||
foreach ($sqls as $key => $sql) {
|
||||
$ctxt['sql_' . $key] = $sql;
|
||||
$ctxt['sql_'.$key] = $sql;
|
||||
}
|
||||
|
||||
return $ctxt;
|
||||
@@ -100,6 +98,7 @@ final class ChillPersonMoveCommand extends Command
|
||||
|
||||
$this->chillLogger->notice('Move a person from command line succeeded', $ctxt);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -117,9 +116,8 @@ final class ChillPersonMoveCommand extends Command
|
||||
}
|
||||
$id = $input->getOption($name);
|
||||
|
||||
if (ctype_digit((string) $id) === false) {
|
||||
throw new RuntimeException("The id in \"{$name}\" field does not contains "
|
||||
. "only digits: {$id}");
|
||||
if (false === \ctype_digit((string) $id)) {
|
||||
throw new RuntimeException("The id in \"{$name}\" field does not contains only digits: {$id}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -11,17 +11,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Command;
|
||||
|
||||
use Chill\PersonBundle\Service\Import\ChillImporter;
|
||||
use Chill\PersonBundle\Service\Import\SocialWorkMetadataInterface;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Exception;
|
||||
use League\Csv\Reader;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Throwable;
|
||||
|
||||
final class ImportSocialWorkMetadata extends Command
|
||||
{
|
||||
@@ -36,10 +32,10 @@ final class ImportSocialWorkMetadata extends Command
|
||||
protected function configure()
|
||||
{
|
||||
$description = 'Imports a structured table containing social issues, social actions, objectives, results and evaluations.';
|
||||
$help = 'File to csv format, no headers, semi-colon as delimiter, datas sorted by alphabetical order, column after column.'. PHP_EOL
|
||||
. 'Columns are: social issues parent, social issues child, social actions parent, social actions child, goals, results, evaluations.'. PHP_EOL
|
||||
. PHP_EOL
|
||||
. 'See social_work_metadata.csv as example.'. PHP_EOL;
|
||||
$help = 'File to csv format, no headers, semi-colon as delimiter, datas sorted by alphabetical order, column after column.'.PHP_EOL
|
||||
.'Columns are: social issues parent, social issues child, social actions parent, social actions child, goals, results, evaluations.'.PHP_EOL
|
||||
.PHP_EOL
|
||||
.'See social_work_metadata.csv as example.'.PHP_EOL;
|
||||
|
||||
$this
|
||||
->setName('chill:person:import-socialwork')
|
||||
@@ -55,8 +51,8 @@ final class ImportSocialWorkMetadata extends Command
|
||||
|
||||
try {
|
||||
$csv = Reader::createFromPath($filepath);
|
||||
} catch (Throwable $e) {
|
||||
throw new Exception('Error while loading CSV.', 0, $e);
|
||||
} catch (\Throwable $e) {
|
||||
throw new \Exception('Error while loading CSV.', 0, $e);
|
||||
}
|
||||
|
||||
$csv->setDelimiter(';');
|
||||
|
@@ -12,8 +12,6 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Command;
|
||||
|
||||
use Chill\PersonBundle\Service\AccompanyingPeriod\OldDraftAccompanyingPeriodRemoverInterface;
|
||||
use DateInterval;
|
||||
use Exception;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
@@ -36,21 +34,21 @@ class RemoveOldDraftAccompanyingPeriodCommand extends Command
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$this->logger->info('[' . $this->getName() . '] started', [
|
||||
$this->logger->info('['.$this->getName().'] started', [
|
||||
'interval' => $input->getArgument('interval'),
|
||||
]);
|
||||
|
||||
try {
|
||||
$interval = new DateInterval($input->getArgument('interval'));
|
||||
} catch (Exception $e) {
|
||||
$this->logger->error('[' . $this->getName() . '] bad interval');
|
||||
$interval = new \DateInterval($input->getArgument('interval'));
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error('['.$this->getName().'] bad interval');
|
||||
|
||||
throw $e;
|
||||
}
|
||||
|
||||
$this->remover->remove($interval);
|
||||
|
||||
$this->logger->info('[' . $this->getName() . '] end of command');
|
||||
$this->logger->info('['.$this->getName().'] end of command');
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user