Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/Symfony/Component/Filesystem/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function mkdir($dirs, $mode = 0777)
/**
* Creates empty files.
*
* @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to remove
* @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to create
*/
public function touch($files)
{
Expand All @@ -88,7 +88,7 @@ public function remove($files)
$files = iterator_to_array($this->toIterator($files));
$files = array_reverse($files);
foreach ($files as $file) {
if (!file_exists($file)) {
if (!file_exists($file) && !is_link($file)) {
continue;
}

Expand All @@ -105,7 +105,7 @@ public function remove($files)
/**
* Change mode for an array of files or directories.
*
* @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to remove
* @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to change mode
* @param integer $mode The new mode
* @param integer $umask The mode mask (octal)
*/
Expand Down Expand Up @@ -171,16 +171,16 @@ public function symlink($originDir, $targetDir, $copyOnWindows = false)
/**
* Given an existing path, convert it to a path relative to a given starting path
*
* @var string Absolute path of target
* @var string Absolute path where traversal begins
* @param string $endPath Absolute path of target
* @param string $startPath Absolute path where traversal begins
*
* @return string Path of target relative to starting path
*/
public function makePathRelative($endPath, $startPath)
{
// Find for which character the the common path stops
$offset = 0;
while ($startPath[$offset] === $endPath[$offset]) {
while (isset($startPath[$offset]) && isset($endPath[$offset]) && $startPath[$offset] === $endPath[$offset]) {
$offset++;
}

Expand Down Expand Up @@ -264,6 +264,11 @@ public function isAbsolutePath($file)
return false;
}

/**
* @param mixed $files
*
* @return \Traversable
*/
private function toIterator($files)
{
if (!$files instanceof \Traversable) {
Expand Down
Loading