Skip to content

Commit

Permalink
Allow Symfony 7 (#20)
Browse files Browse the repository at this point in the history
* Allow Symfony 7

* Code improvements
  • Loading branch information
Padam87 authored Aug 28, 2024
1 parent 0477131 commit e498ed9
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Command/DumpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected function configure()
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->dump($input);

Expand Down
2 changes: 1 addition & 1 deletion Command/ImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected function configure()
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$path = $this->dump($input);

Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Configuration implements ConfigurationInterface
/**
* {@inheritDoc}
*/
public function getConfigTreeBuilder()
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('padam87_cron');
$rootNode = $treeBuilder->getRootNode();
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Padam87CronExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Padam87CronExtension extends Extension
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
public function load(array $configs, ContainerBuilder $container): void
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
Expand Down
10 changes: 5 additions & 5 deletions Tests/HelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private function getConfig(): array
/**
* @test
*/
public function should_register_single_job_attribute()
public function should_register_single_job_attribute(): void
{
$commands = [
new OneAttributeCommand(),
Expand All @@ -46,7 +46,7 @@ public function should_register_single_job_attribute()
/**
* @test
*/
public function should_register_multiple_job_attributes()
public function should_register_multiple_job_attributes(): void
{
$commands = [
new TwoAttributesCommand(),
Expand All @@ -67,7 +67,7 @@ public function should_register_multiple_job_attributes()
/**
* @test
*/
public function should_register_job_attributes_on_multiple_commands()
public function should_register_job_attributes_on_multiple_commands(): void
{
$stdClass = new \stdClass();
$commands = [
Expand All @@ -91,7 +91,7 @@ public function should_register_job_attributes_on_multiple_commands()
/**
* @test
*/
public function should_ignore_irrelevant_attributes()
public function should_ignore_irrelevant_attributes(): void
{
$commands = [
new IrrelevantAttributeCommand(),
Expand All @@ -112,7 +112,7 @@ public function should_ignore_irrelevant_attributes()
/**
* @test
*/
public function should_process_jobs()
public function should_process_jobs(): void
{
$commands = [new ProcessTestCommand()];

Expand Down
4 changes: 2 additions & 2 deletions Util/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function createTab(InputInterface $input, ?array $config = null): Tab
continue;
}

$vars[strtoupper($name)] = $value;
$vars[strtoupper((string) $name)] = $value;
}
}

Expand All @@ -67,7 +67,7 @@ private function processJob(Job $job, InputInterface $input, array $config, Comm
);

if ($config['log_dir'] !== null && $job->logFile !== null) {
$logDir = rtrim($config['log_dir'], '\\/');
$logDir = rtrim((string) $config['log_dir'], '\\/');
$job->logFile = $logDir.DIRECTORY_SEPARATOR.$job->logFile;
}

Expand Down
8 changes: 4 additions & 4 deletions Util/Tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Output\BufferedOutput;

class Tab implements \ArrayAccess
class Tab implements \ArrayAccess, \Stringable
{
/**
* @var Job[]
*/
private $jobs = [];
private $vars;
private array $jobs = [];
private VariableBag $vars;

public function __construct()
{
Expand Down Expand Up @@ -47,7 +47,7 @@ public function offsetSet($offset, $value): void
sprintf(
'The crontab should only contain instances of "%s", "%s" given',
'Padam87\CronBundle\Annotation\Job',
get_class($value)
$value::class
)
);
}
Expand Down
4 changes: 2 additions & 2 deletions Util/VariableBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

use Padam87\CronBundle\Attribute\Job;

class VariableBag implements \ArrayAccess
class VariableBag implements \ArrayAccess, \Stringable
{
private $vars = [];
private array $vars = [];

/**
* {@inheritdoc}
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
},
"require": {
"php": "^8.1",
"symfony/console": "^6.1",
"symfony/process": "^6.1",
"symfony/config": "^6.1",
"symfony/dependency-injection": "^6.1"
"symfony/console": "^6.1 || ^7.0",
"symfony/process": "^6.1 || ^7.0",
"symfony/config": "^6.1 || ^7.0",
"symfony/dependency-injection": "^6.1 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5"
Expand Down

0 comments on commit e498ed9

Please sign in to comment.