From a76cf72766f0bf43bae842502b3a7f0e2f140e17 Mon Sep 17 00:00:00 2001 From: Jeroen de Graaf Date: Sat, 28 Sep 2019 10:12:31 +0200 Subject: [PATCH 1/2] Fix: do not display graphiz when argument is set false By default, addOptionalArgument discards an argument when the value evaluates to false. This results in the absence of the option in the final process command. In many cases, the absence of an option means false, but in the case of Deptrac's --formatter-graphviz-display it means true. The use of addOptionalArgument will never allow false, so unsetting this option in Deptrac is impossible. --- src/Task/Deptrac.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Task/Deptrac.php b/src/Task/Deptrac.php index 1c1ea3622..d1d6ddcd5 100644 --- a/src/Task/Deptrac.php +++ b/src/Task/Deptrac.php @@ -60,7 +60,7 @@ public function run(ContextInterface $context): TaskResultInterface $arguments = $this->processBuilder->createArgumentsForCommand('deptrac'); $arguments->add('analyze'); $arguments->add('--formatter-graphviz='.(int) $config['formatter_graphviz']); - $arguments->addOptionalArgument('--formatter-graphviz-display=%s', $config['formatter_graphviz_display']); + $arguments->add('--formatter-graphviz-display='.(int) $config['formatter_graphviz_display']); $arguments->addOptionalArgument('--formatter-graphviz-dump-image=%s', $config['formatter_graphviz_dump_image']); $arguments->addOptionalArgument('--formatter-graphviz-dump-dot=%s', $config['formatter_graphviz_dump_dot']); $arguments->addOptionalArgument('--formatter-graphviz-dump-html=%s', $config['formatter_graphviz_dump_html']); From ced29341a567bc5360d8131bd89eb85ab25144b0 Mon Sep 17 00:00:00 2001 From: Jeroen de Graaf Date: Tue, 15 Oct 2019 18:58:55 +0200 Subject: [PATCH 2/2] Set --formatter_graphviz_display true on default In order to have the same default value as Deptrac itself, the default for the option --formatter_graphviz_display is set to true. --- doc/tasks/deptrac.md | 2 +- src/Task/Deptrac.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/tasks/deptrac.md b/doc/tasks/deptrac.md index 7c8764ea4..44b52a026 100644 --- a/doc/tasks/deptrac.md +++ b/doc/tasks/deptrac.md @@ -34,7 +34,7 @@ Set to `true` to enable the graphviz formatter. **formatter_graphviz_display** -*Default: false* +*Default: true* Open the generated graphviz image. Set to `true` to activate. diff --git a/src/Task/Deptrac.php b/src/Task/Deptrac.php index d1d6ddcd5..a12038c51 100644 --- a/src/Task/Deptrac.php +++ b/src/Task/Deptrac.php @@ -27,7 +27,7 @@ public function getConfigurableOptions(): OptionsResolver $resolver->setDefaults([ 'depfile' => null, 'formatter_graphviz' => false, - 'formatter_graphviz_display' => false, + 'formatter_graphviz_display' => true, 'formatter_graphviz_dump_image' => null, 'formatter_graphviz_dump_dot' => null, 'formatter_graphviz_dump_html' => null,