Optimize fil_exists()

This commit is contained in:
Fabien Potencier
2020-04-24 09:48:53 +02:00
parent 050fdf54b8
commit f05ccdd657
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -38,7 +38,7 @@ class FilesystemCache implements CacheInterface
public function load(string $key): void
{
if (file_exists($key)) {
if (is_file($key)) {
@include_once $key;
}
}
@@ -78,7 +78,7 @@ class FilesystemCache implements CacheInterface
public function getTimestamp(string $key): int
{
if (!file_exists($key)) {
if (!is_file($key)) {
return 0;
}
+1 -1
View File
@@ -103,7 +103,7 @@ final class ExtensionSet
foreach ($this->extensions as $extension) {
$r = new \ReflectionObject($extension);
if (file_exists($r->getFileName()) && ($extensionTime = filemtime($r->getFileName())) > $this->lastModified) {
if (is_file($r->getFileName()) && ($extensionTime = filemtime($r->getFileName())) > $this->lastModified) {
$this->lastModified = $extensionTime;
}
}