diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml
index 42f16bf..6899c65 100644
--- a/.github/workflows/php.yml
+++ b/.github/workflows/php.yml
@@ -1,80 +1,89 @@
name: PHP tests
on: [push, pull_request]
jobs:
- # Check there is no syntax errors in the project
- php-linter:
- name: PHP Syntax check 5.6|7.2|7.3
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v2.0.0
-
- - name: PHP syntax checker 5.6
- uses: prestashop/github-action-php-lint/5.6@master
-
- - name: PHP syntax checker 7.2
- uses: prestashop/github-action-php-lint/7.2@master
-
- - name: PHP syntax checker 7.3
- uses: prestashop/github-action-php-lint/7.3@master
-
- # Check the PHP code follow the coding standards
- php-cs-fixer:
- name: PHP-CS-Fixer
- runs-on: ubuntu-latest
- steps:
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: '7.4'
-
- - name: Checkout
- uses: actions/checkout@v2.0.0
-
- - name: Cache dependencies
- uses: actions/cache@v2
- with:
- path: vendor
- key: php-${{ hashFiles('composer.lock') }}
-
- - name: Install dependencies
- run: composer install
-
- - name: Run PHP-CS-Fixer
- run: ./vendor/bin/php-cs-fixer fix --dry-run --diff --using-cache=no --diff-format udiff
-
- # Run PHPStan against the module and a PrestaShop release
- phpstan:
- name: PHPStan
- runs-on: ubuntu-latest
- strategy:
- matrix:
- presta-versions: ['1.7.1.2', '1.7.2.5', '1.7.3.4', '1.7.4.4', '1.7.5.1', '1.7.6.9', '1.7.7.4', 'latest']
- steps:
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: '7.4'
-
- - name: Checkout
- uses: actions/checkout@v2.0.0
-
- # Add vendor folder in cache to make next builds faster
- - name: Cache vendor folder
- uses: actions/cache@v1
- with:
- path: vendor
- key: php-${{ hashFiles('composer.lock') }}
-
- # Add composer local folder in cache to make next builds faster
- - name: Cache composer folder
- uses: actions/cache@v1
- with:
- path: ~/.composer/cache
- key: php-composer-cache
-
- - run: composer install
-
- # Docker images prestashop/prestashop may be used, even if the shop remains uninstalled
- - name: Execute PHPStan on PrestaShop (Tag ${{ matrix.presta-versions }})
- run: ./tests/phpstan.sh ${{ matrix.presta-versions }}
+ # Check there is no syntax errors in the project
+ php-linter:
+ name: PHP Syntax check 5.6 => 8.1
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2.0.0
+
+ - name: PHP syntax checker 5.6
+ uses: prestashop/github-action-php-lint/5.6@master
+
+ - name: PHP syntax checker 7.2
+ uses: prestashop/github-action-php-lint/7.2@master
+
+ - name: PHP syntax checker 7.3
+ uses: prestashop/github-action-php-lint/7.3@master
+
+ - name: PHP syntax checker 7.4
+ uses: prestashop/github-action-php-lint/7.4@master
+
+ - name: PHP syntax checker 8.0
+ uses: prestashop/github-action-php-lint/8.0@master
+
+ - name: PHP syntax checker 8.1
+ uses: prestashop/github-action-php-lint/8.1@master
+
+ # Check the PHP code follow the coding standards
+ php-cs-fixer:
+ name: PHP-CS-Fixer
+ runs-on: ubuntu-latest
+ steps:
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: '7.4'
+
+ - name: Checkout
+ uses: actions/checkout@v2.0.0
+
+ - name: Cache dependencies
+ uses: actions/cache@v2
+ with:
+ path: vendor
+ key: php-${{ hashFiles('composer.lock') }}
+
+ - name: Install dependencies
+ run: composer install
+
+ - name: Run PHP-CS-Fixer
+ run: ./vendor/bin/php-cs-fixer fix --dry-run --diff --using-cache=no --diff-format udiff
+
+ # Run PHPStan against the module and a PrestaShop release
+ phpstan:
+ name: PHPStan
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ presta-versions: ['1.7.1.2', '1.7.2.5', '1.7.3.4', '1.7.4.4', '1.7.5.1', '1.7.6', '1.7.7', '1.7.8', 'latest']
+ steps:
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: '7.4'
+
+ - name: Checkout
+ uses: actions/checkout@v2.0.0
+
+ # Add vendor folder in cache to make next builds faster
+ - name: Cache vendor folder
+ uses: actions/cache@v1
+ with:
+ path: vendor
+ key: php-${{ hashFiles('composer.lock') }}
+
+ # Add composer local folder in cache to make next builds faster
+ - name: Cache composer folder
+ uses: actions/cache@v1
+ with:
+ path: ~/.composer/cache
+ key: php-composer-cache
+
+ - run: composer install
+
+ # Docker images prestashop/prestashop may be used, even if the shop remains uninstalled
+ - name: Execute PHPStan on PrestaShop (Tag ${{ matrix.presta-versions }})
+ run: ./tests/phpstan.sh ${{ matrix.presta-versions }}
diff --git a/ps_mainmenu.php b/ps_mainmenu.php
index 85d005f..63a9beb 100644
--- a/ps_mainmenu.php
+++ b/ps_mainmenu.php
@@ -449,7 +449,7 @@ protected function makeMenuOption()
case 'CMS_CAT':
$category = new CMSCategory((int) $id, (int) $id_lang);
if (Validate::isLoadedObject($category)) {
- $html .= '' . PHP_EOL;
+ $html .= '' . PHP_EOL;
}
break;
diff --git a/tests/phpstan/phpstan-1.7.1.2.neon b/tests/phpstan/phpstan-1.7.1.2.neon
index cb8b6b4..7112c9d 100644
--- a/tests/phpstan/phpstan-1.7.1.2.neon
+++ b/tests/phpstan/phpstan-1.7.1.2.neon
@@ -4,11 +4,9 @@ includes:
parameters:
ignoreErrors:
- '#Access to an undefined property HelperList\:\:\$shopLinkType.#'
- - '#Access to protected property HelperForm\:\:\$fields_form.#'
- '#Call to method assign\(\) on an unknown class Smarty_Data.#'
- '#Parameter \#1 \$id of class Supplier constructor expects null, int given.#'
- '#Parameter \#1 \$idCategory of class Category constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Category constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Supplier constructor expects null, int given.#'
- '#Parameter \#2 \$selection of static method CMSCore\:\:getLinks\(\) expects null, array given.#'
- - '#Parameter \#2 \$value of static method CacheCore\:\:store\(\) expects string, array given.#'
diff --git a/tests/phpstan/phpstan-1.7.2.5.neon b/tests/phpstan/phpstan-1.7.2.5.neon
index cb8b6b4..7112c9d 100644
--- a/tests/phpstan/phpstan-1.7.2.5.neon
+++ b/tests/phpstan/phpstan-1.7.2.5.neon
@@ -4,11 +4,9 @@ includes:
parameters:
ignoreErrors:
- '#Access to an undefined property HelperList\:\:\$shopLinkType.#'
- - '#Access to protected property HelperForm\:\:\$fields_form.#'
- '#Call to method assign\(\) on an unknown class Smarty_Data.#'
- '#Parameter \#1 \$id of class Supplier constructor expects null, int given.#'
- '#Parameter \#1 \$idCategory of class Category constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Category constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Supplier constructor expects null, int given.#'
- '#Parameter \#2 \$selection of static method CMSCore\:\:getLinks\(\) expects null, array given.#'
- - '#Parameter \#2 \$value of static method CacheCore\:\:store\(\) expects string, array given.#'
diff --git a/tests/phpstan/phpstan-1.7.3.4.neon b/tests/phpstan/phpstan-1.7.3.4.neon
index cb8b6b4..bf9467d 100644
--- a/tests/phpstan/phpstan-1.7.3.4.neon
+++ b/tests/phpstan/phpstan-1.7.3.4.neon
@@ -4,7 +4,6 @@ includes:
parameters:
ignoreErrors:
- '#Access to an undefined property HelperList\:\:\$shopLinkType.#'
- - '#Access to protected property HelperForm\:\:\$fields_form.#'
- '#Call to method assign\(\) on an unknown class Smarty_Data.#'
- '#Parameter \#1 \$id of class Supplier constructor expects null, int given.#'
- '#Parameter \#1 \$idCategory of class Category constructor expects null, int given.#'
diff --git a/tests/phpstan/phpstan-1.7.4.4.neon b/tests/phpstan/phpstan-1.7.4.4.neon
index cb8b6b4..9c34a64 100644
--- a/tests/phpstan/phpstan-1.7.4.4.neon
+++ b/tests/phpstan/phpstan-1.7.4.4.neon
@@ -4,8 +4,6 @@ includes:
parameters:
ignoreErrors:
- '#Access to an undefined property HelperList\:\:\$shopLinkType.#'
- - '#Access to protected property HelperForm\:\:\$fields_form.#'
- - '#Call to method assign\(\) on an unknown class Smarty_Data.#'
- '#Parameter \#1 \$id of class Supplier constructor expects null, int given.#'
- '#Parameter \#1 \$idCategory of class Category constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Category constructor expects null, int given.#'
diff --git a/tests/phpstan/phpstan-1.7.5.1.neon b/tests/phpstan/phpstan-1.7.5.1.neon
index 3d4cbca..9c34a64 100644
--- a/tests/phpstan/phpstan-1.7.5.1.neon
+++ b/tests/phpstan/phpstan-1.7.5.1.neon
@@ -4,7 +4,6 @@ includes:
parameters:
ignoreErrors:
- '#Access to an undefined property HelperList\:\:\$shopLinkType.#'
- - '#Access to protected property HelperForm\:\:\$fields_form.#'
- '#Parameter \#1 \$id of class Supplier constructor expects null, int given.#'
- '#Parameter \#1 \$idCategory of class Category constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Category constructor expects null, int given.#'
diff --git a/tests/phpstan/phpstan-1.7.6.9.neon b/tests/phpstan/phpstan-1.7.6.neon
similarity index 84%
rename from tests/phpstan/phpstan-1.7.6.9.neon
rename to tests/phpstan/phpstan-1.7.6.neon
index 1a0dfc1..9c34a64 100644
--- a/tests/phpstan/phpstan-1.7.6.9.neon
+++ b/tests/phpstan/phpstan-1.7.6.neon
@@ -4,10 +4,9 @@ includes:
parameters:
ignoreErrors:
- '#Access to an undefined property HelperList\:\:\$shopLinkType.#'
- - '#Access to protected property HelperForm\:\:\$fields_form.#'
- '#Parameter \#1 \$id of class Supplier constructor expects null, int given.#'
- '#Parameter \#1 \$idCategory of class Category constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Category constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Supplier constructor expects null, int given.#'
- '#Parameter \#2 \$selection of static method CMSCore\:\:getLinks\(\) expects null, array given.#'
- - '#Parameter \#2 \$value of static method CacheCore\:\:store\(\) expects string, array given.#'
\ No newline at end of file
+ - '#Parameter \#2 \$value of static method CacheCore\:\:store\(\) expects string, array given.#'
diff --git a/tests/phpstan/phpstan-1.7.7.4.neon b/tests/phpstan/phpstan-1.7.7.neon
similarity index 87%
rename from tests/phpstan/phpstan-1.7.7.4.neon
rename to tests/phpstan/phpstan-1.7.7.neon
index 2d5e2aa..8daaf0a 100644
--- a/tests/phpstan/phpstan-1.7.7.4.neon
+++ b/tests/phpstan/phpstan-1.7.7.neon
@@ -4,7 +4,6 @@ includes:
parameters:
ignoreErrors:
- '#Access to an undefined property HelperList\:\:\$shopLinkType.#'
- - '#Access to protected property HelperForm\:\:\$fields_form.#'
- '#Parameter \#1 \$id of class Supplier constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Supplier constructor expects null, int given.#'
- '#Parameter \#2 \$selection of static method CMSCore\:\:getLinks\(\) expects null, array given.#'
diff --git a/tests/phpstan/phpstan-1.7.8.neon b/tests/phpstan/phpstan-1.7.8.neon
new file mode 100644
index 0000000..8daaf0a
--- /dev/null
+++ b/tests/phpstan/phpstan-1.7.8.neon
@@ -0,0 +1,9 @@
+includes:
+ - %currentWorkingDirectory%/tests/phpstan/phpstan.neon
+
+parameters:
+ ignoreErrors:
+ - '#Access to an undefined property HelperList\:\:\$shopLinkType.#'
+ - '#Parameter \#1 \$id of class Supplier constructor expects null, int given.#'
+ - '#Parameter \#2 \$idLang of class Supplier constructor expects null, int given.#'
+ - '#Parameter \#2 \$selection of static method CMSCore\:\:getLinks\(\) expects null, array given.#'
diff --git a/tests/phpstan/phpstan-latest.neon b/tests/phpstan/phpstan-latest.neon
index 187e2da..8daaf0a 100644
--- a/tests/phpstan/phpstan-latest.neon
+++ b/tests/phpstan/phpstan-latest.neon
@@ -4,8 +4,6 @@ includes:
parameters:
ignoreErrors:
- '#Access to an undefined property HelperList\:\:\$shopLinkType.#'
- - '#Access to protected property HelperForm\:\:\$fields_form.#'
- '#Parameter \#1 \$id of class Supplier constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Supplier constructor expects null, int given.#'
- '#Parameter \#2 \$selection of static method CMSCore\:\:getLinks\(\) expects null, array given.#'
- - '~^Binary operation "\." between string and array results in an error\.$~'
diff --git a/tests/phpstan/phpstan.neon b/tests/phpstan/phpstan.neon
index 931fc92..6db991b 100644
--- a/tests/phpstan/phpstan.neon
+++ b/tests/phpstan/phpstan.neon
@@ -8,6 +8,4 @@ parameters:
- ../../ps_menutoplinks.class.php
- ../../translations/
- ../../views/
- reportUnmatchedIgnoredErrors: false
level: 5
-
\ No newline at end of file