src/Composer/Util/Filesystem.php
public function copyThenRemove($source, $target)
    {
        $this->copy($source, $target);
        if (!is_dir($source)) {
            $this->unlink($source);

            return;
        }

        $this->removeDirectoryPhp($source);
    }
public function copyThenRemove($source, $target)
    {
        $this->copy($source, $target);
        if (!is_dir($source)) {
            $this->unlink($source);

            return;
        }

        $this->removeDirectoryPhp($source);
    }
Copy then delete is a non-atomic version of {@link rename}.

Some systems can't rename and also don't have proc_open,
which requires this solution.

@param string $source
@param string $target