Skip to content

Commit 976cc82

Browse files
committed
Updated for PHP 8.2
1 parent bc38448 commit 976cc82

28 files changed

Lines changed: 71 additions & 71 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Version 5.5.0
22
* Added cleanup commands
3+
* Updated for PHP 8.2
34

45
# Version 5.4.1
56
* Fix File Exceptions integration

Tests/DataflowType/AbstractDataflowTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function testProcess()
1818

1919
$dataflowType = new class($label, $options, $values, $testCase) extends AbstractDataflowType
2020
{
21-
public function __construct(private string $label, private array $options, private array $values, private TestCase $testCase)
21+
public function __construct(private readonly string $label, private readonly array $options, private readonly array $values, private readonly TestCase $testCase)
2222
{
2323
}
2424

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
}
4242
},
4343
"require": {
44-
"php": "^8.0",
44+
"php": "^8.2",
4545
"ext-json": "*",
4646
"doctrine/dbal": "^3.0||^4.0",
4747
"doctrine/doctrine-bundle": "^2.0",

rector.php

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,16 @@
77
use Rector\Set\ValueObject\LevelSetList;
88
use Rector\Symfony\Set\SymfonySetList;
99

10-
return static function (RectorConfig $rectorConfig): void {
11-
$rectorConfig->paths([
12-
__DIR__ . '/src',
13-
__DIR__ . '/Tests',
14-
]);
15-
16-
// register a single rule
17-
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
18-
19-
$rectorConfig->sets([
20-
SymfonySetList::SYMFONY_70,
10+
return RectorConfig::configure()
11+
->withPaths([
12+
__DIR__.'/src',
13+
__DIR__.'/Tests',
14+
])
15+
->withComposerBased(symfony: true)
16+
->withRules([InlineConstructorDefaultToPropertyRector::class])
17+
->withSets([
2118
SymfonySetList::SYMFONY_CODE_QUALITY,
2219
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
23-
LevelSetList::UP_TO_PHP_80,
24-
]);
25-
};
20+
LevelSetList::UP_TO_PHP_82,
21+
])
22+
;

src/Command/AddScheduledDataflowCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,19 @@
1919
/**
2020
* @codeCoverageIgnore
2121
*/
22-
#[AsCommand('code-rhapsodie:dataflow:schedule:add', 'Create a scheduled dataflow')]
22+
#[AsCommand('code-rhapsodie:dataflow:schedule:add', 'Create a scheduled dataflow', help: <<<'TXT'
23+
The <info>%command.name%</info> allows you to create a new scheduled dataflow.
24+
TXT)]
2325
class AddScheduledDataflowCommand extends Command
2426
{
25-
public function __construct(private DataflowTypeRegistryInterface $registry, private ScheduledDataflowRepository $scheduledDataflowRepository, private ValidatorInterface $validator, private ConnectionFactory $connectionFactory)
27+
public function __construct(private readonly DataflowTypeRegistryInterface $registry, private readonly ScheduledDataflowRepository $scheduledDataflowRepository, private readonly ValidatorInterface $validator, private readonly ConnectionFactory $connectionFactory)
2628
{
2729
parent::__construct();
2830
}
2931

3032
protected function configure(): void
3133
{
3234
$this
33-
->setHelp('The <info>%command.name%</info> allows you to create a new scheduled dataflow.')
3435
->addOption('label', null, InputOption::VALUE_REQUIRED, 'Label of the scheduled dataflow')
3536
->addOption('type', null, InputOption::VALUE_REQUIRED, 'Type of the scheduled dataflow (FQCN)')
3637
->addOption(

src/Command/ChangeScheduleStatusCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,19 @@
1818
/**
1919
* @codeCoverageIgnore
2020
*/
21-
#[AsCommand('code-rhapsodie:dataflow:schedule:change-status', 'Change schedule status')]
21+
#[AsCommand('code-rhapsodie:dataflow:schedule:change-status', 'Change schedule status', help: <<<'TXT'
22+
The <info>%command.name%</info> command able you to change schedule status.
23+
TXT)]
2224
class ChangeScheduleStatusCommand extends Command
2325
{
24-
public function __construct(private ScheduledDataflowRepository $scheduledDataflowRepository, private ConnectionFactory $connectionFactory)
26+
public function __construct(private readonly ScheduledDataflowRepository $scheduledDataflowRepository, private readonly ConnectionFactory $connectionFactory)
2527
{
2628
parent::__construct();
2729
}
2830

2931
protected function configure(): void
3032
{
3133
$this
32-
->setHelp('The <info>%command.name%</info> command able you to change schedule status.')
3334
->addArgument('schedule-id', InputArgument::REQUIRED, 'Id of the schedule')
3435
->addOption('enable', null, InputOption::VALUE_NONE, 'Enable the schedule')
3536
->addOption('disable', null, InputOption::VALUE_NONE, 'Disable the schedule')

src/Command/DatabaseSchemaCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,19 @@
1919
use Symfony\Component\Console\Question\ConfirmationQuestion;
2020
use Symfony\Component\Console\Style\SymfonyStyle;
2121

22-
#[AsCommand(name: 'code-rhapsodie:dataflow:database-schema', description: 'Generates schema create / update SQL queries')]
22+
#[AsCommand(name: 'code-rhapsodie:dataflow:database-schema', description: 'Generates schema create / update SQL queries', help: <<<'TXT'
23+
The <info>%command.name%</info> help you to generate SQL Query to create or update your database schema for this bundle
24+
TXT)]
2325
class DatabaseSchemaCommand extends Command
2426
{
25-
public function __construct(private ConnectionFactory $connectionFactory)
27+
public function __construct(private readonly ConnectionFactory $connectionFactory)
2628
{
2729
parent::__construct();
2830
}
2931

3032
protected function configure(): void
3133
{
3234
$this
33-
->setHelp('The <info>%command.name%</info> help you to generate SQL Query to create or update your database schema for this bundle')
3435
->addOption('dump-sql', null, InputOption::VALUE_NONE, 'Dump only the update SQL queries.')
3536
->addOption('update', null, InputOption::VALUE_NONE, 'Dump/execute only the update SQL queries.')
3637
->addOption('connection', null, InputOption::VALUE_REQUIRED, 'Define the DBAL connection to use');

src/Command/ExecuteDataflowCommand.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
*
2424
* @codeCoverageIgnore
2525
*/
26-
#[AsCommand('code-rhapsodie:dataflow:execute', 'Runs one dataflow type with provided options')]
26+
#[AsCommand('code-rhapsodie:dataflow:execute', 'Runs one dataflow type with provided options', help: <<<'TXT'
27+
The <info>%command.name%</info> command runs one dataflow with the provided options.
28+
29+
<info>php %command.full_name% App\Dataflow\MyDataflow '{"option1": "value1", "option2": "value2"}'</info>
30+
TXT)]
2731
class ExecuteDataflowCommand extends Command implements LoggerAwareInterface
2832
{
2933
use LoggerAwareTrait;
@@ -36,13 +40,6 @@ public function __construct(private DataflowTypeRegistryInterface $registry, pri
3640
protected function configure(): void
3741
{
3842
$this
39-
->setHelp(
40-
<<<'EOF'
41-
The <info>%command.name%</info> command runs one dataflow with the provided options.
42-
43-
<info>php %command.full_name% App\Dataflow\MyDataflow '{"option1": "value1", "option2": "value2"}'</info>
44-
EOF
45-
)
4643
->addArgument('fqcn', InputArgument::REQUIRED, 'FQCN or alias of the dataflow type')
4744
->addArgument('options', InputArgument::OPTIONAL, 'Options for the dataflow type as a json string', '[]')
4845
->addOption('connection', null, InputOption::VALUE_REQUIRED, 'Define the DBAL connection to use');
@@ -54,7 +51,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5451
$this->connectionFactory->setConnectionName($input->getOption('connection'));
5552
}
5653
$fqcnOrAlias = $input->getArgument('fqcn');
57-
$options = json_decode($input->getArgument('options'), true, 512, \JSON_THROW_ON_ERROR);
54+
$options = json_decode((string) $input->getArgument('options'), true, 512, \JSON_THROW_ON_ERROR);
5855
$io = new SymfonyStyle($input, $output);
5956

6057
$dataflowType = $this->registry->getDataflowType($fqcnOrAlias);

src/Command/JobCleanupCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,18 @@
1010
use Symfony\Component\Console\Input\InputInterface;
1111
use Symfony\Component\Console\Output\OutputInterface;
1212

13-
#[AsCommand(name: 'code-rhapsodie:job:cleanup', description: 'Cleanup job history.')]
13+
#[AsCommand(name: 'code-rhapsodie:dataflow:job:cleanup', description: 'Cleanup job history.', help: <<<'TXT'
14+
Job retention can be configured with the "job_history.retention" configuration.
15+
TXT)]
1416
class JobCleanupCommand extends Command
1517
{
16-
public function __construct(private JobRepository $jobRepository, private int $retention)
18+
public function __construct(private readonly JobRepository $jobRepository, private readonly int $retention)
1719
{
1820
parent::__construct();
1921
}
2022

2123
protected function configure()
2224
{
23-
$this->setHelp('Job retention can be configured with the "job_history.retention" configuration.');
2425
}
2526

2627
protected function execute(InputInterface $input, OutputInterface $output): int

src/Command/JobShowCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
/**
1818
* @codeCoverageIgnore
1919
*/
20-
#[AsCommand('code-rhapsodie:dataflow:job:show', 'Display job details for schedule or specific job')]
20+
#[AsCommand('code-rhapsodie:dataflow:job:show', 'Display job details for schedule or specific job', help: <<<'TXT'
21+
The <info>%command.name%</info> display job details for schedule or specific job.
22+
TXT)]
2123
class JobShowCommand extends Command
2224
{
2325
private const STATUS_MAPPING = [
@@ -26,15 +28,14 @@ class JobShowCommand extends Command
2628
Job::STATUS_COMPLETED => 'Completed',
2729
];
2830

29-
public function __construct(private JobGateway $jobGateway, private ConnectionFactory $connectionFactory)
31+
public function __construct(private readonly JobGateway $jobGateway, private readonly ConnectionFactory $connectionFactory)
3032
{
3133
parent::__construct();
3234
}
3335

3436
protected function configure(): void
3537
{
3638
$this
37-
->setHelp('The <info>%command.name%</info> display job details for schedule or specific job.')
3839
->addOption('job-id', null, InputOption::VALUE_REQUIRED, 'Id of the job to get details')
3940
->addOption('schedule-id', null, InputOption::VALUE_REQUIRED, 'Id of schedule for last execution details')
4041
->addOption('details', null, InputOption::VALUE_NONE, 'Display full details')

0 commit comments

Comments
 (0)