From eb9616a82b55426287815a3ddc0051eecc18f814 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 15 Dec 2020 14:55:44 +0100 Subject: [PATCH] Debug info improvements --- src/Composer/Command/RequireCommand.php | 2 +- src/Composer/Factory.php | 2 +- src/Composer/Json/JsonFile.php | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Composer/Command/RequireCommand.php b/src/Composer/Command/RequireCommand.php index d3310afc1..524f5aa4c 100644 --- a/src/Composer/Command/RequireCommand.php +++ b/src/Composer/Command/RequireCommand.php @@ -190,7 +190,7 @@ EOT ); } catch (\Exception $e) { if ($this->newlyCreated) { - throw new \RuntimeException('No composer.json present in the current directory, this may be the cause of the following exception.', 0, $e); + throw new \RuntimeException('No composer.json present in the current directory ('.$this->file.'), this may be the cause of the following exception.', 0, $e); } throw $e; diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index 7d4ed1e21..ad713714d 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -315,7 +315,7 @@ class Factory $config = static::createConfig($io, $cwd); $config->merge($localConfig); if (isset($composerFile)) { - $io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG); + $io->writeError('Loading config file ' . $composerFile .' ('.realpath($composerFile).')', true, IOInterface::DEBUG); $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io))); $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io); diff --git a/src/Composer/Json/JsonFile.php b/src/Composer/Json/JsonFile.php index c3279f82e..e794fe63a 100644 --- a/src/Composer/Json/JsonFile.php +++ b/src/Composer/Json/JsonFile.php @@ -90,7 +90,12 @@ class JsonFile $json = $this->httpDownloader->get($this->path)->getBody(); } else { if ($this->io && $this->io->isDebug()) { - $this->io->writeError('Reading ' . $this->path); + $realpathInfo = ''; + $realpath = realpath($this->path); + if (false !== $realpath && $realpath !== $this->path) { + $realpathInfo = ' (' . $realpath . ')'; + } + $this->io->writeError('Reading ' . $this->path . $realpathInfo); } $json = file_get_contents($this->path); }