From eef8f9876b1aa6580a96b1451c6a9c12995dd13f Mon Sep 17 00:00:00 2001 From: Johannes Wachter Date: Sun, 5 Jan 2020 18:09:10 +0100 Subject: [PATCH 1/5] added symfony 5 as dependency --- composer.json | 20 ++++++++++---------- src/Command/DebugTasksCommand.php | 2 ++ src/Command/RunCommand.php | 2 ++ src/Command/ScheduleSystemTasksCommand.php | 2 ++ src/Command/ScheduleTaskCommand.php | 2 ++ src/DependencyInjection/Configuration.php | 16 ++++++++++++++-- 6 files changed, 32 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index 0dc1ef1..c5c711f 100644 --- a/composer.json +++ b/composer.json @@ -12,21 +12,21 @@ "require": { "php": "^5.6 || ^7.0", "php-task/php-task": "^1.3", - "symfony/http-kernel": "^2.8 || ^3.4 || ^4.0", - "symfony/dependency-injection": "^2.8 || ^3.4 || ^4.0", - "symfony/expression-language": "^2.8 || ^3.4 || ^4.0", - "symfony/config": "^2.8 || ^3.4 || ^4.0", - "symfony/console": "^2.8 || ^3.4 || ^4.0", - "symfony/process": "^2.8 || ^3.4 || ^4.0", + "symfony/http-kernel": "^2.8 || ^3.4 || ^4.0 || ^5.0", + "symfony/dependency-injection": "^2.8 || ^3.4 || ^4.0 || ^5.0", + "symfony/expression-language": "^2.8 || ^3.4 || ^4.0 || ^5.0", + "symfony/config": "^2.8 || ^3.4 || ^4.0 || ^5.0", + "symfony/console": "^2.8 || ^3.4 || ^4.0 || ^5.0", + "symfony/process": "^2.8 || ^3.4 || ^4.0 || ^5.0", "doctrine/orm": "^2.5" }, "require-dev": { "phpunit/phpunit": "^4.8 || ^5.0", "sebastian/comparator": "^1.2.3", - "symfony/debug": "^2.8 || ^3.4 || ^4.0", - "symfony/framework-bundle": "^2.8 || ^3.4 || ^4.0", - "symfony/finder": "^2.8 || ^3.4 || ^4.0", - "symfony/yaml": "^2.8 || ^3.4 || ^4.0", + "symfony/debug": "^2.8 || ^3.4 || ^4.0 || ^5.0", + "symfony/framework-bundle": "^2.8 || ^3.4 || ^4.0 || ^5.0", + "symfony/finder": "^2.8 || ^3.4 || ^4.0 || ^5.0", + "symfony/yaml": "^2.8 || ^3.4 || ^4.0 || ^5.0", "doctrine/doctrine-bundle": "^1.5", "doctrine/data-fixtures": "^1.1" }, diff --git a/src/Command/DebugTasksCommand.php b/src/Command/DebugTasksCommand.php index 9cafb91..93f8910 100644 --- a/src/Command/DebugTasksCommand.php +++ b/src/Command/DebugTasksCommand.php @@ -84,5 +84,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } $table->render(); + + return 0; } } diff --git a/src/Command/RunCommand.php b/src/Command/RunCommand.php index 6535b35..0edc7a1 100644 --- a/src/Command/RunCommand.php +++ b/src/Command/RunCommand.php @@ -67,5 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { $this->runner->runTasks(); $this->scheduler->scheduleTasks(); + + return 0; } } diff --git a/src/Command/ScheduleSystemTasksCommand.php b/src/Command/ScheduleSystemTasksCommand.php index 2aae4ed..fda9c80 100644 --- a/src/Command/ScheduleSystemTasksCommand.php +++ b/src/Command/ScheduleSystemTasksCommand.php @@ -108,6 +108,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $output->writeln(''); $output->writeln('System-tasks successfully scheduled'); + + return 0; } /** diff --git a/src/Command/ScheduleTaskCommand.php b/src/Command/ScheduleTaskCommand.php index 522dbc2..f6931c5 100644 --- a/src/Command/ScheduleTaskCommand.php +++ b/src/Command/ScheduleTaskCommand.php @@ -94,5 +94,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } $taskBuilder->schedule(); + + return 0; } } diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index cd584ef..6cd38f3 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -11,6 +11,7 @@ namespace Task\TaskBundle\DependencyInjection; +use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; @@ -37,9 +38,9 @@ public function __construct(array $lockingStorageAliases) */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder(); + $treeBuilder = new TreeBuilder('task'); - $treeBuilder->root('task') + $this->getRootNodeWithoutDeprecation($treeBuilder, 'task') ->children() ->enumNode('storage')->values(['array', 'doctrine'])->defaultValue('doctrine')->end() ->arrayNode('adapters') @@ -120,4 +121,15 @@ public function getLockingStorageId($alias) { return $this->lockingStorageAliases[$alias]; } + + /** + * @internal + * + * @return ArrayNodeDefinition|\Symfony\Component\Config\Definition\Builder\NodeDefinition + */ + public static function getRootNodeWithoutDeprecation(TreeBuilder $builder, string $name, string $type = 'array') + { + // BC layer for symfony/config 4.1 and older + return \method_exists($builder, 'getRootNode') ? $builder->getRootNode() : $builder->root($name, $type); + } } From 744094c4d97976e75ed48a46745da5d0c6285ba1 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 16 Jun 2020 11:25:08 +0200 Subject: [PATCH 2/5] update compatibility for treeBuilder --- src/DependencyInjection/Configuration.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 6cd38f3..5d521c4 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -40,7 +40,14 @@ public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('task'); - $this->getRootNodeWithoutDeprecation($treeBuilder, 'task') + if (method_exists($treeBuilder, 'getRootNode')) { + $rootNode = $treeBuilder->getRootNode(); + } else { + // BC layer for symfony/config 4.1 and older + $rootNode = $treeBuilder->root('task'); + } + + $rootNode ->children() ->enumNode('storage')->values(['array', 'doctrine'])->defaultValue('doctrine')->end() ->arrayNode('adapters') @@ -121,15 +128,4 @@ public function getLockingStorageId($alias) { return $this->lockingStorageAliases[$alias]; } - - /** - * @internal - * - * @return ArrayNodeDefinition|\Symfony\Component\Config\Definition\Builder\NodeDefinition - */ - public static function getRootNodeWithoutDeprecation(TreeBuilder $builder, string $name, string $type = 'array') - { - // BC layer for symfony/config 4.1 and older - return \method_exists($builder, 'getRootNode') ? $builder->getRootNode() : $builder->root($name, $type); - } } From b95628859abde79e6a470e79e10460f982045fda Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 16 Jun 2020 11:36:00 +0200 Subject: [PATCH 3/5] fix tests --- src/Executor/ExecutionProcessFactory.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Executor/ExecutionProcessFactory.php b/src/Executor/ExecutionProcessFactory.php index e49fb7b..80cff59 100644 --- a/src/Executor/ExecutionProcessFactory.php +++ b/src/Executor/ExecutionProcessFactory.php @@ -45,8 +45,8 @@ public function __construct($consolePath, $processTimeout, $environment) */ public function create($uuid) { - return $process = (new Process( + return $process = (new Process([ implode(' ', [$this->consolePath, 'task:execute', $uuid, '--env=' . $this->environment]) - ))->setTimeout($this->processTimeout); + ]))->setTimeout($this->processTimeout); } } From 9222f837dd9cd0c9969d9cd65ff5debf0d7f6803 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 16 Jun 2020 11:50:38 +0200 Subject: [PATCH 4/5] Fix ExecutionProcessFactory --- src/Executor/ExecutionProcessFactory.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Executor/ExecutionProcessFactory.php b/src/Executor/ExecutionProcessFactory.php index 80cff59..b463837 100644 --- a/src/Executor/ExecutionProcessFactory.php +++ b/src/Executor/ExecutionProcessFactory.php @@ -45,8 +45,14 @@ public function __construct($consolePath, $processTimeout, $environment) */ public function create($uuid) { - return $process = (new Process([ - implode(' ', [$this->consolePath, 'task:execute', $uuid, '--env=' . $this->environment]) - ]))->setTimeout($this->processTimeout); + $command = implode(' ', [$this->consolePath, 'task:execute', $uuid, '--env=' . $this->environment]); + + if (method_exists(Process::class, 'fromShellCommandline')) { + $process = Process::fromShellCommandline($command); + } else { + $process = new Process($command); + } + + return $process->setTimeout($this->processTimeout); } } From 60314ff959f399546adef6982d2e9715caedff06 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 16 Jun 2020 14:40:07 +0200 Subject: [PATCH 5/5] Update php-task and add php 7.4 to travis --- .travis.yml | 6 ++++++ composer.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7bc1d50..02d6c81 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,6 +57,12 @@ matrix: - php: 7.3 env: - STORAGE=doctrine + - php: 7.4 + env: + - STORAGE=array + - php: 7.4 + env: + - STORAGE=doctrine before_install: - if [[ -z $CODE_COVERAGE ]]; then phpenv config-rm xdebug.ini ; fi diff --git a/composer.json b/composer.json index c5c711f..b02cd2e 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "require": { "php": "^5.6 || ^7.0", - "php-task/php-task": "^1.3", + "php-task/php-task": "^1.4", "symfony/http-kernel": "^2.8 || ^3.4 || ^4.0 || ^5.0", "symfony/dependency-injection": "^2.8 || ^3.4 || ^4.0 || ^5.0", "symfony/expression-language": "^2.8 || ^3.4 || ^4.0 || ^5.0",