Skip to content

Commit

Permalink
PHPStan fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sowbiba committed Nov 29, 2023
1 parent b36b2c3 commit 25e4dfa
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Prestashop\ModuleLibMboInstaller;

use Exception;
use GuzzleHttp\Psr7\Request;
use Prestashop\ModuleLibGuzzleAdapter\ClientFactory;
use PrestaShop\PrestaShop\Core\Addon\Module\ModuleManagerBuilder;
Expand Down Expand Up @@ -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)) {

Check failure on line 45 in src/Installer.php

View workflow job for this annotation

GitHub Actions / PHPStan (https://github.com/PrestaShop/PrestaShop/releases/download/8.0.0/prestashop_8.0.0.zip)

If condition is always false.

Check failure on line 45 in src/Installer.php

View workflow job for this annotation

GitHub Actions / PHPStan (https://github.com/PrestaShop/PrestaShop/releases/download/1.7.4.4/prestashop_1.7.4.4.zip)

If condition is always false.

Check failure on line 45 in src/Installer.php

View workflow job for this annotation

GitHub Actions / PHPStan (https://github.com/PrestaShop/PrestaShop/releases/download/8.0.0/prestashop_8.0.0.zip)

If condition is always false.

Check failure on line 45 in src/Installer.php

View workflow job for this annotation

GitHub Actions / PHPStan (https://github.com/PrestaShop/PrestaShop/releases/download/1.7.4.4/prestashop_1.7.4.4.zip)

If condition is always false.
throw new Exception('ModuleManagerBuilder::build() failed');
throw new \Exception('ModuleManagerBuilder::build() failed');
}

$this->marketplaceClient = (new ClientFactory())->getClient(['base_uri' => self::ADDONS_URL]);
Expand Down Expand Up @@ -74,7 +73,7 @@ public function installModule()
*
* @return bool
*
* @throws Exception
* @throws \Exception
*/
public function enableModule()
{
Expand All @@ -86,7 +85,7 @@ public function enableModule()
*
* @return string
*
* @throws Exception|ClientExceptionInterface
* @throws \Exception|ClientExceptionInterface
*/
private function downloadModule()
{
Expand All @@ -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 !');
}
}
}

0 comments on commit 25e4dfa

Please sign in to comment.