Skip to content

Commit af85b78

Browse files
author
Daan Biesterbos
committed
Add support for Symfony 4.4, update project dependencies, update tests, fix deprecation errors, php7.3+
1 parent f4b8d9f commit af85b78

35 files changed

+4240
-2486
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
phpunit.xml
22
vendor/
3-
.idea/
3+
.idea/
4+
.phpunit.result.cache

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ cache:
99
matrix:
1010
fast_finish: true
1111
include:
12-
- php: 7.1
13-
- php: 7.2
12+
- php: 7.3
13+
- php: 7.4
1414

1515
before_script:
1616
- composer self-update

Command/CleanUpCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace JMS\JobQueueBundle\Command;
44

5-
use Doctrine\Common\Persistence\ManagerRegistry;
5+
use Doctrine\Bundle\DoctrineBundle\Registry;
66
use Doctrine\DBAL\Connection;
77
use Doctrine\ORM\EntityManager;
88
use JMS\JobQueueBundle\Entity\Job;
@@ -19,7 +19,7 @@ class CleanUpCommand extends Command
1919
private $jobManager;
2020
private $registry;
2121

22-
public function __construct(ManagerRegistry $registry, JobManager $jobManager)
22+
public function __construct(Registry $registry, JobManager $jobManager)
2323
{
2424
parent::__construct();
2525

Command/MarkJobIncompleteCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace JMS\JobQueueBundle\Command;
44

5-
use Doctrine\Common\Persistence\ManagerRegistry;
5+
use Doctrine\Bundle\DoctrineBundle\Registry;
66
use Doctrine\ORM\EntityManager;
77
use JMS\JobQueueBundle\Entity\Job;
88
use Symfony\Component\Console\Command\Command;
@@ -18,7 +18,7 @@ class MarkJobIncompleteCommand extends Command
1818
private $registry;
1919
private $jobManager;
2020

21-
public function __construct(ManagerRegistry $managerRegistry, JobManager $jobManager)
21+
public function __construct(Registry $managerRegistry, JobManager $jobManager)
2222
{
2323
parent::__construct();
2424

Command/RunCommand.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818

1919
namespace JMS\JobQueueBundle\Command;
2020

21+
use Doctrine\Bundle\DoctrineBundle\Registry;
2122
use Doctrine\ORM\EntityManager;
2223
use JMS\JobQueueBundle\Entity\Job;
2324
use JMS\JobQueueBundle\Entity\Repository\JobManager;
2425
use JMS\JobQueueBundle\Event\NewOutputEvent;
2526
use JMS\JobQueueBundle\Event\StateChangeEvent;
2627
use JMS\JobQueueBundle\Exception\InvalidArgumentException;
27-
use Symfony\Bridge\Doctrine\ManagerRegistry;
2828
use Symfony\Component\Console\Command\Command;
2929
use Symfony\Component\Console\Input\InputInterface;
3030
use Symfony\Component\Console\Input\InputOption;
@@ -46,7 +46,7 @@ class RunCommand extends Command
4646
/** @var OutputInterface */
4747
private $output;
4848

49-
/** @var ManagerRegistry */
49+
/** @var Registry */
5050
private $registry;
5151

5252
/** @var JobManager */
@@ -67,7 +67,7 @@ class RunCommand extends Command
6767
/** @var array */
6868
private $queueOptions;
6969

70-
public function __construct(ManagerRegistry $managerRegistry, JobManager $jobManager, EventDispatcherInterface $dispatcher, array $queueOptionsDefault, array $queueOptions)
70+
public function __construct(Registry $managerRegistry, JobManager $jobManager, EventDispatcherInterface $dispatcher, array $queueOptionsDefault, array $queueOptions)
7171
{
7272
parent::__construct();
7373

@@ -283,13 +283,13 @@ private function checkRunningJobs()
283283

284284
if ( ! empty($newOutput)) {
285285
$event = new NewOutputEvent($data['job'], $newOutput, NewOutputEvent::TYPE_STDOUT);
286-
$this->dispatcher->dispatch('jms_job_queue.new_job_output', $event);
286+
$this->dispatcher->dispatch($event, 'jms_job_queue.new_job_output');
287287
$newOutput = $event->getNewOutput();
288288
}
289289

290290
if ( ! empty($newErrorOutput)) {
291291
$event = new NewOutputEvent($data['job'], $newErrorOutput, NewOutputEvent::TYPE_STDERR);
292-
$this->dispatcher->dispatch('jms_job_queue.new_job_output', $event);
292+
$this->dispatcher->dispatch($event, 'jms_job_queue.new_job_output');
293293
$newErrorOutput = $event->getNewOutput();
294294
}
295295

@@ -350,7 +350,7 @@ private function checkRunningJobs()
350350
private function startJob(Job $job)
351351
{
352352
$event = new StateChangeEvent($job, Job::STATE_RUNNING);
353-
$this->dispatcher->dispatch('jms_job_queue.job_state_change', $event);
353+
$this->dispatcher->dispatch($event, 'jms_job_queue.job_state_change');
354354
$newState = $event->getNewState();
355355

356356
if (Job::STATE_CANCELED === $newState) {

Command/ScheduleCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace JMS\JobQueueBundle\Command;
44

5-
use Doctrine\Common\Persistence\ManagerRegistry;
5+
use Doctrine\Bundle\DoctrineBundle\Registry;
66
use Doctrine\ORM\EntityManager;
77
use Doctrine\ORM\Query;
88
use JMS\JobQueueBundle\Console\CronCommand;
@@ -23,7 +23,7 @@ class ScheduleCommand extends Command
2323
private $schedulers;
2424
private $cronCommands;
2525

26-
public function __construct(ManagerRegistry $managerRegistry, iterable $schedulers, iterable $cronCommands)
26+
public function __construct(Registry $managerRegistry, iterable $schedulers, iterable $cronCommands)
2727
{
2828
parent::__construct();
2929

Console/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Symfony\Component\Console\Input\InputInterface;
1212
use Symfony\Component\Console\Input\InputOption;
1313
use Symfony\Component\Console\Output\OutputInterface;
14-
use Symfony\Component\Debug\Exception\FlattenException;
14+
use Symfony\Component\ErrorHandler\Exception\FlattenException;
1515
use Symfony\Component\HttpKernel\KernelInterface;
1616

1717
/**

Controller/JobController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
use JMS\JobQueueBundle\Entity\Job;
88
use JMS\JobQueueBundle\Entity\Repository\JobManager;
99
use JMS\JobQueueBundle\View\JobFilter;
10-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
11-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
10+
use Symfony\Component\Routing\Annotation\Route;
11+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1212
use Symfony\Component\HttpFoundation\RedirectResponse;
1313
use Symfony\Component\HttpFoundation\Request;
1414
use Symfony\Component\HttpKernel\Exception\HttpException;
1515

16-
class JobController extends Controller
16+
class JobController extends AbstractController
1717
{
1818
/**
1919
* @Route("/", name = "jms_jobs_overview")

DependencyInjection/Configuration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class Configuration implements ConfigurationInterface
3434
*/
3535
public function getConfigTreeBuilder()
3636
{
37-
$treeBuilder = new TreeBuilder();
38-
$rootNode = $treeBuilder->root('jms_job_queue');
37+
$treeBuilder = new TreeBuilder('jms_job_queue');
38+
$rootNode = $treeBuilder->getRootNode();
3939

4040
$rootNode
4141
->children()

Entity/Job.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
use Doctrine\ORM\Mapping as ORM;
2323
use JMS\JobQueueBundle\Exception\InvalidStateTransitionException;
2424
use JMS\JobQueueBundle\Exception\LogicException;
25-
use Symfony\Component\Debug\Exception\FlattenException;
25+
use Symfony\Component\ErrorHandler\Exception\FlattenException;
2626

2727
/**
2828
* @ORM\Entity

0 commit comments

Comments
 (0)