Skip to content

Commit

Permalink
FIX Method CopyMethod::copy as deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabina Talipova committed Oct 26, 2023
1 parent 0acac2f commit a607d10
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Methods/CopyMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use RuntimeException;
use SilverStripe\Dev\Deprecation;

/**
* Expose the vendor module resources via a file copy
Expand All @@ -30,22 +31,24 @@ public function exposeDirectory($source, $target)
$this->filesystem->removeDirectory($target);

// Copy to destination
if (!$this->copy($source, $target)) {
if (!$this->filesystem->copy($source, $target)) {
throw new RuntimeException("Could not write to directory $target");
}
}

/**
* Copies a file or directory from $source to $target.
*
* @todo Replace with `$this->filesystem->copy() once composer 1.6.0 is released
*
* @param string $source
* @param string $target
* @deprecated 5.2 Use Filesystem::copy instead
* @return bool
*/
public function copy($source, $target)
{
Deprecation::notice('5.2', 'Use Filesystem::copy instead', Deprecation::SCOPE_METHOD);

if (!is_dir($source ?? '')) {
return copy($source ?? '', $target ?? '');
}
Expand Down

0 comments on commit a607d10

Please sign in to comment.