Skip to content

Commit f2d9dae

Browse files
committed
Runner::setTempDirectory() accepts null
1 parent 721dc05 commit f2d9dae

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/Runner/Runner.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,22 @@ public function getEnvironmentVariables()
8080

8181

8282
/**
83-
* @param string
83+
* @param string|null
8484
*/
8585
public function setTempDirectory($path)
8686
{
87-
if (!is_dir($path) || !is_writable($path)) {
88-
throw new \RuntimeException("Path '$path' is not a writable directory.");
89-
}
87+
if ($path !== null) {
88+
if (!is_dir($path) || !is_writable($path)) {
89+
throw new \RuntimeException("Path '$path' is not a writable directory.");
90+
}
9091

91-
$tempDir = realpath($path) . DIRECTORY_SEPARATOR . 'Tester';
92-
if (!is_dir($tempDir) && @mkdir($tempDir) === false && !is_dir($tempDir)) { // @ - directory may exist
93-
throw new \RuntimeException("Cannot create '$tempDir' directory.");
92+
$path = realpath($path) . DIRECTORY_SEPARATOR . 'Tester';
93+
if (!is_dir($path) && @mkdir($path) === false && !is_dir($path)) { // @ - directory may exist
94+
throw new \RuntimeException("Cannot create '$path' directory.");
95+
}
9496
}
9597

96-
$this->tempDir = $tempDir;
98+
$this->tempDir = $path;
9799
}
98100

99101

0 commit comments

Comments
 (0)