This commit is contained in:
2025-04-01 00:38:54 +02:00
parent d4d4c0c09d
commit 87da06293a
22351 changed files with 5168854 additions and 7538 deletions

View File

@@ -0,0 +1,72 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
$rootDir = getenv('_PS_ROOT_DIR_');
if (!$rootDir) {
echo '[ERROR] Define _PS_ROOT_DIR_ with the path to PrestaShop folder' . PHP_EOL;
exit(1);
}
// Add module composer autoloader
require_once dirname(__DIR__) . '/../../vendor/autoload.php';
// Add PrestaShop composer autoload
define('_PS_ADMIN_DIR_', $rootDir . '/admin-dev/');
define('PS_ADMIN_DIR', _PS_ADMIN_DIR_);
require_once $rootDir . '/config/defines.inc.php';
require_once $rootDir . '/config/autoload.php';
require_once $rootDir . '/config/bootstrap.php';
// Make sure loader php-parser is coming from php stan composer
$loader = new \Composer\Autoload\ClassLoader();
$loader->setPsr4('PhpParser\\', ['/composer/vendor/nikic/php-parser/lib/PhpParser']);
$loader->register(true);
// We must declare these constant in this boostrap script.
// Ignoring the error partern with this value will throw another error if not found
// during the checks.
$constantsToDefine = [
'_DB_PREFIX_',
'_PS_SSL_PORT_',
'_THEME_NAME_',
'_PARENT_THEME_NAME_',
'__PS_BASE_URI__',
'_PS_PRICE_DISPLAY_PRECISION_',
'_PS_PRICE_COMPUTE_PRECISION_',
'_PS_OS_CHEQUE_',
'_PS_OS_PAYMENT_',
'_PS_OS_PREPARATION_',
'_PS_OS_SHIPPING_',
'_PS_OS_DELIVERED_',
'_PS_OS_CANCELED_',
'_PS_OS_REFUND_',
'_PS_OS_ERROR_',
'_PS_OS_OUTOFSTOCK_',
'_PS_OS_OUTOFSTOCK_PAID_',
'_PS_OS_OUTOFSTOCK_UNPAID_',
'_PS_OS_BANKWIRE_',
'_PS_OS_PAYPAL_',
'_PS_OS_WS_PAYMENT_',
'_PS_OS_COD_VALIDATION_',
];
foreach ($constantsToDefine as $constant) {
if (!defined($constant)) {
define($constant, 'DUMMY_VALUE');
}
}

View File

@@ -0,0 +1,22 @@
includes:
- %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon
parameters:
ignoreErrors:
# module specific
- '~^Parameter #1 \$hook_name of method ModuleCore::registerHook\(\) expects string, array<string> given\.$~'
- '~^Parameter #2 \$active of static method CurrencyCore::getCurrencies\(\) expects bool, int given\.$~'
- '~^Parameter #3 \$groupBy of static method CurrencyCore::getCurrencies\(\) expects bool, Shop given\.$~'
- '~^Parameter #\d+ \$\w+ of static method ProductCore::priceCalculation\(\) expects \w+, \w+ given\.$~'
- '~^Parameter #1 \$master of static method DbCore::getInstance\(\) expects bool, int given\.$~'
- '~^Parameter #1 \$string of method PrestaShop\\PrestaShop\\Core\\Product\\Search\\URLFragmentSerializer::unserialize\(\) expects string, array given\.$~'
- '~^Parameter #\d+ \$(.+?) of class Category constructor expects null, int given\.$~'
- '~^Access to an undefined property Cookie::\$id_lang\.$~'
- '~^Access to constant NUMBERING_SYSTEM_LATIN on an unknown class PrestaShop\\PrestaShop\\Core\\Localization\\Locale.$~'
- '~^Constant _PS_JS_DIR_ not found\.$~'
- '~^Class PrestaShopBundle\\Form\\Admin\\Type\\(TranslatableType|SwitchType) not found\.$~'
- '~^Call to an undefined method PrestaShop\\PrestaShop\\Adapter\\Tools::linkRewrite\(\).$~'

View File

@@ -0,0 +1,20 @@
includes:
- %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon
parameters:
ignoreErrors:
# module specific
- '~^Parameter #1 \$hook_name of method ModuleCore::registerHook\(\) expects string, array<string> given\.$~'
- '~^Parameter #2 \$active of static method CurrencyCore::getCurrencies\(\) expects bool, int given\.$~'
- '~^Parameter #3 \$groupBy of static method CurrencyCore::getCurrencies\(\) expects bool, Shop given\.$~'
- '~^Parameter #\d+ \$\w+ of static method ProductCore::priceCalculation\(\) expects \w+, \w+ given\.$~'
- '~^Parameter #\d+ \$(.+?) of class Category constructor expects null, int given\.$~'
- '~^Access to an undefined property Cookie::\$id_lang\.$~'
- '~^Access to constant NUMBERING_SYSTEM_LATIN on an unknown class PrestaShop\\PrestaShop\\Core\\Localization\\Locale.$~'
- '~^Constant _PS_JS_DIR_ not found\.$~'
- '~^Class PrestaShopBundle\\Form\\Admin\\Type\\(TranslatableType|SwitchType) not found\.$~'
- '~^Call to an undefined method PrestaShop\\PrestaShop\\Adapter\\Tools::linkRewrite\(\).$~'

View File

@@ -0,0 +1,18 @@
includes:
- %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon
parameters:
ignoreErrors:
# module specific
- '~^Parameter #1 \$hook_name of method ModuleCore::registerHook\(\) expects string, array<string> given\.$~'
- '~^Parameter #2 \$active of static method CurrencyCore::getCurrencies\(\) expects bool, int given\.$~'
- '~^Parameter #3 \$groupBy of static method CurrencyCore::getCurrencies\(\) expects bool, Shop given\.$~'
- '~^Parameter #\d+ \$\w+ of static method ProductCore::priceCalculation\(\) expects \w+, \w+ given\.$~'
- '~^Parameter #\d+ \$(.+?) of class Category constructor expects null, int given\.$~'
- '~^Access to an undefined property Cookie::\$id_lang\.$~'
- '~^Access to constant NUMBERING_SYSTEM_LATIN on an unknown class PrestaShop\\PrestaShop\\Core\\Localization\\Locale.$~'
- '~^Constant _PS_JS_DIR_ not found\.$~'
- '~^Class PrestaShopBundle\\Form\\Admin\\Type\\(TranslatableType|SwitchType) not found\.$~'

View File

@@ -0,0 +1,17 @@
includes:
- %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon
parameters:
ignoreErrors:
# module specific
- '~^Parameter #1 \$hook_name of method ModuleCore::registerHook\(\) expects string, array<string> given\.$~'
- '~^Parameter #2 \$active of static method CurrencyCore::getCurrencies\(\) expects bool, int given\.$~'
- '~^Parameter #3 \$groupBy of static method CurrencyCore::getCurrencies\(\) expects bool, Shop given\.$~'
- '~^Parameter #\d+ \$\w+ of static method ProductCore::priceCalculation\(\) expects \w+, \w+ given\.$~'
- '~^Parameter #\d+ \$(.+?) of class Category constructor expects null, int given\.$~'
- '~^Access to an undefined property Cookie::\$id_lang\.$~'
- '~^Constant _PS_JS_DIR_ not found\.$~'
- '~^Class PrestaShopBundle\\Form\\Admin\\Type\\(TranslatableType|SwitchType) not found\.$~'

View File

@@ -0,0 +1,17 @@
includes:
- %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon
parameters:
ignoreErrors:
# module specific
- '~^Parameter #1 \$hook_name of method ModuleCore::registerHook\(\) expects string, array<string> given\.$~'
- '~^Parameter #2 \$active of static method CurrencyCore::getCurrencies\(\) expects bool, int given\.$~'
- '~^Parameter #3 \$groupBy of static method CurrencyCore::getCurrencies\(\) expects bool, Shop given\.$~'
- '~^Parameter #\d+ \$\w+ of static method ProductCore::priceCalculation\(\) expects \w+, \w+ given\.$~'
- '~^Parameter #\d+ \$(.+?) of class Category constructor expects null, int given\.$~'
- '~^Access to an undefined property Cookie::\$id_lang\.$~'
- '~^Constant _PS_JS_DIR_ not found\.$~'
- '~^Class PrestaShopBundle\\Form\\Admin\\Type\\(TranslatableType|SwitchType) not found\.$~'

View File

@@ -0,0 +1,17 @@
includes:
- %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon
parameters:
ignoreErrors:
# module specific
- '~^Parameter #1 \$hook_name of method ModuleCore::registerHook\(\) expects string, array<string> given\.$~'
- '~^Parameter #2 \$active of static method CurrencyCore::getCurrencies\(\) expects bool, int given\.$~'
- '~^Parameter #3 \$groupBy of static method CurrencyCore::getCurrencies\(\) expects bool, Shop given\.$~'
- '~^Parameter #\d+ \$\w+ of static method ProductCore::priceCalculation\(\) expects \w+, \w+ given\.$~'
- '~^Parameter #\d+ \$(.+?) of class Category constructor expects null, int given\.$~'
- '~^Access to an undefined property Cookie::\$id_lang\.$~'
- '~^Constant _PS_JS_DIR_ not found\.$~'
- '~^Parameter #1 \$string of method PrestaShop\\Module\\FacetedSearch\\URLSerializer::unserialize\(\) expects string, array given\.$~'

View File

@@ -0,0 +1,17 @@
includes:
- %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon
parameters:
ignoreErrors:
# module specific
- '~^Parameter #1 \$hook_name of method ModuleCore::registerHook\(\) expects string, array<int, string> given\.$~'
- '~^Parameter #1 \$hook_name of method ModuleCore::registerHook\(\) expects string, array<string> given\.$~'
- '~^Parameter #2 \$active of static method CurrencyCore::getCurrencies\(\) expects bool, int given\.$~'
- '~^Parameter #3 \$groupBy of static method CurrencyCore::getCurrencies\(\) expects bool, Shop given\.$~'
- '~^Parameter #\d+ \$\w+ of static method ProductCore::priceCalculation\(\) expects \w+, \w+ given\.$~'
- '~^Parameter #\d+ \$(.+?) of class Category constructor expects null, int given\.$~'
- '~^Access to an undefined property Cookie::\$id_lang\.$~'
- '~^Parameter #1 \$string of method PrestaShop\\Module\\FacetedSearch\\URLSerializer::unserialize\(\) expects string, array given\.$~'
- '~^Call to an undefined static method Search::findClosestWeightestWord\(\)\.$~'
- '~^Parameter #1 \$master of static method DbCore::getInstance\(\) expects bool, int given\.$~'
- '~^Parameter #2 \$id_lang of static method ToolsCore::displayDate\(\) expects int|null, true given\.$~'

View File

@@ -0,0 +1,13 @@
includes:
- %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon
parameters:
ignoreErrors:
# module specific
- '~^Parameter #2 \$active of static method CurrencyCore::getCurrencies\(\) expects bool, int given\.$~'
- '~^Parameter #3 \$groupBy of static method CurrencyCore::getCurrencies\(\) expects bool, Shop given\.$~'
- '~^Parameter #\d+ \$\w+ of static method ProductCore::priceCalculation\(\) expects \w+, \w+ given\.$~'
- '~^Access to an undefined property Cookie::\$id_lang\.$~'
- '~^Parameter #1 \$string of method PrestaShop\\Module\\FacetedSearch\\URLSerializer::unserialize\(\) expects string, array given\.$~'
- '~^Parameter #1 \$master of static method DbCore::getInstance\(\) expects bool, int given\.$~'
- '~^Parameter #2 \$id_lang of static method ToolsCore::displayDate\(\) expects int|null, true given\.$~'

View File

@@ -0,0 +1,12 @@
includes:
- %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon
parameters:
ignoreErrors:
# module specific
- '~^Parameter #2 \$active of static method CurrencyCore::getCurrencies\(\) expects bool, int given\.$~'
- '~^Parameter #3 \$groupBy of static method CurrencyCore::getCurrencies\(\) expects bool, Shop given\.$~'
- '~^Parameter #\d+ \$\w+ of static method ProductCore::priceCalculation\(\) expects \w+, \w+ given\.$~'
- '~^Access to an undefined property Cookie::\$id_lang\.$~'
- '~^Parameter #1 \$master of static method DbCore::getInstance\(\) expects bool, int given\.$~'
- '~^Parameter #2 \$id_lang of static method ToolsCore::displayDate\(\) expects int|null, true given\.$~'

View File

@@ -0,0 +1,11 @@
includes:
- %currentWorkingDirectory%/tests/php/phpstan/phpstan.neon
parameters:
ignoreErrors:
# module specific
- '~^Parameter #2 \$active of static method CurrencyCore::getCurrencies\(\) expects bool, int given\.$~'
- '~^Parameter #3 \$groupBy of static method CurrencyCore::getCurrencies\(\) expects bool, Shop given\.$~'
- '~^Parameter #\d+ \$\w+ of static method ProductCore::priceCalculation\(\) expects \w+, \w+ given\.$~'
- '~^Parameter #2 \$full of static method ToolsCore::displayDate\(\) expects bool, null given\.$~'
- '~^Static method ToolsCore::displayDate\(\) invoked with 3 parameters, 1-2 required\.$~'

View File

@@ -0,0 +1,13 @@
includes:
- %currentWorkingDirectory%/vendor/prestashop/php-dev-tools/phpstan/ps-module-extension.neon
parameters:
paths:
# From PHPStan 0.12, paths to check are relative to the neon file
- ../../../ps_facetedsearch.php
- ../../../ps_facetedsearch-attribute-indexer.php
- ../../../ps_facetedsearch-clear-cache.php
- ../../../ps_facetedsearch-price-indexer.php
- ../../../src/
- ../../../upgrade/
level: 5