Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: PHPCS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,30 @@ env:
jobs:
phpunit:
name: "PHPUnit"
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-24.04"

strategy:
matrix:
php-version:
- "7.4"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
symfony-version:
- "5.4.x"
- "6.4.x"
- "7.0.x"
- "7.4.x"
- "8.0.x"
monolog-version:
- "^2.9"
exclude:
- php-version: "7.4"
symfony-version: "6.4.x"
- php-version: "7.4"
symfony-version: "7.0.x"
- php-version: "8.1"
symfony-version: "7.0.x"
- php-version: "8.2"
symfony-version: "8.0.x"
- php-version: "8.3"
symfony-version: "8.0.x"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"
uses: "actions/checkout@v7"
with:
fetch-depth: 2

Expand Down
6 changes: 3 additions & 3 deletions DependencyInjection/RewieerTaskSchedulerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Rewieer\TaskSchedulerBundle\Task\TaskInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader;

class RewieerTaskSchedulerExtension extends Extension
Expand All @@ -25,7 +25,7 @@ public function load(array $configs, ContainerBuilder $container): void
$configuration = new Configuration();
$this->processConfiguration($configuration, $configs);

$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.xml');
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.yaml');
}
}
32 changes: 0 additions & 32 deletions Resources/config/services.xml

This file was deleted.

35 changes: 35 additions & 0 deletions Resources/config/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
services:
ts.event_dispatcher:
class: Rewieer\TaskSchedulerBundle\Event\EventDispatcher
public: true

ts.scheduler:
class: Rewieer\TaskSchedulerBundle\Task\Scheduler
public: true
arguments:
- '@ts.event_dispatcher'

ts.scheduler_logger:
class: Rewieer\TaskSchedulerBundle\Services\SchedulerLogger
public: true
arguments:
- '@logger'
tags:
- { name: 'ts.event_subscriber' }
- { name: 'monolog.logger', channel: 'scheduler' }

ts.list_command:
class: Rewieer\TaskSchedulerBundle\Command\ListCommand
public: true
arguments:
- '@ts.scheduler'
tags:
- { name: 'console.command' }

ts.run_command:
class: Rewieer\TaskSchedulerBundle\Command\RunCommand
public: true
arguments:
- '@ts.scheduler'
tags:
- { name: 'console.command' }
2 changes: 1 addition & 1 deletion Task/Scheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Scheduler
{
private EventDispatcher $dispatcher;

public function __construct(EventDispatcher $dispatcher = null)
public function __construct(?EventDispatcher $dispatcher = null)
{
if ($dispatcher === null) {
$dispatcher = new EventDispatcher();
Expand Down
4 changes: 2 additions & 2 deletions Tests/Command/ListCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function testListCommand(): void
$scheduler->addTask(new TaskMock());

$application = new Application();
$application->add(new ListCommand($scheduler));
$application->addCommands([new ListCommand($scheduler)]);

$command = $application->find('ts:list');

Expand All @@ -55,7 +55,7 @@ public function testListCommandWithOption(): void

$application = new Application();
/** @var Scheduler $scheduler */
$application->add(new ListCommand($scheduler));
$application->addCommands([new ListCommand($scheduler)]);

$command = $application->find('ts:list');

Expand Down
6 changes: 3 additions & 3 deletions Tests/Command/RunCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testRunCommand(): void
$scheduler->addTask(new TaskMock());

$application = new Application();
$application->add(new RunCommand($scheduler));
$application->addCommands([new RunCommand($scheduler)]);
$command = $application->find('ts:run');

$commandTester = new CommandTester($command);
Expand All @@ -57,7 +57,7 @@ public function testRunCommandWithId(): void
$scheduler->addTask($t2);

$application = new Application();
$application->add(new RunCommand($scheduler));
$application->addCommands([new RunCommand($scheduler)]);
$command = $application->find('ts:run');

$commandTester = new CommandTester($command);
Expand Down Expand Up @@ -85,7 +85,7 @@ public function testRunCommandWithClassName(): void
$scheduler->addTask($t2);

$application = new Application();
$application->add(new RunCommand($scheduler));
$application->addCommands([new RunCommand($scheduler)]);
$command = $application->find('ts:run');

$commandTester = new CommandTester($command);
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
},
"keywords": ["cron", "task", "scheduler", "symfony", "bundle"],
"require": {
"php": "^7.4|^8.1",
"php": "^8.2",
"symfony/deprecation-contracts": "^2.5|^3.4",
"symfony/framework-bundle": "^5.4|^6.4|^7.0",
"symfony/console": "^5.3|^6.4|^7.0",
"symfony/framework-bundle": "^5.4|^6.4|^7.4|^8.0",
"symfony/console": "^5.4|^6.4|^7.4|^8.0",
"symfony/yaml": "^5.4|^6.4|^7.4|^8.0",
"dragonmantank/cron-expression": "^3.3"
},
"require-dev": {
Expand Down
Loading