Skip to content

Commit d00202a

Browse files
Use is_file() instead of file_exists() where possible
1 parent ce6bcb4 commit d00202a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Kernel.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,12 @@ public function getProjectDir()
280280
if (null === $this->projectDir) {
281281
$r = new \ReflectionObject($this);
282282

283-
if (!file_exists($dir = $r->getFileName())) {
283+
if (!is_file($dir = $r->getFileName())) {
284284
throw new \LogicException(sprintf('Cannot auto-detect project dir for kernel of class "%s".', $r->name));
285285
}
286286

287287
$dir = $rootDir = \dirname($dir);
288-
while (!file_exists($dir.'/composer.json')) {
288+
while (!is_file($dir.'/composer.json')) {
289289
if ($dir === \dirname($dir)) {
290290
return $this->projectDir = $rootDir;
291291
}
@@ -432,7 +432,7 @@ protected function initializeContainer()
432432
$errorLevel = error_reporting(E_ALL ^ E_WARNING);
433433

434434
try {
435-
if (file_exists($cachePath) && \is_object($this->container = include $cachePath)
435+
if (is_file($cachePath) && \is_object($this->container = include $cachePath)
436436
&& (!$this->debug || (self::$freshCache[$cachePath] ?? $cache->isFresh()))
437437
) {
438438
self::$freshCache[$cachePath] = true;

0 commit comments

Comments
 (0)