Skip to content

Commit 5eaa30d

Browse files
authored
Merge pull request #362 from bearsunday/dot
Suppress warning when dot command not exists
2 parents a4d1c1b + a9c39bc commit 5eaa30d

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/Compiler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function compile(): int
120120
printf("Compilation (1/2) took %f seconds and used %fMB of memory\n", $time, $memory);
121121
printf("Success: %d Failed: %d\n", $this->newInstance->getCompiled(), count($this->newInstance->getFailed()));
122122
printf("Preload compile: %s\n", $this->dumpAutoload->getFileInfo($preload));
123-
printf("Object graph diagram: %s\n", $dot ? realpath($this->dumpAutoload->getFileInfo($dot)) : 'n/a');
123+
printf("Object graph diagram: %s\n", realpath($dot));
124124
foreach ($this->newInstance->getFailed() as $depedencyIndex => $error) {
125125
printf("UNBOUND: %s for %s \n", $error, $depedencyIndex);
126126
}

src/Compiler/CompileObjectGraph.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,15 @@ public function __invoke(AbstractModule $module): string
3131
($this->filePutContents)($dotFile, (new ObjectGrapher())($module));
3232
$svgFile = str_replace('.dot', '.svg', $dotFile);
3333
$cmd = "dot -Tsvg {$dotFile} -o {$svgFile}";
34-
passthru($cmd, $status);
34+
passthru('which dotsrc/Compiler/FakeRun.php 2>/dev/null', $status);
3535
// @codeCoverageIgnoreStart
3636
if ($status === 0) {
37+
passthru($cmd, $status);
38+
3739
return $svgFile;
3840
}
3941

4042
return $dotFile;
43+
// @codeCoverageIgnoreEnd
4144
}
4245
}

src/Compiler/FakeRun.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
use function assert;
2020
use function class_exists;
21-
use function is_callable;
2221
use function is_object;
2322
use function ob_end_clean;
2423
use function ob_start;
@@ -55,8 +54,7 @@ public function __invoke(): void
5554
$_SERVER['HTTP_IF_NONE_MATCH'] = '0';
5655
$_SERVER['REQUEST_URI'] = '/';
5756
$_SERVER['REQUEST_METHOD'] = 'GET';
58-
assert(is_callable($bootstrap));
59-
/** @psalm-suppress PossiblyUndefinedVariable */
57+
/** @psalm-suppress MixedArgumentTypeCoercion */
6058
($bootstrap)($this->appMeta->name, $this->context, $GLOBALS, $_SERVER); // 200 OK
6159
$_SERVER['REQUEST_METHOD'] = 'DELETE';
6260
$app = $this->injector->getInstance(AppInterface::class);

0 commit comments

Comments
 (0)