Skip to content

Commit

Permalink
fix: phpstan and phpcsfixer
Browse files Browse the repository at this point in the history
  • Loading branch information
fox-john committed Dec 1, 2023
1 parent 7e1003a commit acc55fa
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 31 deletions.
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>ps_eventbus</name>
<displayName><![CDATA[PrestaShop Eventbus]]></displayName>
<version><![CDATA[2.3.2]]></version>
<version><![CDATA[0.0.0]]></version>
<description><![CDATA[Link your PrestaShop account to synchronize your shop data to a tech partner of your choice. Do not uninstall this module if you are already using a service, as it will prevent it from working.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[administration]]></tab>
Expand Down
4 changes: 2 additions & 2 deletions ps_eventbus.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Ps_eventbus extends Module
/**
* @var string
*/
const VERSION = '2.3.2';
const VERSION = '0.0.0';

/**
* @var array
Expand Down Expand Up @@ -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();
Expand Down
9 changes: 4 additions & 5 deletions src/Controller/Admin/PsEventbusResolverController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
7 changes: 3 additions & 4 deletions src/Helper/ModuleHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/Module/Upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@
* @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;

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;
}
Expand Down
20 changes: 5 additions & 15 deletions src/Service/PresenterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)) {
Expand All @@ -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,
Expand All @@ -129,7 +119,7 @@ public function expose(\ModuleCore $module, $requiredConsents = [], $optionalCon
'ps_mbo' => $moduleHelper->buildModuleInformations(
'ps_mbo'
),
]
],
];
}
}
Expand Down

0 comments on commit acc55fa

Please sign in to comment.