From 9f07c06233c1d75508faa6ef0855128752d5e5a9 Mon Sep 17 00:00:00 2001 From: ADmad Date: Fri, 16 Dec 2022 14:30:35 +0530 Subject: [PATCH 1/2] Update composer config --- composer.json | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index aa162fc..36542f6 100644 --- a/composer.json +++ b/composer.json @@ -30,8 +30,8 @@ ], "require": { "cakephp/cakephp": "^4.0", - "friendsofcake/crud": "^6.0", - "friendsofcake/bootstrap-ui": "^3.0" + "friendsofcake/bootstrap-ui": "^3.0", + "friendsofcake/crud": "^6.0" }, "require-dev": { "friendsofcake/cakephp-test-utilities": "^2.0", @@ -54,5 +54,11 @@ "wiki": "http://cakephp.nu/cakephp-crud/", "irc": "irc://irc.freenode.org/friendsofcake" }, - "prefer-stable": true + "prefer-stable": true, + "config": { + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + } } From ec53e0a64ca1df2eb90b9e31cce3f06f0d695e6d Mon Sep 17 00:00:00 2001 From: ADmad Date: Fri, 16 Dec 2022 14:40:28 +0530 Subject: [PATCH 2/2] 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 db57c4b..36d3dbc 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 c433336..a039fbb 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 aba1800..3b09bdc 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 fd8b12b..cc9bfde 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() {