From 1fd00d4325ca4d14820d14e35f6d582752f13cd7 Mon Sep 17 00:00:00 2001 From: Matt75 <5262628+Matt75@users.noreply.github.com> Date: Mon, 8 Jun 2020 19:51:52 +0200 Subject: [PATCH 1/4] Fix colorpicker img when PrestaShop is in subfolder --- .../admin/ps_cart_banner/helpers/options/options.tpl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/views/templates/admin/ps_cart_banner/helpers/options/options.tpl b/views/templates/admin/ps_cart_banner/helpers/options/options.tpl index 8098bea..ea359b2 100644 --- a/views/templates/admin/ps_cart_banner/helpers/options/options.tpl +++ b/views/templates/admin/ps_cart_banner/helpers/options/options.tpl @@ -36,3 +36,11 @@ {$smarty.block.parent} {/if} {/block} + +{block name="after"} + {$smarty.block.parent} + +{/block} From a9f014da2881f30daa0eef2f6d41918ab62eff00 Mon Sep 17 00:00:00 2001 From: Matt75 <5262628+Matt75@users.noreply.github.com> Date: Mon, 8 Jun 2020 20:06:35 +0200 Subject: [PATCH 2/4] Adds a notice about hook displayContentWrapperTop requirement --- translations/fr.php | 1 + .../admin/ps_cart_banner/helpers/options/options.tpl | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/translations/fr.php b/translations/fr.php index 95adeb5..02555e1 100644 --- a/translations/fr.php +++ b/translations/fr.php @@ -24,3 +24,4 @@ $_MODULE['<{pscartbanner}prestashop>adminpscartbannercontroller_a3fcbca4ae66e2e8faad2ade91962215'] = 'Contenu'; $_MODULE['<{pscartbanner}prestashop>adminpscartbannercontroller_447efb99e205a877cbaf985ce87a01f4'] = 'Couleur de la bordure'; $_MODULE['<{pscartbanner}prestashop>adminpscartbannercontroller_c9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer'; +$_MODULE['<{pscartbanner}prestashop>options_90fbc1cc37c2c3c8a7fb59573928f8fe'] = 'Votre thème doit implémenter le hook displayContentWrapperTop pour que cette bannière s\'affiche sur la page du panier.'; diff --git a/views/templates/admin/ps_cart_banner/helpers/options/options.tpl b/views/templates/admin/ps_cart_banner/helpers/options/options.tpl index 8098bea..c9e4cf1 100644 --- a/views/templates/admin/ps_cart_banner/helpers/options/options.tpl +++ b/views/templates/admin/ps_cart_banner/helpers/options/options.tpl @@ -19,6 +19,13 @@ {extends file="helpers/options/options.tpl"} +{block name="defaultOptions"} +
+ {l s='Your theme should use hook displayContentWrapperTop to display this banner on cart page.' mod='pscartbanner'} +
+ {$smarty.block.parent} +{/block} + {block name="input"} {if $field['type'] == 'color'}
From 49bb15453675f56d5a07ce055af0c97c07e92fa8 Mon Sep 17 00:00:00 2001 From: Matt75 <5262628+Matt75@users.noreply.github.com> Date: Mon, 8 Jun 2020 20:10:17 +0200 Subject: [PATCH 3/4] Bump version to 1.0.1 --- config.xml | 20 ++++++++++---------- pscartbanner.php | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/config.xml b/config.xml index df19842..8ea078b 100644 --- a/config.xml +++ b/config.xml @@ -1,13 +1,13 @@ - pscartbanner - - - - - - - 1 - 0 - + pscartbanner + + + + + + + 1 + 0 + diff --git a/pscartbanner.php b/pscartbanner.php index 30aad89..b360ff4 100644 --- a/pscartbanner.php +++ b/pscartbanner.php @@ -42,7 +42,7 @@ public function __construct() { $this->name = 'pscartbanner'; $this->tab = 'front_office_features'; - $this->version = '1.0.0'; + $this->version = '1.0.1'; $this->author = 'PrestaShop'; $this->need_instance = 0; $this->module_key = '3d10739ecd14e39868c81153c94a6f8c'; From 20aa177bb0bfd0804166a410c893caa10a79a56d Mon Sep 17 00:00:00 2001 From: Matt75 <5262628+Matt75@users.noreply.github.com> Date: Mon, 8 Jun 2020 20:15:45 +0200 Subject: [PATCH 4/4] Update devtools --- .github/workflows/php.yml | 2 +- composer.json | 11 ++- composer.lock | 162 ++++++++++++++++++------------------ tests/phpstan/bootstrap.php | 93 --------------------- tests/phpstan/phpstan.neon | 12 +-- 5 files changed, 96 insertions(+), 184 deletions(-) delete mode 100644 tests/phpstan/bootstrap.php diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 190adbe..09da452 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -44,4 +44,4 @@ jobs: - name: Pull PrestaShop files (Tag ${{ matrix.presta-versions }}) run: docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:${{ matrix.presta-versions }} - name : Run PHPStan - run: docker run --rm --volumes-from temp-ps -v $PWD:/web/module -e _PS_ROOT_DIR_=/var/www/html --workdir=/web/module phpstan/phpstan:0.11.19 analyse --configuration=/web/module/tests/phpstan/phpstan.neon + run: docker run --rm --volumes-from temp-ps -v $PWD:/web/module -e _PS_ROOT_DIR_=/var/www/html --workdir=/web/module phpstan/phpstan:0.12 analyse --configuration=/web/module/tests/phpstan/phpstan.neon --error-format github diff --git a/composer.json b/composer.json index 4995425..eef3543 100755 --- a/composer.json +++ b/composer.json @@ -10,16 +10,14 @@ "email": "contact@prestashop.com" } ], - "require": { - "php": ">=5.6" - }, "require-dev": { - "prestashop/php-dev-tools": "^2.2" + "prestashop/php-dev-tools": "~3.0" }, "config": { "platform": { "php": "5.6.0" }, + "sort-packages": true, "preferred-install": "dist", "optimize-autoloader": true, "prepend-autoloader": false @@ -29,5 +27,10 @@ "controllers", "pscartbanner.php" ] + }, + "scripts": { + "set-license-header": [ + "@php ./vendor/bin/header-stamp --license=\"assets/afl.txt\" --exclude=\".github,vendor\"" + ] } } diff --git a/composer.lock b/composer.lock index 1f035b5..3ffe543 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4a7b491487104cd6f02e40fb8f88f9dc", + "content-hash": "fd059a1cdc6b137da0fc06b324f64c60", "packages": [], "packages-dev": [ { @@ -70,16 +70,16 @@ }, { "name": "composer/xdebug-handler", - "version": "1.4.1", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "1ab9842d69e64fb3a01be6b656501032d1b78cb7" + "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/1ab9842d69e64fb3a01be6b656501032d1b78cb7", - "reference": "1ab9842d69e64fb3a01be6b656501032d1b78cb7", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", + "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", "shasum": "" }, "require": { @@ -110,7 +110,7 @@ "Xdebug", "performance" ], - "time": "2020-03-01T12:26:26+00:00" + "time": "2020-06-04T11:16:35+00:00" }, { "name": "doctrine/annotations", @@ -242,16 +242,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.16.1", + "version": "v2.16.3", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "c8afb599858876e95e8ebfcd97812d383fa23f02" + "reference": "83baf823a33a1cbd5416c8626935cf3f843c10b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/c8afb599858876e95e8ebfcd97812d383fa23f02", - "reference": "c8afb599858876e95e8ebfcd97812d383fa23f02", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/83baf823a33a1cbd5416c8626935cf3f843c10b0", + "reference": "83baf823a33a1cbd5416c8626935cf3f843c10b0", "shasum": "" }, "require": { @@ -287,6 +287,7 @@ "symfony/yaml": "^3.0 || ^4.0 || ^5.0" }, "suggest": { + "ext-dom": "For handling output formats in XML", "ext-mbstring": "For handling non-UTF8 characters in cache signature.", "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.", @@ -309,6 +310,7 @@ "tests/Test/IntegrationCaseFactory.php", "tests/Test/IntegrationCaseFactoryInterface.php", "tests/Test/InternalIntegrationCaseFactory.php", + "tests/Test/IsIdenticalConstraint.php", "tests/TestCase.php" ] }, @@ -327,7 +329,7 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2019-11-25T22:10:32+00:00" + "time": "2020-04-15T18:51:10+00:00" }, { "name": "nikic/php-parser", @@ -528,16 +530,16 @@ }, { "name": "prestashop/php-dev-tools", - "version": "v2.2", + "version": "v3.4", "source": { "type": "git", "url": "https://github.com/PrestaShop/php-dev-tools.git", - "reference": "748144b54b315fb3158912f134bb9801c4903af9" + "reference": "892f85cfd8028776d520e444a6fc41f56f2d0a20" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PrestaShop/php-dev-tools/zipball/748144b54b315fb3158912f134bb9801c4903af9", - "reference": "748144b54b315fb3158912f134bb9801c4903af9", + "url": "https://api.github.com/repos/PrestaShop/php-dev-tools/zipball/892f85cfd8028776d520e444a6fc41f56f2d0a20", + "reference": "892f85cfd8028776d520e444a6fc41f56f2d0a20", "shasum": "" }, "require": { @@ -562,7 +564,7 @@ "MIT" ], "description": "PrestaShop coding standards", - "time": "2019-11-07T16:03:43+00:00" + "time": "2020-05-28T09:26:34+00:00" }, { "name": "psr/log", @@ -613,16 +615,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.5.4", + "version": "3.5.5", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "dceec07328401de6211037abbb18bda423677e26" + "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dceec07328401de6211037abbb18bda423677e26", - "reference": "dceec07328401de6211037abbb18bda423677e26", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/73e2e7f57d958e7228fce50dc0c61f58f017f9f6", + "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6", "shasum": "" }, "require": { @@ -660,20 +662,20 @@ "phpcs", "standards" ], - "time": "2020-01-30T22:20:29+00:00" + "time": "2020-04-17T01:09:41+00:00" }, { "name": "symfony/console", - "version": "v3.4.39", + "version": "v3.4.41", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "bf60d5e606cd595391c5f82bf6b570d9573fa120" + "reference": "bfe29ead7e7b1cc9ce74c6a40d06ad1f96fced13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/bf60d5e606cd595391c5f82bf6b570d9573fa120", - "reference": "bf60d5e606cd595391c5f82bf6b570d9573fa120", + "url": "https://api.github.com/repos/symfony/console/zipball/bfe29ead7e7b1cc9ce74c6a40d06ad1f96fced13", + "reference": "bfe29ead7e7b1cc9ce74c6a40d06ad1f96fced13", "shasum": "" }, "require": { @@ -732,20 +734,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2020-03-27T17:07:22+00:00" + "time": "2020-05-30T18:58:05+00:00" }, { "name": "symfony/debug", - "version": "v3.4.39", + "version": "v3.4.41", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "ce9f3b5e8e1c50f849fded59b3a1b6bc3562ec29" + "reference": "518c6a00d0872da30bd06aee3ea59a0a5cf54d6d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/ce9f3b5e8e1c50f849fded59b3a1b6bc3562ec29", - "reference": "ce9f3b5e8e1c50f849fded59b3a1b6bc3562ec29", + "url": "https://api.github.com/repos/symfony/debug/zipball/518c6a00d0872da30bd06aee3ea59a0a5cf54d6d", + "reference": "518c6a00d0872da30bd06aee3ea59a0a5cf54d6d", "shasum": "" }, "require": { @@ -788,20 +790,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2020-03-23T10:22:40+00:00" + "time": "2020-05-22T18:25:20+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v3.4.39", + "version": "v3.4.41", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "9d4e22943b73acc1ba50595b7de1a01fe9dbad48" + "reference": "14d978f8e8555f2de719c00eb65376be7d2e9081" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9d4e22943b73acc1ba50595b7de1a01fe9dbad48", - "reference": "9d4e22943b73acc1ba50595b7de1a01fe9dbad48", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/14d978f8e8555f2de719c00eb65376be7d2e9081", + "reference": "14d978f8e8555f2de719c00eb65376be7d2e9081", "shasum": "" }, "require": { @@ -851,20 +853,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2020-03-15T09:38:08+00:00" + "time": "2020-05-05T15:06:23+00:00" }, { "name": "symfony/filesystem", - "version": "v3.4.39", + "version": "v3.4.41", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "ec47520778d524b1736e768e0678cd1f01c03019" + "reference": "0f625d0cb1e59c8c4ba61abb170125175218ff10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/ec47520778d524b1736e768e0678cd1f01c03019", - "reference": "ec47520778d524b1736e768e0678cd1f01c03019", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/0f625d0cb1e59c8c4ba61abb170125175218ff10", + "reference": "0f625d0cb1e59c8c4ba61abb170125175218ff10", "shasum": "" }, "require": { @@ -901,11 +903,11 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2020-03-16T08:31:04+00:00" + "time": "2020-05-30T17:48:24+00:00" }, { "name": "symfony/finder", - "version": "v3.4.39", + "version": "v3.4.41", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -954,16 +956,16 @@ }, { "name": "symfony/options-resolver", - "version": "v3.4.39", + "version": "v3.4.41", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "730ef56164ed6c9356c159e9f5ff2b84d753b9ed" + "reference": "3b9fe6db7fe3694307d182dd73983584af77d5fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/730ef56164ed6c9356c159e9f5ff2b84d753b9ed", - "reference": "730ef56164ed6c9356c159e9f5ff2b84d753b9ed", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/3b9fe6db7fe3694307d182dd73983584af77d5fd", + "reference": "3b9fe6db7fe3694307d182dd73983584af77d5fd", "shasum": "" }, "require": { @@ -1004,20 +1006,20 @@ "configuration", "options" ], - "time": "2020-01-01T11:03:25+00:00" + "time": "2020-05-21T13:02:25+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14" + "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14", - "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e94c8b1bbe2bc77507a1056cdb06451c75b427f9", + "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9", "shasum": "" }, "require": { @@ -1029,7 +1031,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -1062,20 +1064,20 @@ "polyfill", "portable" ], - "time": "2020-02-27T09:26:54+00:00" + "time": "2020-05-12T16:14:59+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac" + "reference": "fa79b11539418b02fc5e1897267673ba2c19419c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/81ffd3a9c6d707be22e3012b827de1c9775fc5ac", - "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fa79b11539418b02fc5e1897267673ba2c19419c", + "reference": "fa79b11539418b02fc5e1897267673ba2c19419c", "shasum": "" }, "require": { @@ -1087,7 +1089,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -1121,20 +1123,20 @@ "portable", "shim" ], - "time": "2020-03-09T19:04:49+00:00" + "time": "2020-05-12T16:47:27+00:00" }, { "name": "symfony/polyfill-php70", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "2a18e37a489803559284416df58c71ccebe50bf0" + "reference": "82225c2d7d23d7e70515496d249c0152679b468e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/2a18e37a489803559284416df58c71ccebe50bf0", - "reference": "2a18e37a489803559284416df58c71ccebe50bf0", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/82225c2d7d23d7e70515496d249c0152679b468e", + "reference": "82225c2d7d23d7e70515496d249c0152679b468e", "shasum": "" }, "require": { @@ -1144,7 +1146,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -1180,20 +1182,20 @@ "portable", "shim" ], - "time": "2020-02-27T09:26:54+00:00" + "time": "2020-05-12T16:47:27+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "37b0976c78b94856543260ce09b460a7bc852747" + "reference": "f048e612a3905f34931127360bdd2def19a5e582" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/37b0976c78b94856543260ce09b460a7bc852747", - "reference": "37b0976c78b94856543260ce09b460a7bc852747", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/f048e612a3905f34931127360bdd2def19a5e582", + "reference": "f048e612a3905f34931127360bdd2def19a5e582", "shasum": "" }, "require": { @@ -1202,7 +1204,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -1235,20 +1237,20 @@ "portable", "shim" ], - "time": "2020-02-27T09:26:54+00:00" + "time": "2020-05-12T16:47:27+00:00" }, { "name": "symfony/process", - "version": "v3.4.39", + "version": "v3.4.41", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "1dbc09f6e14703ae2398efc86b02ae2bcd9a9931" + "reference": "8a895f0c92a7c4b10db95139bcff71bdf66d4d21" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/1dbc09f6e14703ae2398efc86b02ae2bcd9a9931", - "reference": "1dbc09f6e14703ae2398efc86b02ae2bcd9a9931", + "url": "https://api.github.com/repos/symfony/process/zipball/8a895f0c92a7c4b10db95139bcff71bdf66d4d21", + "reference": "8a895f0c92a7c4b10db95139bcff71bdf66d4d21", "shasum": "" }, "require": { @@ -1284,11 +1286,11 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2020-03-20T06:07:50+00:00" + "time": "2020-05-23T17:05:51+00:00" }, { "name": "symfony/stopwatch", - "version": "v3.4.39", + "version": "v3.4.41", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", @@ -1342,10 +1344,8 @@ "prefer-stable": false, "prefer-lowest": false, "platform": [], - "platform-dev": { - "php": ">=5.6" - }, + "platform-dev": [], "platform-overrides": { - "php": "5.6" + "php": "5.6.0" } } diff --git a/tests/phpstan/bootstrap.php b/tests/phpstan/bootstrap.php deleted file mode 100644 index 5f214dd..0000000 --- a/tests/phpstan/bootstrap.php +++ /dev/null @@ -1,93 +0,0 @@ - - * @copyright 2007-2020 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) - * International Registered Trademark & Property of PrestaShop SA - */ -$rootDir = getenv('_PS_ROOT_DIR_'); -if (!$rootDir) { - echo '[ERROR] Define _PS_ROOT_DIR_ with the path to PrestaShop folder' . PHP_EOL; - exit(1); -} - -$pathToModuleRoot = __DIR__ . '/../../'; - -// Add module composer autoloader -require_once $pathToModuleRoot . '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 - -// 1- Use with Docker container -$loader = new \Composer\Autoload\ClassLoader(); -$loader->setPsr4('PhpParser\\', ['/composer/vendor/nikic/php-parser/lib/PhpParser']); -$loader->register(true); -// 2- Use with PHPStan phar -$loader = new \Composer\Autoload\ClassLoader(); -// Contains the vendor in phar, like "phar://phpstan.phar/vendor" -$loader->setPsr4('PhpParser\\', ['phar://' . dirname($_SERVER['PATH_TRANSLATED']) . '/../phpstan/phpstan-shim/phpstan.phar/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_', - '_THEME_COL_DIR_', - '_PARENT_THEME_NAME_', - '__PS_BASE_URI__', - '_MODULE_DIR_', - '_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'); - } -} diff --git a/tests/phpstan/phpstan.neon b/tests/phpstan/phpstan.neon index 27f5ddc..7ad6474 100644 --- a/tests/phpstan/phpstan.neon +++ b/tests/phpstan/phpstan.neon @@ -1,10 +1,12 @@ +includes: + - %currentWorkingDirectory%/vendor/prestashop/php-dev-tools/phpstan/ps-module-extension.neon + parameters: - bootstrap: tests/phpstan/bootstrap.php paths: - - controllers - - pscartbanner.php - dynamicConstantNames: - - _PS_VERSION_ + # From PHPStan 0.12, paths to check are relative to the neon file + - ../../controllers + - ../../pscartbanner.php + reportUnmatchedIgnoredErrors: false ignoreErrors: - '#Property ModuleCore::\$version \(float\) does not accept string.#' - '#Parameter \#1 \$hook_name of method ModuleCore::registerHook\(\) expects string, array given.#'