From 6552b85100d96259e33d3a53bed5440e63120ecd Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 16 Jan 2021 22:03:52 +0100 Subject: [PATCH] Filesystem: use is_dir() instead of file_exists() which is faster this reproducible saves 1-2 seconds while running `COMPOSER_DISABLE_NETWORK=1 php composer/bin/composer install -vvv --profile` on the rector/rector project --- src/Composer/Util/Filesystem.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/Util/Filesystem.php b/src/Composer/Util/Filesystem.php index d1200dde9..7d27b3ff1 100644 --- a/src/Composer/Util/Filesystem.php +++ b/src/Composer/Util/Filesystem.php @@ -131,7 +131,7 @@ class Filesystem // clear stat cache because external processes aren't tracked by the php stat cache clearstatcache(); - if ($result && !file_exists($directory)) { + if ($result && !is_dir($directory)) { return true; } @@ -600,7 +600,7 @@ class Filesystem if (!function_exists('symlink')) { return false; } - + $cwd = getcwd(); $relativePath = $this->findShortestPath($link, $target);