Initial commit

This commit is contained in:
2019-11-20 07:44:43 +01:00
commit 5bf49c4a81
41188 changed files with 5459177 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
FROM phpstan/phpstan:latest
RUN apk --update --progress --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.7/community add \
php7-zip

View File

@@ -0,0 +1,68 @@
<?php
$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';
// Lib existing on PS 1.6
if (file_exists(_PS_TOOL_DIR_ . 'tar/Archive_Tar.php')) {
require_once _PS_TOOL_DIR_ . 'tar/Archive_Tar.php';
}
// Make sure loader php-parser is coming from php stan composer
$loader = new \Composer\Autoload\ClassLoader();
$loader->setPsr4('PhpParser\\', array('/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_SERVER_',
'_DB_NAME_',
'_DB_USER_',
'_DB_PASSWD_',
'_MYSQL_ENGINE_',
'_COOKIE_KEY_',
'_COOKIE_IV_',
'_PS_VERSION_',
'_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,33 @@
#################################################################################
# This file is a copy of phpstan.neon with additional rules for PS 1.6
# Its objective is to avoid false-positive results regarding non-existing classes
#################################################################################
parameters:
bootstrap: /web/module/tests/phpstan/bootstrap.php
reportUnmatchedIgnoredErrors: false
paths:
- /web/module/classes
excludes_analyse:
- /web/module/classes/Tools14.php
- /web/module/classes/pclzip.lib.php
- /web/module/functions.php
- /web/module/classes/UpgradeTools/CoreUpgrader/CoreUpgrader17.php
- /web/module/classes/UpgradeTools/SymfonyAdapter.php
ignoreErrors:
# module specific
- '#Function deactivate_custom_modules not found.#'
- '#Constant MCRYPT_[A-Z0-9_]+ not found.#'
- "#Call to function method_exists#"
# CLDR related check
- '#[cC]lass PrestaShop\\PrestaShop\\Core\\Cldr\\Update#'
# AppKernel wasn't properly listed in autoloader
- '#AppKernel#'
# Below are messages ignored on PS 1.6
- '#[cC]lass PrestaShop\\PrestaShop\\Core\\Addon\\Theme\\ThemeManagerBuilder#'
- '#PrestaShop\\Module\\AutoUpgrade\\UpgradeTools\\ModuleAdapter#'
- '#PrestaShop\\PrestaShop\\Adapter\\Module\\ModuleDataUpdater#'
- '#PrestaShopBundle\\Install\\Upgrade#'
- '#Call to an undefined static method ConfigurationTest::test_curl().#'
level: 5

View File

@@ -0,0 +1,20 @@
parameters:
bootstrap: /web/module/tests/phpstan/bootstrap.php
reportUnmatchedIgnoredErrors: false
paths:
- /web/module/classes
excludes_analyse:
- /web/module/classes/Tools14.php
- /web/module/classes/pclzip.lib.php
- /web/module/functions.php
ignoreErrors:
# module specific
- '#Function deactivate_custom_modules not found.#'
- '#Constant MCRYPT_[A-Z0-9_]+ not found.#'
- "#Call to function method_exists#"
# CLDR related check
- '#[cC]lass PrestaShop\\PrestaShop\\Core\\Cldr\\Update#'
# AppKernel wasn't properly listed in autoloader
- '#AppKernel#'
level: 5