public function remove(string|iterable
$files) { if ($files instanceof \Traversable
) { $files =
iterator_to_array($files, false
);
} elseif (!\
is_array($files)) { $files =
[$files];
} self::
doRemove($files, false
);
} private static function doRemove(array
$files, bool
$isRecursive): void
{ $files =
array_reverse($files);
foreach ($files as $file) { if (is_link($file)) { // See https://bugs.php.net/52176
if (!
(self::
box('unlink',
$file) || '\\' !== \DIRECTORY_SEPARATOR || self::
box('rmdir',
$file)) &&
file_exists($file)) { throw new IOException(sprintf('Failed to remove symlink "%s": ',
$file).self::
$lastError);
} }