file_exists

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Checks whether a file or directory exists
<?php file_exists(string $filename): bool
<?php     foreach ($composerAutoloadFiles as $file) {



        if (file_exists($file)) {

            require_once $file;

            define('PHPUNIT_COMPOSER_INSTALL', $file);
<?php         foreach (self::STRUCTURE as $filename) {

            $filename = sprintf('%s%s%s', $testsPath, DIRECTORY_SEPARATOR, $filename);



            if (! file_exists($filename)) {

                continue;

            }
<?php         if (! Str::endsWith($filename, '.php')) {

            return;

        }

        if (! file_exists($filename)) {

            return;

        }

        include_once $filename;
<?php         foreach (self::FILES as $file) {

            $file = __DIR__."/../../overrides/$file";



            if (! file_exists($file)) {

                throw ShouldNotHappen::fromMessage(sprintf('File [%s] does not exist.', $file));

            }
<?php             $toPath = "{$this->testSuite->rootPath}/{$to}";



            if (file_exists($toPath)) {

                View::render('components.two-column-detail', [

                    'left' => $to,

                    'right' => 'File already exists.',
<?php     {

        $lockFile = self::TEMPORARY_FOLDER.DIRECTORY_SEPARATOR.'only.lock';



        if (file_exists($lockFile)) {

            unlink($lockFile);

        }

    }
<?php         $lockFile = self::TEMPORARY_FOLDER.DIRECTORY_SEPARATOR.'only.lock';



        if (! file_exists($lockFile)) {

            touch($lockFile);

        }

    }
<?php     {

        $lockFile = self::TEMPORARY_FOLDER.DIRECTORY_SEPARATOR.'only.lock';



        return file_exists($lockFile);

    }

}
<?php     public function has(): bool

    {

        return file_exists($this->getSnapshotFilename());

    }
<?php     {

        $snapshotFilename = $this->getSnapshotFilename();



        if (! file_exists(dirname($snapshotFilename))) {

            mkdir(dirname($snapshotFilename), 0755, true);

        }
<?php         $absoluteSnapshotsPath = $this->testsPath.'/'.$this->snapshotsPath;



        $deleteDirectory = function (string $path) use (&$deleteDirectory): void {

            if (file_exists($path)) {

                $scannedDir = scandir($path);

                assert(is_array($scannedDir));
<?php             }

        };



        if (file_exists($absoluteSnapshotsPath)) {

            $deleteDirectory($absoluteSnapshotsPath);

        }

    }
<?php     public static function report(OutputInterface $output): float

    {

        if (! file_exists($reportPath = self::getPath())) {

            if (self::usingXdebug()) {

                $output->writeln(

                    "  <fg=black;bg=yellow;options=bold> WARN </> Unable to get coverage using Xdebug. Did you set <href=https://xdebug.org/docs/code_coverage#mode>Xdebug's coverage mode</>?</>",