Skip to content

Commit e226e52

Browse files
committed
converted file_exists calls to either is_file or is_dir where it makes sense
1 parent bcadbcd commit e226e52

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

Command/ContainerDebugCommand.php

Lines 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

DependencyInjection/FrameworkExtension.php

Lines 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
}

Templating/Helper/CodeHelper.php

Lines 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

Templating/Loader/TemplateLocator.php

Lines 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

Test/WebTestCase.php

Lines 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

0 commit comments

Comments
 (0)