diff --git a/src/Command/ScheduleTaskCommand.php b/src/Command/ScheduleTaskCommand.php index 40b4b54..522dbc2 100644 --- a/src/Command/ScheduleTaskCommand.php +++ b/src/Command/ScheduleTaskCommand.php @@ -80,16 +80,16 @@ protected function execute(InputInterface $input, OutputInterface $output) $taskBuilder = $this->scheduler->createTask($handlerClass, $workload); - if ($cronExpression !== null) { + if (null !== $cronExpression) { $endDate = null; - if ($endDateString !== null) { + if (null !== $endDateString) { $endDate = new \DateTime($endDateString); } $taskBuilder->cron($cronExpression, new \DateTime(), $endDate); } - if ($executionDateString !== null) { + if (null !== $executionDateString) { $taskBuilder->executeAt(new \DateTime($executionDateString)); } diff --git a/src/DependencyInjection/HandlerCompilerPass.php b/src/DependencyInjection/HandlerCompilerPass.php index 1a953e1..f8f9284 100644 --- a/src/DependencyInjection/HandlerCompilerPass.php +++ b/src/DependencyInjection/HandlerCompilerPass.php @@ -21,6 +21,7 @@ class HandlerCompilerPass implements CompilerPassInterface { const REGISTRY_ID = 'task.handler.factory'; + const HANDLER_TAG = 'task.handler'; /** diff --git a/src/Executor/SeparateProcessException.php b/src/Executor/SeparateProcessException.php index ac7eda6..d4e1865 100644 --- a/src/Executor/SeparateProcessException.php +++ b/src/Executor/SeparateProcessException.php @@ -26,6 +26,8 @@ class SeparateProcessException extends \Exception */ public function __construct($errorOutput) { + parent::__construct($errorOutput); + $this->errorOutput = $errorOutput; } diff --git a/src/Executor/SeparateProcessExecutor.php b/src/Executor/SeparateProcessExecutor.php index cd56c86..9a4d76f 100644 --- a/src/Executor/SeparateProcessExecutor.php +++ b/src/Executor/SeparateProcessExecutor.php @@ -131,7 +131,7 @@ private function handle(TaskExecutionInterface $execution) */ private function createException($errorOutput) { - if (strpos($errorOutput, FailedException::class) !== 0) { + if (0 !== strpos($errorOutput, FailedException::class)) { return new SeparateProcessException($errorOutput); } diff --git a/tests/Functional/Command/ScheduleSystemTasksCommandTest.php b/tests/Functional/Command/ScheduleSystemTasksCommandTest.php index 3c935a0..2ff7fff 100644 --- a/tests/Functional/Command/ScheduleSystemTasksCommandTest.php +++ b/tests/Functional/Command/ScheduleSystemTasksCommandTest.php @@ -10,7 +10,7 @@ class ScheduleSystemTasksCommandTest extends BaseCommandTestCase public function setUp() { self::bootKernel(); - if (self::$kernel->getContainer()->getParameter('kernel.storage') !== 'doctrine') { + if ('doctrine' !== self::$kernel->getContainer()->getParameter('kernel.storage')) { return $this->markTestSkipped('This testcase will only be called for doctrine storage.'); } diff --git a/tests/Functional/Entity/TaskRepositoryTest.php b/tests/Functional/Entity/TaskRepositoryTest.php index 760e02f..b02ed0f 100644 --- a/tests/Functional/Entity/TaskRepositoryTest.php +++ b/tests/Functional/Entity/TaskRepositoryTest.php @@ -21,7 +21,7 @@ public function setUp() public function testFindBySystemKey() { - if (self::$kernel->getContainer()->getParameter('kernel.storage') !== 'doctrine') { + if ('doctrine' !== self::$kernel->getContainer()->getParameter('kernel.storage')) { return $this->markTestSkipped('This testcase will only be called for doctrine storage.'); } @@ -36,7 +36,7 @@ public function testFindBySystemKey() public function testFindBySystemKeyNotFound() { - if (self::$kernel->getContainer()->getParameter('kernel.storage') !== 'doctrine') { + if ('doctrine' !== self::$kernel->getContainer()->getParameter('kernel.storage')) { return $this->markTestSkipped('This testcase will only be called for doctrine storage.'); } @@ -48,7 +48,7 @@ public function testFindBySystemKeyNotFound() public function testFindSystemTasks() { - if (self::$kernel->getContainer()->getParameter('kernel.storage') !== 'doctrine') { + if ('doctrine' !== self::$kernel->getContainer()->getParameter('kernel.storage')) { return $this->markTestSkipped('This testcase will only be called for doctrine storage.'); } diff --git a/tests/app/TestKernel.php b/tests/app/TestKernel.php index 2d49551..d77316d 100644 --- a/tests/app/TestKernel.php +++ b/tests/app/TestKernel.php @@ -44,7 +44,7 @@ public function registerBundles() public function registerContainerConfiguration(LoaderInterface $loader) { $this->storage = getenv(self::STORAGE_VAR_NAME); - if ($this->storage === false) { + if (false === $this->storage) { $this->storage = 'array'; }