Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 3 additions & 18 deletions ps_emailsubscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -952,21 +952,6 @@ public function hookActionFrontControllerSetMedia()
$controller->registerJavascript('modules-psemailsubscription', 'modules/' . $this->name . '/views/js/ps_emailsubscription.js');
}

/**
* Returns the admin controller with a concrete type. Context::$controller is typed
* as the PHPStan-opaque LegacyControllerContext on PrestaShop 9.x, which prevents
* static resolution of legacy controller methods such as getLanguages().
*
* @return AdminController
*/
private function getAdminController()
{
/** @var AdminController $controller */
$controller = $this->context->controller;

return $controller;
}

/**
* Deletes duplicates email in newsletter table.
*
Expand Down Expand Up @@ -1153,7 +1138,7 @@ public function renderForm()
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->tpl_vars = [
'fields_value' => $this->getConfigFieldsValues(),
'languages' => $this->getAdminController()->getLanguages(),
'languages' => $this->context->controller->getLanguages(),
'id_language' => $this->context->language->id,
];

Expand Down Expand Up @@ -1254,7 +1239,7 @@ public function renderExportForm()
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->tpl_vars = [
'fields_value' => $this->getConfigFieldsValues(),
'languages' => $this->getAdminController()->getLanguages(),
'languages' => $this->context->controller->getLanguages(),
'id_language' => $this->context->language->id,
];

Expand Down Expand Up @@ -1293,7 +1278,7 @@ public function renderSearchForm()
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->tpl_vars = [
'fields_value' => ['searched_email' => $this->_searched_email],
'languages' => $this->getAdminController()->getLanguages(),
'languages' => $this->context->controller->getLanguages(),
'id_language' => $this->context->language->id,
];

Expand Down
6 changes: 6 additions & 0 deletions tests/php/phpstan/phpstan-9.0.3.neon
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
includes:
- %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon

parameters:
# PrestaShop 9 requires PHP 8.1 as a minimum. It has to be set explicitly because PHPStan
# otherwise infers the analysed PHP version from the composer platform declaration, and the
# resulting older syntax rules make it fail to parse the core classes the module relies on.
phpVersion: 80100
6 changes: 6 additions & 0 deletions tests/php/phpstan/phpstan-9.1.5.neon
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
includes:
- %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon

parameters:
# PrestaShop 9 requires PHP 8.1 as a minimum. It has to be set explicitly because PHPStan
# otherwise infers the analysed PHP version from the composer platform declaration, and the
# resulting older syntax rules make it fail to parse the core classes the module relies on.
phpVersion: 80100
6 changes: 6 additions & 0 deletions tests/php/phpstan/phpstan-9.2.x.neon
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
includes:
- %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon

parameters:
# PrestaShop 9 requires PHP 8.1 as a minimum. It has to be set explicitly because PHPStan
# otherwise infers the analysed PHP version from the composer platform declaration, and the
# resulting older syntax rules make it fail to parse the core classes the module relies on.
phpVersion: 80100
6 changes: 6 additions & 0 deletions tests/php/phpstan/phpstan-develop.neon
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
includes:
- %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon

parameters:
# PrestaShop 9 requires PHP 8.1 as a minimum. It has to be set explicitly because PHPStan
# otherwise infers the analysed PHP version from the composer platform declaration, and the
# resulting older syntax rules make it fail to parse the core classes the module relies on.
phpVersion: 80100
Loading