Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0eae562

Browse filesBrowse files
committed
converted file_exists calls to either is_file or is_dir where it makes sense
1 parent 4e70b1a commit 0eae562
Copy full SHA for 0eae562

File tree

Expand file treeCollapse file tree

26 files changed

+46
-46
lines changed
Filter options
Expand file treeCollapse file tree

26 files changed

+46
-46
lines changed

‎src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function warmUp($cacheDir)
5050
{
5151
foreach ($this->registry->getEntityManagers() as $em) {
5252
// we need the directory no matter the proxy cache generation strategy
53-
if (!file_exists($proxyCacheDir = $em->getConfiguration()->getProxyDir())) {
53+
if (!is_dir($proxyCacheDir = $em->getConfiguration()->getProxyDir())) {
5454
if (false === @mkdir($proxyCacheDir, 0777, true)) {
5555
throw new \RuntimeException(sprintf('Unable to create the Doctrine Proxy directory "%s".', dirname($proxyCacheDir)));
5656
}

‎src/Symfony/Bridge/Doctrine/Mapping/Driver/XmlDriver.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Mapping/Driver/XmlDriver.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ protected function initialize()
123123
$this->_classCache = array();
124124
if (null !== $this->_globalBasename) {
125125
foreach ($this->_paths as $path) {
126-
if (file_exists($file = $path.'/'.$this->_globalBasename.$this->_fileExtension)) {
126+
if (is_file($file = $path.'/'.$this->_globalBasename.$this->_fileExtension)) {
127127
$this->_classCache = array_merge($this->_classCache, $this->_loadMappingFile($file));
128128
}
129129
}
@@ -135,7 +135,7 @@ protected function _findMappingFile($className)
135135
$defaultFileName = str_replace('\\', '.', $className).$this->_fileExtension;
136136
foreach ($this->_paths as $path) {
137137
if (!isset($this->_prefixes[$path])) {
138-
if (file_exists($path.DIRECTORY_SEPARATOR.$defaultFileName)) {
138+
if (is_file($path.DIRECTORY_SEPARATOR.$defaultFileName)) {
139139
return $path.DIRECTORY_SEPARATOR.$defaultFileName;
140140
}
141141

@@ -149,7 +149,7 @@ protected function _findMappingFile($className)
149149
}
150150

151151
$filename = $path.'/'.strtr(substr($className, strlen($prefix)+1), '\\', '.').$this->_fileExtension;
152-
if (file_exists($filename)) {
152+
if (is_file($filename)) {
153153
return $filename;
154154
}
155155

‎src/Symfony/Bridge/Doctrine/Mapping/Driver/YamlDriver.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Mapping/Driver/YamlDriver.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ protected function initialize()
123123
$this->_classCache = array();
124124
if (null !== $this->_globalBasename) {
125125
foreach ($this->_paths as $path) {
126-
if (file_exists($file = $path.'/'.$this->_globalBasename.$this->_fileExtension)) {
126+
if (is_file($file = $path.'/'.$this->_globalBasename.$this->_fileExtension)) {
127127
$this->_classCache = array_merge($this->_classCache, $this->_loadMappingFile($file));
128128
}
129129
}
@@ -135,7 +135,7 @@ protected function _findMappingFile($className)
135135
$defaultFileName = str_replace('\\', '.', $className).$this->_fileExtension;
136136
foreach ($this->_paths as $path) {
137137
if (!isset($this->_prefixes[$path])) {
138-
if (file_exists($path.DIRECTORY_SEPARATOR.$defaultFileName)) {
138+
if (is_file($path.DIRECTORY_SEPARATOR.$defaultFileName)) {
139139
return $path.DIRECTORY_SEPARATOR.$defaultFileName;
140140
}
141141

@@ -149,7 +149,7 @@ protected function _findMappingFile($className)
149149
}
150150

151151
$filename = $path.'/'.strtr(substr($className, strlen($prefix)+1), '\\', '.').$this->_fileExtension;
152-
if (file_exists($filename)) {
152+
if (is_file($filename)) {
153153
return $filename;
154154
}
155155

‎src/Symfony/Bundle/DoctrineAbstractBundle/DependencyInjection/AbstractDoctrineExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/DoctrineAbstractBundle/DependencyInjection/AbstractDoctrineExtension.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected function loadMappingInformation(array $objectManager, ContainerBuilder
6565
$mappingConfig['dir'] = $container->getParameterBag()->resolveValue($mappingConfig['dir']);
6666
// a bundle configuration is detected by realizing that the specified dir is not absolute and existing
6767
if (!isset($mappingConfig['is_bundle'])) {
68-
$mappingConfig['is_bundle'] = !file_exists($mappingConfig['dir']);
68+
$mappingConfig['is_bundle'] = !is_dir($mappingConfig['dir']);
6969
}
7070

7171
if ($mappingConfig['is_bundle']) {
@@ -234,7 +234,7 @@ protected function assertValidMappingConfiguration(array $mappingConfig, $object
234234
throw new \InvalidArgumentException(sprintf('Mapping definitions for Doctrine manager "%s" require at least the "type", "dir" and "prefix" options.', $objectManagerName));
235235
}
236236

237-
if (!file_exists($mappingConfig['dir'])) {
237+
if (!is_dir($mappingConfig['dir'])) {
238238
throw new \InvalidArgumentException(sprintf('Specified non-existing directory "%s" as Doctrine mapping source.', $mappingConfig['dir']));
239239
}
240240

‎src/Symfony/Bundle/DoctrineBundle/DoctrineBundle.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/DoctrineBundle/DoctrineBundle.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class_exists('Doctrine\ORM\Mapping\Driver\AnnotationDriver');
4848
$className = substr($class, strlen($namespace) +1);
4949
$file = $dir.DIRECTORY_SEPARATOR.$className.'.php';
5050

51-
if (!file_exists($file)) {
51+
if (!is_file($file)) {
5252
throw new \RuntimeException(sprintf('The proxy file "%s" does not exist. If you still have objects serialized in the session, you need to clear the session manually.', $file));
5353
}
5454

‎src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ private function getContainerBuilder()
183183
throw new \LogicException(sprintf('Debug information about the container is only available in debug mode.'));
184184
}
185185

186-
if (!file_exists($cachedFile = $this->getContainer()->getParameter('debug.container.dump'))) {
186+
if (!is_file($cachedFile = $this->getContainer()->getParameter('debug.container.dump'))) {
187187
throw new \LogicException(sprintf('Debug information about the container could not be found. Please clear the cache and try again.'));
188188
}
189189

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ private function getValidatorXmlMappingFiles(ContainerBuilder $container)
548548

549549
foreach ($container->getParameter('kernel.bundles') as $bundle) {
550550
$reflection = new \ReflectionClass($bundle);
551-
if (file_exists($file = dirname($reflection->getFilename()).'/Resources/config/validation.xml')) {
551+
if (is_file($file = dirname($reflection->getFilename()).'/Resources/config/validation.xml')) {
552552
$files[] = realpath($file);
553553
$container->addResource(new FileResource($file));
554554
}
@@ -563,7 +563,7 @@ private function getValidatorYamlMappingFiles(ContainerBuilder $container)
563563

564564
foreach ($container->getParameter('kernel.bundles') as $bundle) {
565565
$reflection = new \ReflectionClass($bundle);
566-
if (file_exists($file = dirname($reflection->getFilename()).'/Resources/config/validation.yml')) {
566+
if (is_file($file = dirname($reflection->getFilename()).'/Resources/config/validation.yml')) {
567567
$files[] = realpath($file);
568568
$container->addResource(new FileResource($file));
569569
}

‎src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public function formatFile($file, $line, $text = null)
189189
*/
190190
public function getFileLink($file, $line)
191191
{
192-
if ($this->fileLinkFormat && file_exists($file)) {
192+
if ($this->fileLinkFormat && is_file($file)) {
193193
return strtr($this->fileLinkFormat, array('%f' => $file, '%l' => $line));
194194
}
195195

‎src/Symfony/Bundle/FrameworkBundle/Templating/Loader/TemplateLocator.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Templating/Loader/TemplateLocator.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class TemplateLocator implements FileLocatorInterface
3333
*/
3434
public function __construct(FileLocatorInterface $locator, $cacheDir = null)
3535
{
36-
if (null !== $cacheDir && file_exists($cache = $cacheDir.'/templates.php')) {
36+
if (null !== $cacheDir && is_file($cache = $cacheDir.'/templates.php')) {
3737
$this->cache = require $cache;
3838
}
3939

‎src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ static protected function getPhpUnitXmlDir()
6161

6262
$dir = static::getPhpUnitCliConfigArgument();
6363
if ($dir === null &&
64-
(file_exists(getcwd().DIRECTORY_SEPARATOR.'phpunit.xml') ||
65-
file_exists(getcwd().DIRECTORY_SEPARATOR.'phpunit.xml.dist'))) {
64+
(is_file(getcwd().DIRECTORY_SEPARATOR.'phpunit.xml') ||
65+
is_file(getcwd().DIRECTORY_SEPARATOR.'phpunit.xml.dist'))) {
6666
$dir = getcwd();
6767
}
6868

‎src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
while ($dir !== $lastDir) {
1818
$lastDir = $dir;
1919

20-
if (file_exists($dir.'/autoload.php')) {
20+
if (is_file($dir.'/autoload.php')) {
2121
require_once $dir.'/autoload.php';
2222
break;
2323
}
2424

25-
if (file_exists($dir.'/autoload.php.dist')) {
25+
if (is_file($dir.'/autoload.php.dist')) {
2626
require_once $dir.'/autoload.php.dist';
2727
break;
2828
}
@@ -52,7 +52,7 @@ public function __construct($testCase, $rootConfig, $environment, $debug)
5252
$this->testCase = $testCase;
5353

5454
$fs = new Filesystem();
55-
if (!$fs->isAbsolutePath($rootConfig) && !file_exists($rootConfig = __DIR__.'/'.$testCase.'/'.$rootConfig)) {
55+
if (!$fs->isAbsolutePath($rootConfig) && !is_file($rootConfig = __DIR__.'/'.$testCase.'/'.$rootConfig)) {
5656
throw new \InvalidArgumentException(sprintf('The root config "%s" does not exist.', $rootConfig));
5757
}
5858
$this->rootConfig = $rootConfig;
@@ -62,7 +62,7 @@ public function __construct($testCase, $rootConfig, $environment, $debug)
6262

6363
public function registerBundles()
6464
{
65-
if (!file_exists($filename = $this->getRootDir().'/'.$this->testCase.'/bundles.php')) {
65+
if (!is_file($filename = $this->getRootDir().'/'.$this->testCase.'/bundles.php')) {
6666
throw new \RuntimeException(sprintf('The bundles file "%s" does not exist.', $filename));
6767
}
6868

‎src/Symfony/Component/ClassLoader/ClassCollectionLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/ClassCollectionLoader.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static public function load($classes, $cacheDir, $name, $autoReload, $adaptive =
5555
$reload = false;
5656
if ($autoReload) {
5757
$metadata = $cacheDir.'/'.$name.$extension.'.meta';
58-
if (!file_exists($metadata) || !file_exists($cache)) {
58+
if (!is_file($metadata) || !is_file($cache)) {
5959
$reload = true;
6060
} else {
6161
$time = filemtime($cache);
@@ -65,7 +65,7 @@ static public function load($classes, $cacheDir, $name, $autoReload, $adaptive =
6565
$reload = true;
6666
} else {
6767
foreach ($meta[0] as $resource) {
68-
if (!file_exists($resource) || filemtime($resource) > $time) {
68+
if (!is_file($resource) || filemtime($resource) > $time) {
6969
$reload = true;
7070

7171
break;
@@ -75,7 +75,7 @@ static public function load($classes, $cacheDir, $name, $autoReload, $adaptive =
7575
}
7676
}
7777

78-
if (!$reload && file_exists($cache)) {
78+
if (!$reload && is_file($cache)) {
7979
require_once $cache;
8080

8181
return;

‎src/Symfony/Component/ClassLoader/UniversalClassLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/UniversalClassLoader.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,15 @@ public function findFile($class)
227227
foreach ($dirs as $dir) {
228228
$className = substr($class, $pos + 1);
229229
$file = $dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $className).'.php';
230-
if (file_exists($file)) {
230+
if (is_file($file)) {
231231
return $file;
232232
}
233233
}
234234
}
235235

236236
foreach ($this->namespaceFallbacks as $dir) {
237237
$file = $dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
238-
if (file_exists($file)) {
238+
if (is_file($file)) {
239239
return $file;
240240
}
241241
}
@@ -248,15 +248,15 @@ public function findFile($class)
248248

249249
foreach ($dirs as $dir) {
250250
$file = $dir.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php';
251-
if (file_exists($file)) {
251+
if (is_file($file)) {
252252
return $file;
253253
}
254254
}
255255
}
256256

257257
foreach ($this->prefixFallbacks as $dir) {
258258
$file = $dir.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php';
259-
if (file_exists($file)) {
259+
if (is_file($file)) {
260260
return $file;
261261
}
262262
}

‎src/Symfony/Component/Config/ConfigCache.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/ConfigCache.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function __toString()
5656
*/
5757
public function isFresh()
5858
{
59-
if (!file_exists($this->file)) {
59+
if (!is_file($this->file)) {
6060
return false;
6161
}
6262

@@ -65,7 +65,7 @@ public function isFresh()
6565
}
6666

6767
$metadata = $this->file.'.meta';
68-
if (!file_exists($metadata)) {
68+
if (!is_file($metadata)) {
6969
return false;
7070
}
7171

‎src/Symfony/Component/Config/Resource/DirectoryResource.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Resource/DirectoryResource.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function getResource()
6262
*/
6363
public function isFresh($timestamp)
6464
{
65-
if (!file_exists($this->resource)) {
65+
if (!is_dir($this->resource)) {
6666
return false;
6767
}
6868

‎src/Symfony/Component/Config/Resource/FileResource.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Resource/FileResource.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function getResource()
5959
*/
6060
public function isFresh($timestamp)
6161
{
62-
if (!file_exists($this->resource)) {
62+
if (!is_file($this->resource)) {
6363
return false;
6464
}
6565

‎src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ private function validateSchema(\DOMDocument $dom, $file)
313313
if (($extension = $this->container->getExtension($items[$i])) && false !== $extension->getXsdValidationBasePath()) {
314314
$path = str_replace($extension->getNamespace(), str_replace('\\', '/', $extension->getXsdValidationBasePath()).'/', $items[$i + 1]);
315315

316-
if (!file_exists($path)) {
316+
if (!is_file($path)) {
317317
throw new \RuntimeException(sprintf('Extension "%s" references a non-existent XSD file "%s"', get_class($extension), $path));
318318
}
319319

‎src/Symfony/Component/HttpFoundation/SessionStorage/FilesystemSessionStorage.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/SessionStorage/FilesystemSessionStorage.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function start()
6767

6868
$file = $this->path.'/'.session_id().'.session';
6969

70-
$this->data = file_exists($file) ? unserialize(file_get_contents($file)) : array();
70+
$this->data = is_file($file) ? unserialize(file_get_contents($file)) : array();
7171
$this->started = true;
7272
}
7373

‎src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ protected function lock(Request $request, Response $entry)
492492

493493
// wait for the lock to be released
494494
$wait = 0;
495-
while (file_exists($lock) && $wait < 5000000) {
495+
while (is_file($lock) && $wait < 5000000) {
496496
usleep($wait += 50000);
497497
}
498498

‎src/Symfony/Component/HttpKernel/HttpCache/Store.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/HttpCache/Store.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function lookup(Request $request)
123123
}
124124

125125
list($req, $headers) = $match;
126-
if (file_exists($body = $this->getPath($headers['x-content-digest'][0]))) {
126+
if (is_file($body = $this->getPath($headers['x-content-digest'][0]))) {
127127
return $this->restoreResponse($headers, $body);
128128
}
129129

@@ -282,7 +282,7 @@ private function getMetadata($key)
282282
*/
283283
public function purge($url)
284284
{
285-
if (file_exists($path = $this->getPath($this->getCacheKey(Request::create($url))))) {
285+
if (is_file($path = $this->getPath($this->getCacheKey(Request::create($url))))) {
286286
unlink($path);
287287

288288
return true;
@@ -302,7 +302,7 @@ private function load($key)
302302
{
303303
$path = $this->getPath($key);
304304

305-
return file_exists($path) ? file_get_contents($path) : false;
305+
return is_file($path) ? file_get_contents($path) : false;
306306
}
307307

308308
/**

‎src/Symfony/Component/HttpKernel/Kernel.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Kernel.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ public function getContainer()
396396
*/
397397
public function loadClassCache($name = 'classes', $extension = '.php')
398398
{
399-
if (!$this->booted && file_exists($this->getCacheDir().'/classes.map')) {
399+
if (!$this->booted && is_file($this->getCacheDir().'/classes.map')) {
400400
ClassCollectionLoader::load(include($this->getCacheDir().'/classes.map'), $this->getCacheDir(), $name, $this->debug, false, $extension);
401401
}
402402
}

‎src/Symfony/Component/HttpKernel/Util/Filesystem.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Util/Filesystem.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ public function copy($originFile, $targetFile, $override = false)
3434
$this->mkdir(dirname($targetFile));
3535

3636
$mostRecent = false;
37-
if (file_exists($targetFile)) {
37+
if (is_file($targetFile)) {
3838
$statTarget = stat($targetFile);
3939
$statOrigin = stat($originFile);
4040
$mostRecent = $statOrigin['mtime'] > $statTarget['mtime'];
4141
}
4242

43-
if ($override || !file_exists($targetFile) || $mostRecent) {
43+
if ($override || !is_file($targetFile) || $mostRecent) {
4444
copy($originFile, $targetFile);
4545
}
4646
}

‎src/Symfony/Component/Templating/Loader/CacheLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Templating/Loader/CacheLoader.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function load(TemplateReferenceInterface $template)
5555
$file = substr($key, 2).'.tpl';
5656
$path = $dir.DIRECTORY_SEPARATOR.$file;
5757

58-
if (file_exists($path)) {
58+
if (is_file($path)) {
5959
if (null !== $this->debugger) {
6060
$this->debugger->log(sprintf('Fetching template "%s" from cache', $template->get('name')));
6161
}
@@ -69,7 +69,7 @@ public function load(TemplateReferenceInterface $template)
6969

7070
$content = $storage->getContent();
7171

72-
if (!file_exists($dir)) {
72+
if (!is_dir($dir)) {
7373
mkdir($dir, 0777, true);
7474
}
7575

‎src/Symfony/Component/Templating/Loader/FilesystemLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Templating/Loader/FilesystemLoader.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function load(TemplateReferenceInterface $template)
5151
{
5252
$file = $template->get('name');
5353

54-
if (self::isAbsolutePath($file) && file_exists($file)) {
54+
if (self::isAbsolutePath($file) && is_file($file)) {
5555
return new FileStorage($file);
5656
}
5757

‎src/Symfony/Component/Validator/Constraints/FileValidator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Constraints/FileValidator.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function isValid($value, Constraint $constraint)
6464

6565
$path = $value instanceof FileObject ? $value->getPathname() : (string) $value;
6666

67-
if (!file_exists($path)) {
67+
if (!is_file($path)) {
6868
$this->setMessage($constraint->notFoundMessage, array('{{ file }}' => $path));
6969

7070
return false;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.