From acc55faa0d1a21fb3ca6caa4aee2ffd3ae48c403 Mon Sep 17 00:00:00 2001 From: "John.R" Date: Fri, 1 Dec 2023 11:08:20 +0100 Subject: [PATCH] fix: phpstan and phpcsfixer --- config.xml | 2 +- ps_eventbus.php | 4 ++-- .../Admin/PsEventbusResolverController.php | 9 ++++----- src/Helper/ModuleHelper.php | 7 +++---- src/Module/Upgrade.php | 8 ++++---- src/Service/PresenterService.php | 20 +++++-------------- 6 files changed, 19 insertions(+), 31 deletions(-) diff --git a/config.xml b/config.xml index cc4649dd..5c046d4a 100644 --- a/config.xml +++ b/config.xml @@ -2,7 +2,7 @@ ps_eventbus - + diff --git a/ps_eventbus.php b/ps_eventbus.php index 8f95cee9..4f46e245 100644 --- a/ps_eventbus.php +++ b/ps_eventbus.php @@ -41,7 +41,7 @@ class Ps_eventbus extends Module /** * @var string */ - const VERSION = '2.3.2'; + const VERSION = '0.0.0'; /** * @var array @@ -144,7 +144,7 @@ public function __construct() $this->author = 'PrestaShop'; $this->need_instance = 0; $this->bootstrap = true; - $this->version = '2.3.2'; + $this->version = '0.0.0'; $this->module_key = '7d76e08a13331c6c393755886ec8d5ce'; parent::__construct(); diff --git a/src/Controller/Admin/PsEventbusResolverController.php b/src/Controller/Admin/PsEventbusResolverController.php index 14ca5de3..54dd55c1 100644 --- a/src/Controller/Admin/PsEventbusResolverController.php +++ b/src/Controller/Admin/PsEventbusResolverController.php @@ -22,21 +22,20 @@ namespace PrestaShop\Module\PsEventbus\Controller\Admin; use PrestaShop\Module\PsEventbus\Module\Upgrade; +use Prestashop\ModuleLibMboInstaller\Installer as MBOInstaller; use PrestaShopBundle\Controller\Admin\FrameworkBundleAdminController; -use Ps_eventbus; +use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Prestashop\ModuleLibMboInstaller\Installer as MBOInstaller; -use Symfony\Component\HttpFoundation\JsonResponse; class PsEventbusResolverController extends FrameworkBundleAdminController { - /** @var Ps_eventbus */ + /** @var \Ps_eventbus */ private $module; public function __construct() { - /** @var Ps_eventbus $psEventbus */ + /** @var \Ps_eventbus $psEventbus */ $psEventbus = \Module::getInstanceByName('ps_eventbus'); $this->module = $psEventbus; } diff --git a/src/Helper/ModuleHelper.php b/src/Helper/ModuleHelper.php index e7f8f515..f394038e 100644 --- a/src/Helper/ModuleHelper.php +++ b/src/Helper/ModuleHelper.php @@ -2,9 +2,8 @@ namespace PrestaShop\Module\PsEventbus\Helper; -use ModuleCore; use PrestaShopBundle\Service\Routing\Router; -use Prestashop\ModuleLibMboInstaller\Installer as MBOInstaller; + class ModuleHelper { /** @var \Ps_eventbus */ @@ -38,11 +37,11 @@ public function isEnabled(string $moduleName) /** * @param string $moduleName * - * @return false|ModuleCore + * @return false|\ModuleCore */ public function getInstanceByName(string $moduleName) { - return ModuleCore::getInstanceByName($moduleName); + return \ModuleCore::getInstanceByName($moduleName); } /** diff --git a/src/Module/Upgrade.php b/src/Module/Upgrade.php index 60418e77..238c90d7 100644 --- a/src/Module/Upgrade.php +++ b/src/Module/Upgrade.php @@ -19,7 +19,7 @@ * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ -namespace PrestaShop\Module\Ps_eventbus\Module; +namespace PrestaShop\Module\PsEventbus\Module; use PrestaShop\PrestaShop\Core\Addon\Module\ModuleManagerBuilder; use Ps_eventbus; @@ -27,18 +27,18 @@ class Upgrade { /** - * @var Ps_eventbus + * @var \Ps_eventbus */ private $module; /** * Install constructor. * - * @param Ps_eventbus $module + * @param \Ps_eventbus $module * * @return void */ - public function __construct(Ps_eventbus $module) + public function __construct(\Ps_eventbus $module) { $this->module = $module; } diff --git a/src/Service/PresenterService.php b/src/Service/PresenterService.php index 52d301dc..9fc47cdd 100644 --- a/src/Service/PresenterService.php +++ b/src/Service/PresenterService.php @@ -3,6 +3,7 @@ namespace PrestaShop\Module\PsEventbus\Service; use PrestaShop\AccountsAuth\Service\PsAccountsService; +use PrestaShop\Module\PsEventbus\Helper\ModuleHelper; use PrestaShop\PrestaShop\Core\Addon\Module\ModuleManagerBuilder; class PresenterService @@ -73,15 +74,15 @@ private function convertObjectToArray($object) } /** - * @param \ModuleCore $module + * @param \Ps_eventbus $module * @param array $requiredConsents * @param array $optionalConsents * * @return array */ - public function expose(\ModuleCore $module, $requiredConsents = [], $optionalConsents = []) + public function expose(\Ps_eventbus $module, $requiredConsents = [], $optionalConsents = []) { - $module = \Module::getInstanceByName('ps_eventbus'); + /** @var ModuleHelper $moduleHelper */ $moduleHelper = $module->getService('ps_eventbus.helper.module'); if (!in_array('info', $requiredConsents)) { @@ -96,17 +97,6 @@ public function expose(\ModuleCore $module, $requiredConsents = [], $optionalCon throw new \PrestaShopException('No language context'); } - $moduleInformations = [ - 'ps_eventbus' => $moduleHelper->buildModuleInformations( - 'ps_eventbus' - ), - 'ps_mbo' => $moduleHelper->buildModuleInformations( - 'ps_mbo' - ), - ]; - dump($moduleInformations); - die; - return [ 'jwt' => $this->psAccountsService->getOrRefreshToken(), 'requiredConsents' => $requiredConsents, @@ -129,7 +119,7 @@ public function expose(\ModuleCore $module, $requiredConsents = [], $optionalCon 'ps_mbo' => $moduleHelper->buildModuleInformations( 'ps_mbo' ), - ] + ], ]; } }