From 9ad67caea501f34ab65b38573d5dcec7ba9fd371 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 16 Mar 2016 15:32:55 +0100 Subject: [PATCH] Improved the PHPdoc of FileSystem::copy() --- src/Symfony/Component/Filesystem/Filesystem.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index d800bd72fc..dcef5c64ae 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -23,17 +23,17 @@ class Filesystem /** * Copies a file. * - * This method only copies the file if the origin file is newer than the target file. + * If the target file is older than the origin file, it's always overwritten. + * If the target file is newer, it is overwritten only when the + * $overwriteNewerFiles option is set to true. * - * By default, if the target already exists, it is not overridden. - * - * @param string $originFile The original filename - * @param string $targetFile The target filename - * @param bool $override Whether to override an existing file or not + * @param string $originFile The original filename + * @param string $targetFile The target filename + * @param bool $overwriteNewerFiles If true, target files newer than origin files are overwritten * * @throws IOException When copy fails */ - public function copy($originFile, $targetFile, $override = false) + public function copy($originFile, $targetFile, $overwriteNewerFiles = false) { if (stream_is_local($originFile) && !is_file($originFile)) { throw new IOException(sprintf('Failed to copy %s because file not exists', $originFile)); @@ -42,7 +42,7 @@ class Filesystem $this->mkdir(dirname($targetFile)); $doCopy = true; - if (!$override && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) { + if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) { $doCopy = filemtime($originFile) > filemtime($targetFile); }