diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index af26ef4c6f79d..877ba9e842e58 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -100,12 +100,9 @@ public function exists($files) */ public function touch($files, $time = null, $atime = null) { - if (null === $time) { - $time = time(); - } - foreach ($this->toIterator($files) as $file) { - if (true !== @touch($file, $time, $atime)) { + $touch = $time ? @touch($file, $time, $atime) : @touch($file); + if (true !== $touch) { throw new IOException(sprintf('Failed to touch %s', $file)); } }