Skip to content

Commit 346a16a

Browse files
committed
Fix issues on PS v9
1 parent 7da0462 commit 346a16a

13 files changed

Lines changed: 34 additions & 25 deletions

classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,6 @@ protected function cleanXmlFiles(): void
722722

723723
protected function disableOverrides(): void
724724
{
725-
// @phpstan-ignore function.alreadyNarrowedType (Some PrestaShop may not have this method)
726725
if (class_exists('PrestaShopAutoload') && method_exists('PrestaShopAutoload', 'generateIndex')) {
727726
\PrestaShopAutoload::getInstance()->_include_override_path = false;
728727
\PrestaShopAutoload::getInstance()->generateIndex();

classes/UpgradeTools/Module/ModuleAdapter.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ class ModuleAdapter
3838
*/
3939
private $symfonyAdapter;
4040

41-
/** @var \PrestaShop\PrestaShop\Adapter\Module\ModuleDataUpdater */
42-
private $moduleDataUpdater;
43-
4441
/** @var \PrestaShop\PrestaShop\Core\CommandBus\CommandBusInterface */
4542
private $commandBus;
4643

@@ -51,23 +48,6 @@ public function __construct(Translator $translator, string $modulesPath, Symfony
5148
$this->symfonyAdapter = $symfonyAdapter;
5249
}
5350

54-
/**
55-
* Available only from 1.7. Can't be called on PS 1.6.
56-
*
57-
* @return \PrestaShop\PrestaShop\Adapter\Module\ModuleDataUpdater
58-
*/
59-
public function getModuleDataUpdater()
60-
{
61-
if (null === $this->moduleDataUpdater) {
62-
$this->moduleDataUpdater = $this->symfonyAdapter
63-
->initKernel()
64-
->getContainer()
65-
->get('prestashop.core.module.updater');
66-
}
67-
68-
return $this->moduleDataUpdater;
69-
}
70-
7151
/**
7252
* Available only since 1.7.6.0 Can't be called on PS 1.6.
7353
*

tests/phpstan/forceAutoload.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,11 @@ class_exists(Output::class);
2727
require_once __DIR__ . '/../../vendor/twig/twig/src/Loader/LoaderInterface.php';
2828
require_once __DIR__ . '/../../vendor/twig/twig/src/Loader/ExistsLoaderInterface.php';
2929
require_once __DIR__ . '/../../vendor/twig/twig/src/Loader/SourceContextLoaderInterface.php';
30+
31+
if (version_compare(_PS_VERSION_, '9.0.0', '>=')) {
32+
// Use the libraries we use instead of the core ones in PHPStan context, when we are sure we don't rely
33+
require_once __DIR__ . '/../../vendor/symfony/http-foundation/Request.php';
34+
require_once __DIR__ . '/../../vendor/symfony/http-foundation/JsonResponse.php';
35+
36+
require_once __DIR__ . '/../../vendor/symfony/console/Command/Command.php';
37+
}

tests/phpstan/phpstan-1.7.2.5.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
includes:
22
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon
3+
- %currentWorkingDirectory%/tests/phpstan/phpstan-partial-pre-v9.neon
34

45
parameters:
56
excludePaths:

tests/phpstan/phpstan-1.7.3.4.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
includes:
22
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon
3+
- %currentWorkingDirectory%/tests/phpstan/phpstan-partial-pre-v9.neon
34

45
parameters:
56
excludePaths:

tests/phpstan/phpstan-1.7.4.4.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
includes:
22
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon
3+
- %currentWorkingDirectory%/tests/phpstan/phpstan-partial-pre-v9.neon
34

45
parameters:
56
excludePaths:

tests/phpstan/phpstan-1.7.5.1.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
includes:
22
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon
3+
- %currentWorkingDirectory%/tests/phpstan/phpstan-partial-pre-v9.neon
34

45
parameters:
56
excludePaths:

tests/phpstan/phpstan-1.7.6.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
includes:
22
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon
3+
- %currentWorkingDirectory%/tests/phpstan/phpstan-partial-pre-v9.neon
34

45
parameters:
56
excludePaths:

tests/phpstan/phpstan-1.7.7.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
includes:
22
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon
3+
- %currentWorkingDirectory%/tests/phpstan/phpstan-partial-pre-v9.neon
34

45
parameters:
56
excludePaths:

tests/phpstan/phpstan-1.7.8.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
includes:
22
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon
3+
- %currentWorkingDirectory%/tests/phpstan/phpstan-partial-pre-v9.neon
34

45
parameters:
56
excludePaths:

0 commit comments

Comments
 (0)