diff --git a/lib/Doctrine/Common/Annotations/AnnotationRegistry.php b/lib/Doctrine/Common/Annotations/AnnotationRegistry.php index dfa846a04..6135f53d3 100644 --- a/lib/Doctrine/Common/Annotations/AnnotationRegistry.php +++ b/lib/Doctrine/Common/Annotations/AnnotationRegistry.php @@ -120,7 +120,7 @@ static public function loadAnnotationClass($class) } } else { foreach((array)$dirs AS $dir) { - if (file_exists($dir . DIRECTORY_SEPARATOR . $file)) { + if (is_file($dir . DIRECTORY_SEPARATOR . $file)) { require $dir . DIRECTORY_SEPARATOR . $file; return true; } diff --git a/lib/Doctrine/Common/Annotations/FileCacheReader.php b/lib/Doctrine/Common/Annotations/FileCacheReader.php index 215036b17..53c52b11d 100644 --- a/lib/Doctrine/Common/Annotations/FileCacheReader.php +++ b/lib/Doctrine/Common/Annotations/FileCacheReader.php @@ -91,7 +91,7 @@ public function getClassAnnotations(\ReflectionClass $class) } $path = $this->dir.'/'.strtr($key, '\\', '-').'.cache.php'; - if (!file_exists($path)) { + if (!is_file($path)) { $annot = $this->reader->getClassAnnotations($class); $this->saveCacheFile($path, $annot); return $this->loadedAnnotations[$key] = $annot; @@ -129,7 +129,7 @@ public function getPropertyAnnotations(\ReflectionProperty $property) } $path = $this->dir.'/'.strtr($key, '\\', '-').'.cache.php'; - if (!file_exists($path)) { + if (!is_file($path)) { $annot = $this->reader->getPropertyAnnotations($property); $this->saveCacheFile($path, $annot); return $this->loadedAnnotations[$key] = $annot; @@ -167,7 +167,7 @@ public function getMethodAnnotations(\ReflectionMethod $method) } $path = $this->dir.'/'.strtr($key, '\\', '-').'.cache.php'; - if (!file_exists($path)) { + if (!is_file($path)) { $annot = $this->reader->getMethodAnnotations($method); $this->saveCacheFile($path, $annot); return $this->loadedAnnotations[$key] = $annot; diff --git a/lib/Doctrine/Common/Annotations/PhpParser.php b/lib/Doctrine/Common/Annotations/PhpParser.php index 7d38b3322..d5cfd345d 100644 --- a/lib/Doctrine/Common/Annotations/PhpParser.php +++ b/lib/Doctrine/Common/Annotations/PhpParser.php @@ -46,7 +46,7 @@ public function parseClass(\ReflectionClass $class) } $content = $this->getFileContent($filename, $class->getStartLine()); - + if (null === $content) { return array(); } @@ -69,7 +69,7 @@ public function parseClass(\ReflectionClass $class) */ private function getFileContent($filename, $lineNumber) { - if ( ! file_exists($filename)) { + if ( ! is_file($filename)) { return null; } diff --git a/lib/Doctrine/Common/Cache/FilesystemCache.php b/lib/Doctrine/Common/Cache/FilesystemCache.php index a27a7176b..a431438e2 100644 --- a/lib/Doctrine/Common/Cache/FilesystemCache.php +++ b/lib/Doctrine/Common/Cache/FilesystemCache.php @@ -44,7 +44,7 @@ protected function doFetch($id) $lifetime = -1; $filename = $this->getFilename($id); - if ( ! file_exists($filename)) { + if ( ! is_file($filename)) { return false; } @@ -77,7 +77,7 @@ protected function doContains($id) $lifetime = -1; $filename = $this->getFilename($id); - if ( ! file_exists($filename)) { + if ( ! is_file($filename)) { return false; } diff --git a/lib/Doctrine/Common/Cache/PhpFileCache.php b/lib/Doctrine/Common/Cache/PhpFileCache.php index 0971cd967..1d69d3d66 100644 --- a/lib/Doctrine/Common/Cache/PhpFileCache.php +++ b/lib/Doctrine/Common/Cache/PhpFileCache.php @@ -42,7 +42,7 @@ protected function doFetch($id) { $filename = $this->getFilename($id); - if ( ! file_exists($filename)) { + if ( ! is_file($filename)) { return false; } @@ -62,7 +62,7 @@ protected function doContains($id) { $filename = $this->getFilename($id); - if ( ! file_exists($filename)) { + if ( ! is_file($filename)) { return false; } diff --git a/lib/Doctrine/Common/ClassLoader.php b/lib/Doctrine/Common/ClassLoader.php index 7ae7ea83d..159f453f8 100644 --- a/lib/Doctrine/Common/ClassLoader.php +++ b/lib/Doctrine/Common/ClassLoader.php @@ -181,7 +181,7 @@ public function canLoadClass($className) $file = str_replace($this->namespaceSeparator, DIRECTORY_SEPARATOR, $className) . $this->fileExtension; if ($this->includePath !== null) { - return file_exists($this->includePath . DIRECTORY_SEPARATOR . $file); + return is_file($this->includePath . DIRECTORY_SEPARATOR . $file); } return (false !== stream_resolve_include_path($file)); diff --git a/lib/Doctrine/Common/Persistence/Mapping/Driver/DefaultFileLocator.php b/lib/Doctrine/Common/Persistence/Mapping/Driver/DefaultFileLocator.php index 0d61174fe..c278c7f5d 100644 --- a/lib/Doctrine/Common/Persistence/Mapping/Driver/DefaultFileLocator.php +++ b/lib/Doctrine/Common/Persistence/Mapping/Driver/DefaultFileLocator.php @@ -109,7 +109,7 @@ public function findMappingFile($className) // Check whether file exists foreach ($this->paths as $path) { - if (file_exists($path . DIRECTORY_SEPARATOR . $fileName)) { + if (is_file($path . DIRECTORY_SEPARATOR . $fileName)) { return $path . DIRECTORY_SEPARATOR . $fileName; } } @@ -160,7 +160,7 @@ public function fileExists($className) // Check whether file exists foreach ((array) $this->paths as $path) { - if (file_exists($path . DIRECTORY_SEPARATOR . $fileName)) { + if (is_file($path . DIRECTORY_SEPARATOR . $fileName)) { return true; } } diff --git a/lib/Doctrine/Common/Reflection/Psr0FindFile.php b/lib/Doctrine/Common/Reflection/Psr0FindFile.php index b6a5fd112..d29bbc550 100644 --- a/lib/Doctrine/Common/Reflection/Psr0FindFile.php +++ b/lib/Doctrine/Common/Reflection/Psr0FindFile.php @@ -73,7 +73,7 @@ public function findFile($class) foreach ($this->prefixes as $prefix => $dirs) { if (0 === strpos($class, $prefix)) { foreach ($dirs as $dir) { - if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) { + if (is_file($dir . DIRECTORY_SEPARATOR . $classPath)) { return $dir . DIRECTORY_SEPARATOR . $classPath; } } diff --git a/tests/Doctrine/Tests/TestInit.php b/tests/Doctrine/Tests/TestInit.php index e7ab51f3a..8fa5fe85c 100644 --- a/tests/Doctrine/Tests/TestInit.php +++ b/tests/Doctrine/Tests/TestInit.php @@ -11,14 +11,14 @@ { if (0 === strpos($class, 'Doctrine\Tests\\')) { $path = __DIR__.'/../../'.strtr($class, '\\', '/').'.php'; - if (file_exists($path) && is_readable($path)) { + if (is_file($path) && is_readable($path)) { require_once $path; return true; } } else if (0 === strpos($class, 'Doctrine\Common\\')) { $path = __DIR__.'/../../../lib/'.($class = strtr($class, '\\', '/')).'.php'; - if (file_exists($path) && is_readable($path)) { + if (is_file($path) && is_readable($path)) { require_once $path; return true; diff --git a/tests/NativePhpunitTask.php b/tests/NativePhpunitTask.php index 50fd1c3d4..f21a6f914 100644 --- a/tests/NativePhpunitTask.php +++ b/tests/NativePhpunitTask.php @@ -124,7 +124,7 @@ public function main() "failures (".$result->skippedCount()." skipped, ".$result->notImplementedCount()." not implemented)"); // Hudson for example doesn't like the backslash in class names - if (file_exists($this->coverageClover)) { + if (is_file($this->coverageClover)) { $this->log("Generated Clover Coverage XML to: ".$this->coverageClover); $content = file_get_contents($this->coverageClover); $content = str_replace("\\", ".", $content);