Update AnnotationDirectoryLoader.php

This commit is contained in:
Tischoi 2014-06-25 22:19:01 +02:00 committed by Fabien Potencier
parent ff4b815fdf
commit 5e805850cc

View File

@ -66,12 +66,16 @@ class AnnotationDirectoryLoader extends AnnotationFileLoader
*/ */
public function supports($resource, $type = null) public function supports($resource, $type = null)
{ {
if (!is_string($resource)) {
return false;
}
try { try {
$path = $this->locator->locate($resource); $path = $this->locator->locate($resource);
} catch (\Exception $e) { } catch (\Exception $e) {
return false; return false;
} }
return is_string($resource) && is_dir($path) && (!$type || 'annotation' === $type); return is_dir($path) && (!$type || 'annotation' === $type);
} }
} }