From 25e4dfa7b586ab773c027e440d4cf4450846cb81 Mon Sep 17 00:00:00 2001 From: Ibrahima SOW Date: Wed, 29 Nov 2023 20:23:04 +0000 Subject: [PATCH] PHPStan fixes --- src/Installer.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Installer.php b/src/Installer.php index 9cf2ac5..9dd89e5 100644 --- a/src/Installer.php +++ b/src/Installer.php @@ -2,7 +2,6 @@ namespace Prestashop\ModuleLibMboInstaller; -use Exception; use GuzzleHttp\Psr7\Request; use Prestashop\ModuleLibGuzzleAdapter\ClientFactory; use PrestaShop\PrestaShop\Core\Addon\Module\ModuleManagerBuilder; @@ -33,18 +32,18 @@ class Installer /** * @param string $prestashopVersion * - * @throws Exception + * @throws \Exception */ public function __construct($prestashopVersion) { $moduleManagerBuilder = ModuleManagerBuilder::getInstance(); if (is_null($moduleManagerBuilder)) { - throw new Exception('ModuleManagerBuilder::getInstance() failed'); + throw new \Exception('ModuleManagerBuilder::getInstance() failed'); } $this->moduleManager = $moduleManagerBuilder->build(); if (is_null($this->moduleManager)) { - throw new Exception('ModuleManagerBuilder::build() failed'); + throw new \Exception('ModuleManagerBuilder::build() failed'); } $this->marketplaceClient = (new ClientFactory())->getClient(['base_uri' => self::ADDONS_URL]); @@ -74,7 +73,7 @@ public function installModule() * * @return bool * - * @throws Exception + * @throws \Exception */ public function enableModule() { @@ -86,7 +85,7 @@ public function enableModule() * * @return string * - * @throws Exception|ClientExceptionInterface + * @throws \Exception|ClientExceptionInterface */ private function downloadModule() { @@ -103,13 +102,13 @@ private function downloadModule() $temporaryZipFilename = tempnam(sys_get_temp_dir(), 'mod'); if ($temporaryZipFilename === false) { - throw new Exception('Cannot create temporary file in ' . sys_get_temp_dir()); + throw new \Exception('Cannot create temporary file in ' . sys_get_temp_dir()); } if (file_put_contents($temporaryZipFilename, $moduleData) !== false) { return $temporaryZipFilename; } else { - throw new Exception('Cannot store module content in temporary file !'); + throw new \Exception('Cannot store module content in temporary file !'); } } }