Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Tells whether the filename is a regular file
<?php is_file(string $filename): bool
<?php     {

        $basePath = $path;

        if (is_string($path)) {

            if (is_file($path)) {

                $path = array(new \SplFileInfo($path));

            } elseif (is_dir($path) || strpos($path, '*') !== false) {

                $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
<?php             $installedFromVcs = false;

        }



        if ($repositories !== null && $addRepository && is_file('composer.lock')) {

            unlink('composer.lock');

        }
<?php         }



        $file = Factory::getComposerFile();

        if (is_file($file) && Filesystem::isReadable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {

            if (!empty($composer['minimum-stability'])) {

                return VersionParser::normalizeStability($composer['minimum-stability']);

            }
<?php         $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;



        if (!is_file($oldFile)) {

            throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');

        }

        if (!Filesystem::isReadable($oldFile)) {
<?php             $file = Factory::getComposerFile();

            if (is_file($file) && Filesystem::isReadable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {

                if (isset($composer['scripts']) && is_array($composer['scripts'])) {

                    foreach ($composer['scripts'] as $script => $dummy) {

                        if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
<?php     protected function hasMetadataRepository($path)

    {

        return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');

    }

}
<?php                 throw $processError;

            }



            if (!is_file($file)) {

                $io->writeError('    <warning>'.$processError->getMessage().'</warning>');

                $io->writeError('    <warning>This most likely is due to a custom installer plugin not handling the returned Promise from the downloader</warning>');

                $io->writeError('    <warning>See https://github.com/composer/installers/commit/5006d0c28730ade233a8f42ec31ac68fb1c5c9bb for an example fix</warning>');
<?php             foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {

                if (isset(self::$installedByVendor[$vendorDir])) {

                    $installed[] = self::$installedByVendor[$vendorDir];

                } elseif (is_file($vendorDir.'/composer/installed.php')) {

                    $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';

                    if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {

                        self::$installed = $installed[count($installed) - 1];
<?php             if (is_link($link) || file_exists($link)) { // still checking for symlinks here for legacy support

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

            }

            if (is_file($link.'.bat')) {

                $this->filesystem->unlink($link.'.bat');

            }

        }
<?php     public function exists()

    {

        return is_file($this->path);

    }
<?php                         if (!$this->doTree($dir.'/'.$file, $array)) {

                            return false;

                        }

                    } elseif (is_file($dir.'/'.$file) && filesize($dir.'/'.$file)) {

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

                    }

                }
<?php         }




        if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {

            if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {

                $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');

            }
<?php             return true;

        }



        if (is_file($path)) {

            return false !== Silencer::call('file_get_contents', $path, false, null, 0, 1);

        }
<?php         $this->assertAutoloadFiles('classmap7', $this->vendorDir.'/composer', 'classmap');




        $this->assertFalse(is_file($this->vendorDir.'/composer/autoload_files.php'));

    }



    public function testVendorDirSameAsWorkingDir()
<?php             if (is_dir($path)) {

                $fs = new Filesystem();

                $fs->removeDirectory($path);

            } elseif (is_file($path)) {

                unlink($path);

            }

            $this->assertInstanceOf('RuntimeException', $e);