Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Tells whether the filename is a symbolic link
<?php is_link(string $filename): bool
<?php             $targetDir = $im->getInstallPath($package);



            if ($downloader instanceof ChangeReportInterface) {

                if (is_link($targetDir)) {

                    $errors[$targetDir] = $targetDir . ' is a symbolic link.';

                }
<?php             $this->initializeBinDir();

            $link = $this->binDir.'/'.basename($bin);

            if (file_exists($link)) {

                if (!is_link($link)) {

                    if ($warnOnOverwrite) {

                        $this->io->writeError('    Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');

                    }
<?php         }

        foreach ($binaries as $bin) {

            $link = $this->binDir.'/'.basename($bin);

            if (is_link($link) || file_exists($link)) { // still checking for symlinks here for legacy support

                $this->filesystem->unlink($link);

            }

            if (is_file($link.'.bat')) {
<?php             return true;

        }



        return (Platform::isWindows() && $this->filesystem->isJunction($installPath)) || is_link($installPath);

    }
<?php         if ($dh = opendir($dir)) {

            while ($file = readdir($dh)) {

                if ($file !== '.' && $file !== '..') {

                    if (is_link($dir.'/'.$file)) {

                        $array[$dir][$file] = readlink($dir.'/'.$file);

                    } elseif (is_dir($dir.'/'.$file)) {

                        if (!count($array)) {
<?php     public function emptyDirectory($dir, $ensureDirectoryExists = true)

    {

        if (is_link($dir) && file_exists($dir)) {

            $this->unlink($dir);

        }
<?php             return $this->removeJunction($directory);

        }



        if (is_link($directory)) {

            return unlink($directory);

        }
<?php     private function unlinkImplementation($path)

    {

        if (Platform::isWindows() && is_dir($path) && is_link($path)) {

            return rmdir($path);

        }
<?php         $resolved = $this->resolveSymlinkedDirectorySymlink($directory);



        return is_link($resolved);

    }
<?php         clearstatcache(true, $junction);



        if (!is_dir($junction) || is_link($junction)) {

            return false;

        }
<?php         }

        $files = array_reverse($files);

        foreach ($files as $file) {

            if (is_link($file)) {


                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);
<?php             if ((\PHP_VERSION_ID < 80000 || \is_int($mode)) && true !== @chmod($file, $mode & ~$umask)) {

                throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);

            }

            if ($recursive && is_dir($file) && !is_link($file)) {

                $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);

            }

        }
<?php     public function chown($files, $user, bool $recursive = false)

    {

        foreach ($this->toIterable($files) as $file) {

            if ($recursive && is_dir($file) && !is_link($file)) {

                $this->chown(new \FilesystemIterator($file), $user, true);

            }

            if (is_link($file) && \function_exists('lchown')) {
<?php             if ($recursive && is_dir($file) && !is_link($file)) {

                $this->chown(new \FilesystemIterator($file), $user, true);

            }

            if (is_link($file) && \function_exists('lchown')) {

                if (true !== @lchown($file, $user)) {

                    throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);

                }
<?php     public function chgrp($files, $group, bool $recursive = false)

    {

        foreach ($this->toIterable($files) as $file) {

            if ($recursive && is_dir($file) && !is_link($file)) {

                $this->chgrp(new \FilesystemIterator($file), $group, true);

            }

            if (is_link($file) && \function_exists('lchgrp')) {