From 17cd250acc3b1362f19adc24e2f10f3d497a412b Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 2 Apr 2021 10:14:26 +0200 Subject: [PATCH] Fixed PHPStan --- .github/workflows/php.yml | 2 +- ps_featuredproducts.php | 2 +- tests/phpstan.sh | 0 tests/phpstan/phpstan-1.7.1.2.neon | 7 ++++++- tests/phpstan/phpstan-1.7.2.5.neon | 7 ++++++- tests/phpstan/phpstan-1.7.4.4.neon | 6 +++++- tests/phpstan/phpstan-1.7.5.1.neon | 6 ++++++ tests/phpstan/phpstan-1.7.5.2.neon | 2 -- tests/phpstan/phpstan-1.7.6.9.neon | 6 +++++- 9 files changed, 30 insertions(+), 8 deletions(-) mode change 100644 => 100755 tests/phpstan.sh create mode 100644 tests/phpstan/phpstan-1.7.5.1.neon delete mode 100644 tests/phpstan/phpstan-1.7.5.2.neon diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 15939ec..ec34ca2 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -49,7 +49,7 @@ jobs: 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.2', '1.7.6.9', '1.7.7.3', 'latest'] + 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.3', 'latest'] steps: - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/ps_featuredproducts.php b/ps_featuredproducts.php index ce10e64..7c43be6 100644 --- a/ps_featuredproducts.php +++ b/ps_featuredproducts.php @@ -135,7 +135,7 @@ public function getContent() if (!Validate::isBool($rand)) { $errors[] = $this->trans('Invalid value for the "randomize" flag.', [], 'Modules.Featuredproducts.Admin'); } - if (isset($errors) && count($errors)) { + if (count($errors)) { $output = $this->displayError(implode('
', $errors)); } else { Configuration::updateValue('HOME_FEATURED_NBR', (int) $nbr); diff --git a/tests/phpstan.sh b/tests/phpstan.sh old mode 100644 new mode 100755 diff --git a/tests/phpstan/phpstan-1.7.1.2.neon b/tests/phpstan/phpstan-1.7.1.2.neon index 03d5d1c..2736d87 100644 --- a/tests/phpstan/phpstan-1.7.1.2.neon +++ b/tests/phpstan/phpstan-1.7.1.2.neon @@ -1,2 +1,7 @@ includes: - - %currentWorkingDirectory%/tests/phpstan/phpstan.neon \ No newline at end of file + - %currentWorkingDirectory%/tests/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Call to method assign\(\) on an unknown class Smarty_Data#' + - '#Parameter \#1 \$idCategory of class Category constructor expects null, int given#' diff --git a/tests/phpstan/phpstan-1.7.2.5.neon b/tests/phpstan/phpstan-1.7.2.5.neon index 03d5d1c..ad1729f 100644 --- a/tests/phpstan/phpstan-1.7.2.5.neon +++ b/tests/phpstan/phpstan-1.7.2.5.neon @@ -1,2 +1,7 @@ includes: - - %currentWorkingDirectory%/tests/phpstan/phpstan.neon \ No newline at end of file + - %currentWorkingDirectory%/tests/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Call to method assign\(\) on an unknown class Smarty_Data#' + - '#Parameter \#1 \$idCategory of class Category constructor expects null, int given#' \ No newline at end of file diff --git a/tests/phpstan/phpstan-1.7.4.4.neon b/tests/phpstan/phpstan-1.7.4.4.neon index 03d5d1c..f7bd98b 100644 --- a/tests/phpstan/phpstan-1.7.4.4.neon +++ b/tests/phpstan/phpstan-1.7.4.4.neon @@ -1,2 +1,6 @@ includes: - - %currentWorkingDirectory%/tests/phpstan/phpstan.neon \ No newline at end of file + - %currentWorkingDirectory%/tests/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Parameter \#1 \$idCategory 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 new file mode 100644 index 0000000..f7bd98b --- /dev/null +++ b/tests/phpstan/phpstan-1.7.5.1.neon @@ -0,0 +1,6 @@ +includes: + - %currentWorkingDirectory%/tests/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Parameter \#1 \$idCategory of class Category constructor expects null, int given#' diff --git a/tests/phpstan/phpstan-1.7.5.2.neon b/tests/phpstan/phpstan-1.7.5.2.neon deleted file mode 100644 index 03d5d1c..0000000 --- a/tests/phpstan/phpstan-1.7.5.2.neon +++ /dev/null @@ -1,2 +0,0 @@ -includes: - - %currentWorkingDirectory%/tests/phpstan/phpstan.neon \ No newline at end of file diff --git a/tests/phpstan/phpstan-1.7.6.9.neon b/tests/phpstan/phpstan-1.7.6.9.neon index 03d5d1c..2b26344 100644 --- a/tests/phpstan/phpstan-1.7.6.9.neon +++ b/tests/phpstan/phpstan-1.7.6.9.neon @@ -1,2 +1,6 @@ includes: - - %currentWorkingDirectory%/tests/phpstan/phpstan.neon \ No newline at end of file + - %currentWorkingDirectory%/tests/phpstan/phpstan.neon + +parameters: + ignoreErrors: + - '#Parameter \#1 \$idCategory of class Category constructor expects null, int given#' \ No newline at end of file