8000 Using is_file everywhere possible · symfony/symfony@329b413 · GitHub
[go: up one dir, main page]

Skip to content

Commit 329b413

Browse files
committed
Using is_file everywhere possible
1 parent 3c20b68 commit 329b413

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/Symfony/Component/AssetMapper/AssetMapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ private function loadManifest(): array
267267
if (null === $this->manifestData) {
268268
$path = $this->getPublicAssetsFilesystemPath().'/'.self::MANIFEST_FILE_NAME;
269269

270-
if (!file_exists($path)) {
270+
if (!is_file($path)) {
271271
$this->manifestData = [];
272272
} else {
273273
$this->manifestData = json_decode(file_get_contents($path), true);

src/Symfony/Component/AssetMapper/AssetMapperRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function find(string $logicalPath): ?string
5454
}
5555

5656
$file = rtrim($path, '/').'/'.$localLogicalPath;
57-
if (file_exists($file)) {
57+
if (is_file($file)) {
5858
return realpath($file);
5959
}
6060
}

src/Symfony/Component/AssetMapper/Command/AssetMapperCompileCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,21 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7474
}
7575

7676
$manifestPath = $publicDir.$this->assetMapper->getPublicPrefix().AssetMapper::MANIFEST_FILE_NAME;
77-
if (file_exists($manifestPath)) {
77+
if (is_file($manifestPath)) {
7878
$this->filesystem->remove($manifestPath);
7979
}
8080
$manifest = $this->createManifestAndWriteFiles($io, $publicDir);
8181
$this->filesystem->dumpFile($manifestPath, json_encode($manifest, \JSON_PRETTY_PRINT));
8282
$io->comment(sprintf('Manifest written to <info>%s</info>', $manifestPath));
8383

8484
$importMapPath = $outputDir.ImportMapManager::IMPORT_MAP_FILE_NAME;
85-
if (file_exists($importMapPath)) {
85+
if (is_file($importMapPath)) {
8686
$this->filesystem->remove($importMapPath);
8787
}
8888
$this->filesystem->dumpFile($importMapPath, $this->importMapManager->getImportMapJson());
8989

9090
$importMapPreloadPath = $outputDir.ImportMapManager::IMPORT_MAP_PRELOAD_FILE_NAME;
91-
if (file_exists($importMapPreloadPath)) {
91+
if (is_file($importMapPreloadPath)) {
9292
$this->filesystem->remove($importMapPreloadPath);
9393
}
9494
$this->filesystem->dumpFile(

src/Symfony/Component/AssetMapper/ImportMap/ImportMapManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ private function buildImportMapJson(): void
128128

129129
$dumpedImportMapPath = $this->assetMapper->getPublicAssetsFilesystemPath().'/'.self::IMPORT_MAP_FILE_NAME;
130130
$dumpedModulePreloadPath = $this->assetMapper->getPublicAssetsFilesystemPath().'/'.self::IMPORT_MAP_PRELOAD_FILE_NAME;
131-
if (file_exists($dumpedImportMapPath) && file_exists($dumpedModulePreloadPath)) {
131+
if (is_file($dumpedImportMapPath) && is_file($dumpedModulePreloadPath)) {
132132
$this->json = file_get_contents($dumpedImportMapPath);
133133
$this->modulesToPreload = json_decode(file_get_contents($dumpedModulePreloadPath), true, 512, \JSON_THROW_ON_ERROR);
134134

0 commit comments

Comments
 (0)
0