Skip to content

Commit 19c37b6

Browse files
committed
Add intermediate trans method for 16 compatibility
1 parent f7dd3dd commit 19c37b6

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

ps_googleanalytics.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,4 +241,21 @@ public function uninstall()
241241
return parent::uninstall() &&
242242
$database->uninstallTables();
243243
}
244+
245+
/**
246+
* Intermediate method added only to keep backward compatibility with PrestaShop 1.6
247+
*
248+
* @param string $id
249+
* @param array $parameters
250+
* @param string|null $domain
251+
* @param string|null $locale
252+
*/
253+
protected function trans($id, array $parameters = [], $domain = null, $locale = null)
254+
{
255+
if (method_exists('Module', 'trans')) {
256+
return parent::trans($id, $parameters, $domain, $locale);
257+
} else {
258+
return $this->l($id);
259+
}
260+
}
244261
}

tests/phpstan/phpstan-1.6.1.18.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ includes:
44
parameters:
55
ignoreErrors:
66
- '#PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler::uninstallModule\(\) calls parent::uninstall\(\) but PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler does not extend any class.#'
7+
- '#Call to an undefined static method Module::trans\(\).#'

0 commit comments

Comments
 (0)