diff --git a/src/Illuminate/Console/Scheduling/Event.php b/src/Illuminate/Console/Scheduling/Event.php index d07cf57249d5..43081ea343ea 100644 --- a/src/Illuminate/Console/Scheduling/Event.php +++ b/src/Illuminate/Console/Scheduling/Event.php @@ -475,7 +475,7 @@ protected function ensureOutputIsBeingCaptured() */ protected function emailOutput(Mailer $mailer, $addresses, $onlyIfOutputExists = false) { - $text = file_exists($this->output) ? file_get_contents($this->output) : ''; + $text = is_file($this->output) ? file_get_contents($this->output) : ''; if ($onlyIfOutputExists && empty($text)) { return; @@ -833,7 +833,7 @@ public function onFailureWithOutput(Closure $callback, $onlyIfOutputExists = fal protected function withOutputCallback(Closure $callback, $onlyIfOutputExists = false) { return function (Container $container) use ($callback, $onlyIfOutputExists) { - $output = $this->output && file_exists($this->output) ? file_get_contents($this->output) : ''; + $output = $this->output && is_file($this->output) ? file_get_contents($this->output) : ''; return $onlyIfOutputExists && empty($output) ? null diff --git a/src/Illuminate/Database/Console/Migrations/MigrateCommand.php b/src/Illuminate/Database/Console/Migrations/MigrateCommand.php index dcc8ac045886..f547d8d5e80e 100755 --- a/src/Illuminate/Database/Console/Migrations/MigrateCommand.php +++ b/src/Illuminate/Database/Console/Migrations/MigrateCommand.php @@ -129,7 +129,7 @@ protected function loadSchemaState() // continue with the standard migration operation as normal without errors. if ($connection instanceof SQLiteConnection || $connection instanceof SqlServerConnection || - ! file_exists($path = $this->schemaPath($connection))) { + ! is_file($path = $this->schemaPath($connection))) { return; } diff --git a/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php b/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php index a0e006dd494d..aef7a77e6b1d 100644 --- a/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php +++ b/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php @@ -55,7 +55,7 @@ protected function getStub() */ protected function resolveStubPath($stub) { - return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) + return is_file($customPath = $this->laravel->basePath(trim($stub, '/'))) ? $customPath : __DIR__.$stub; } diff --git a/src/Illuminate/Foundation/AliasLoader.php b/src/Illuminate/Foundation/AliasLoader.php index 63f38913df1c..4f338050a121 100755 --- a/src/Illuminate/Foundation/AliasLoader.php +++ b/src/Illuminate/Foundation/AliasLoader.php @@ -100,7 +100,7 @@ protected function loadFacade($alias) */ protected function ensureFacadeExists($alias) { - if (file_exists($path = storage_path('framework/cache/facade-'.sha1($alias).'.php'))) { + if (is_file($path = storage_path('framework/cache/facade-'.sha1($alias).'.php'))) { return $path; } diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index ef97c132dad8..a19ba0892920 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -957,7 +957,7 @@ public function getCachedPackagesPath() */ public function configurationIsCached() { - return file_exists($this->getCachedConfigPath()); + return is_file($this->getCachedConfigPath()); } /** @@ -1048,7 +1048,7 @@ public function addAbsoluteCachePathPrefix($prefix) */ public function isDownForMaintenance() { - return file_exists($this->storagePath().'/framework/down'); + return is_file($this->storagePath().'/framework/down'); } /** diff --git a/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php b/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php index 501a1eea45f5..babbcd3b8b3e 100644 --- a/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php +++ b/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php @@ -24,7 +24,7 @@ public function bootstrap(Application $app) // First we will see if we have a cache configuration file. If we do, we'll load // the configuration items from that file so that it is very quick. Otherwise // we will need to spin through every configuration file and load them all. - if (file_exists($cached = $app->getCachedConfigPath())) { + if (is_file($cached = $app->getCachedConfigPath())) { $items = require $cached; $loadedFromCache = true; diff --git a/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php b/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php index 1bf3f8b8442e..7cf414577a4a 100644 --- a/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php +++ b/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php @@ -68,7 +68,7 @@ protected function checkForSpecificEnvironmentFile($app) */ protected function setEnvironmentFilePath($app, $file) { - if (file_exists($app->environmentPath().'/'.$file)) { + if (is_file($app->environmentPath().'/'.$file)) { $app->loadEnvironmentFrom($file); return true; diff --git a/src/Illuminate/Foundation/ComposerScripts.php b/src/Illuminate/Foundation/ComposerScripts.php index fcda187fd261..6a5f0df49199 100644 --- a/src/Illuminate/Foundation/ComposerScripts.php +++ b/src/Illuminate/Foundation/ComposerScripts.php @@ -54,11 +54,11 @@ protected static function clearCompiled() { $laravel = new Application(getcwd()); - if (file_exists($servicesPath = $laravel->getCachedServicesPath())) { + if (is_file($servicesPath = $laravel->getCachedServicesPath())) { @unlink($servicesPath); } - if (file_exists($packagesPath = $laravel->getCachedPackagesPath())) { + if (is_file($packagesPath = $laravel->getCachedPackagesPath())) { @unlink($packagesPath); } } diff --git a/src/Illuminate/Foundation/Console/ClearCompiledCommand.php b/src/Illuminate/Foundation/Console/ClearCompiledCommand.php index 399a44dc5436..87ea044b823a 100644 --- a/src/Illuminate/Foundation/Console/ClearCompiledCommand.php +++ b/src/Illuminate/Foundation/Console/ClearCompiledCommand.php @@ -27,11 +27,11 @@ class ClearCompiledCommand extends Command */ public function handle() { - if (file_exists($servicesPath = $this->laravel->getCachedServicesPath())) { + if (is_file($servicesPath = $this->laravel->getCachedServicesPath())) { @unlink($servicesPath); } - if (file_exists($packagesPath = $this->laravel->getCachedPackagesPath())) { + if (is_file($packagesPath = $this->laravel->getCachedPackagesPath())) { @unlink($packagesPath); } diff --git a/src/Illuminate/Foundation/Console/DownCommand.php b/src/Illuminate/Foundation/Console/DownCommand.php index 010f95eff2f9..2efe4c6c3c10 100644 --- a/src/Illuminate/Foundation/Console/DownCommand.php +++ b/src/Illuminate/Foundation/Console/DownCommand.php @@ -34,7 +34,7 @@ class DownCommand extends Command public function handle() { try { - if (file_exists(storage_path('framework/down'))) { + if (is_file(storage_path('framework/down'))) { $this->comment('Application is already down.'); return 0; diff --git a/src/Illuminate/Foundation/Console/UpCommand.php b/src/Illuminate/Foundation/Console/UpCommand.php index ba02040511f8..159f9e1b7c21 100644 --- a/src/Illuminate/Foundation/Console/UpCommand.php +++ b/src/Illuminate/Foundation/Console/UpCommand.php @@ -29,7 +29,7 @@ class UpCommand extends Command public function handle() { try { - if (! file_exists(storage_path('framework/down'))) { + if (! is_file(storage_path('framework/down'))) { $this->comment('Application is already up.'); return 0; diff --git a/src/Illuminate/Foundation/Mix.php b/src/Illuminate/Foundation/Mix.php index 271d7dbd6843..9a1eb7c95451 100644 --- a/src/Illuminate/Foundation/Mix.php +++ b/src/Illuminate/Foundation/Mix.php @@ -29,7 +29,7 @@ public function __invoke($path, $manifestDirectory = '') $manifestDirectory = "/{$manifestDirectory}"; } - if (file_exists(public_path($manifestDirectory.'/hot'))) { + if (is_file(public_path($manifestDirectory.'/hot'))) { $url = rtrim(file_get_contents(public_path($manifestDirectory.'/hot'))); if (Str::startsWith($url, ['http://', 'https://'])) { @@ -42,7 +42,7 @@ public function __invoke($path, $manifestDirectory = '') $manifestPath = public_path($manifestDirectory.'/mix-manifest.json'); if (! isset($manifests[$manifestPath])) { - if (! file_exists($manifestPath)) { + if (! is_file($manifestPath)) { throw new Exception('The Mix manifest does not exist.'); } diff --git a/src/Illuminate/Foundation/PackageManifest.php b/src/Illuminate/Foundation/PackageManifest.php index 9356cef026bb..202a8beb271d 100644 --- a/src/Illuminate/Foundation/PackageManifest.php +++ b/src/Illuminate/Foundation/PackageManifest.php @@ -102,11 +102,11 @@ protected function getManifest() return $this->manifest; } - if (! file_exists($this->manifestPath)) { + if (! is_file($this->manifestPath)) { $this->build(); } - return $this->manifest = file_exists($this->manifestPath) ? + return $this->manifest = is_file($this->manifestPath) ? $this->files->getRequire($this->manifestPath) : []; } @@ -154,7 +154,7 @@ protected function format($package) */ protected function packagesToIgnore() { - if (! file_exists($this->basePath.'/composer.json')) { + if (! is_file($this->basePath.'/composer.json')) { return []; } diff --git a/src/Illuminate/View/Component.php b/src/Illuminate/View/Component.php index 865653c4b0e9..18dbe56375af 100644 --- a/src/Illuminate/View/Component.php +++ b/src/Illuminate/View/Component.php @@ -94,7 +94,7 @@ protected function createBladeViewFromString($factory, $contents) $directory = Container::getInstance()['config']->get('view.compiled') ); - if (! file_exists($viewFile = $directory.'/'.sha1($contents).'.blade.php')) { + if (! is_file($viewFile = $directory.'/'.sha1($contents).'.blade.php')) { if (! is_dir($directory)) { mkdir($directory, 0755, true); }