From ec53e0a64ca1df2eb90b9e31cce3f06f0d695e6d Mon Sep 17 00:00:00 2001 From: ADmad Date: Fri, 16 Dec 2022 14:40:28 +0530 Subject: [PATCH] Fix errors reported by phpstan --- .github/workflows/ci.yml | 2 +- phpstan-baseline.neon | 34 ++-------------------------------- phpstan.neon | 1 + src/Action/DashboardAction.php | 2 +- 4 files changed, 5 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db57c4b8..36d3dbce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,7 +57,7 @@ jobs: php-version: '7.4' extensions: mbstring, intl coverage: none - tools: vimeo/psalm:4.22, phpstan:1.4 + tools: vimeo/psalm:4, phpstan:1.9 - name: Composer Install run: composer require --dev cakephp/cakephp-codesniffer:^4.1 diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index c4333366..a039fbbe 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,22 +1,7 @@ parameters: ignoreErrors: - - message: "#^Access to an undefined property object\\:\\:\\$element\\.$#" - count: 1 - path: src/Listener/ViewListener.php - - - - message: "#^Access to an undefined property object\\:\\:\\$query\\.$#" - count: 4 - path: src/Listener/ViewListener.php - - - - message: "#^Access to an undefined property object\\:\\:\\$type\\.$#" - count: 1 - path: src/Listener/ViewListener.php - - - - message: "#^Cannot unset offset mixed on array\\.$#" + message: "#^Cannot unset offset mixed on array\\{\\}\\.$#" count: 2 path: src/Listener/ViewListener.php @@ -41,22 +26,7 @@ parameters: path: src/Listener/ViewSearchListener.php - - message: "#^Binary operation \"\\+\" between string and array\\{data\\-enable\\-seconds\\?\\: 'true', data\\-date\\-format\\: string, data\\-alt\\-format\\?\\: mixed, data\\-alt\\-input\\?\\: 'true', data\\-no\\-calendar\\?\\: 'true', data\\-enable\\-time\\?\\: 'true', data\\-alt\\-input\\-class\\?\\: string, class\\: array\\{'input\\-group', 'flatpickr'\\}\\} results in an error\\.$#" - count: 1 - path: src/View/Widget/DateTimeWidget.php - - - - message: "#^Binary operation \"\\+\\=\" between array\\\\|string and array\\{data\\-enable\\-seconds\\?\\: 'true', data\\-date\\-format\\: string, data\\-alt\\-format\\?\\: mixed, data\\-alt\\-input\\?\\: 'true', data\\-no\\-calendar\\?\\: 'true', data\\-enable\\-time\\?\\: 'true'\\} results in an error\\.$#" - count: 1 - path: src/View/Widget/DateTimeWidget.php - - - - message: "#^Offset 'data\\-wrap' does not exist on array\\{data\\-enable\\-seconds\\?\\: 'true', data\\-date\\-format\\: string, data\\-alt\\-format\\?\\: mixed, data\\-alt\\-input\\?\\: 'true', data\\-no\\-calendar\\?\\: 'true', data\\-enable\\-time\\?\\: 'true'\\}\\.$#" - count: 1 - path: src/View/Widget/DateTimeWidget.php - - - - message: "#^Offset 'iconClass' on array\\{data\\-enable\\-seconds\\?\\: 'true', data\\-date\\-format\\: string, data\\-alt\\-format\\?\\: mixed, data\\-alt\\-input\\?\\: 'true', data\\-no\\-calendar\\?\\: 'true', data\\-enable\\-time\\?\\: 'true'\\} in isset\\(\\) does not exist\\.$#" + message: "#^Binary operation \"\\+\" between string and non\\-empty\\-array results in an error\\.$#" count: 1 path: src/View/Widget/DateTimeWidget.php diff --git a/phpstan.neon b/phpstan.neon index aba18000..3b09bdc5 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -4,6 +4,7 @@ includes: parameters: level: 7 checkMissingIterableValueType: false + checkGenericClassInNonGenericObjectType: false paths: - src universalObjectCratesClasses: diff --git a/src/Action/DashboardAction.php b/src/Action/DashboardAction.php index fd8b12b1..cc9bfde4 100644 --- a/src/Action/DashboardAction.php +++ b/src/Action/DashboardAction.php @@ -19,7 +19,7 @@ class DashboardAction extends BaseAction /** * HTTP GET handler * - * @return void|\Cake\Http\Response + * @return void */ protected function _get() {