From 35625cfccaa1492a27f19c224bcf2b230733b7c5 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Mon, 23 Dec 2024 16:31:40 +0000 Subject: [PATCH] Dev: Update phpstan for PHP 8.4 and regen base line, fixing a couple of errors in Options for phpstan --- Editor/Options.php | 4 +- composer.json | 2 +- phpstan-baseline.neon | 160 ------------------------------------------ 3 files changed, 3 insertions(+), 163 deletions(-) diff --git a/Editor/Options.php b/Editor/Options.php index aded0e8..8d76f37 100644 --- a/Editor/Options.php +++ b/Editor/Options.php @@ -114,7 +114,7 @@ class Options extends Ext /** * Constructor. * - * @param string $table As a string this is the database table name - see `->table()`. If given as a function, then it is passed to `->fn()` as a custom function. + * @param string|callable $table As a string this is the database table name - see `->table()`. If given as a function, then it is passed to `->fn()` as a custom function. * @param string $value The database column name to use as the value for the options - see `->value()` * @param string $label The database column name to use as the label for the options - see `->label()`. */ @@ -423,7 +423,7 @@ public function exec($db, $refresh, $search = null, $find = null) for ($j = 0; $j < count($this->_includes); ++$j) { $inc = $this->_includes[$j]; - if (isset($rows[$i][$inc])) { + if (isset($options[$i][$inc])) { $option[$inc] = $options[$i][$inc]; } } diff --git a/composer.json b/composer.json index bdcb6f7..c3965e0 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "require-dev": { "friendsofphp/php-cs-fixer": "~3.41.0", "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "~1.10.47", + "phpstan/phpstan": "~1.11", "phpstan/phpstan-deprecation-rules": "^1.0" }, "autoload": { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index d8fa29c..1ea6c29 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -75,11 +75,6 @@ parameters: count: 1 path: Database/Driver/PostgresResult.php - - - message: "#^Method DataTables\\\\Database\\\\Query\\:\\:_where_group\\(\\) should return string but return statement is missing\\.$#" - count: 1 - path: Database/Query.php - - message: "#^Method DataTables\\\\Database\\\\Query\\:\\:connect\\(\\) should return PDO but return statement is missing\\.$#" count: 1 @@ -120,16 +115,6 @@ parameters: count: 1 path: Editor.php - - - message: "#^Parameter \\#3 \\$pkey of method DataTables\\\\Editor\\:\\:_remove_table\\(\\) expects string\\|null, array\\ given\\.$#" - count: 1 - path: Editor.php - - - - message: "#^Property DataTables\\\\Editor\\:\\:\\$_db is never written, only read\\.$#" - count: 1 - path: Editor.php - - message: "#^Property DataTables\\\\Editor\\:\\:\\$_formData is never read, only written\\.$#" count: 1 @@ -140,11 +125,6 @@ parameters: count: 1 path: Editor.php - - - message: "#^Strict comparison using \\!\\=\\= between array and null will always evaluate to true\\.$#" - count: 1 - path: Editor.php - - message: "#^Strict comparison using \\!\\=\\= between string and null will always evaluate to true\\.$#" count: 1 @@ -180,31 +160,6 @@ parameters: count: 1 path: Editor/Field.php - - - message: "#^Property DataTables\\\\Editor\\\\Field\\:\\:\\$_getFormatter is never written, only read\\.$#" - count: 1 - path: Editor/Field.php - - - - message: "#^Property DataTables\\\\Editor\\\\Field\\:\\:\\$_getValue is never written, only read\\.$#" - count: 1 - path: Editor/Field.php - - - - message: "#^Property DataTables\\\\Editor\\\\Field\\:\\:\\$_setFormatter is never written, only read\\.$#" - count: 1 - path: Editor/Field.php - - - - message: "#^Property DataTables\\\\Editor\\\\Field\\:\\:\\$_setValue is never written, only read\\.$#" - count: 1 - path: Editor/Field.php - - - - message: "#^Property DataTables\\\\Editor\\\\Field\\:\\:\\$_upload is never written, only read\\.$#" - count: 1 - path: Editor/Field.php - - message: "#^Strict comparison using \\=\\=\\= between \\(callable\\(mixed\\)\\: string\\)\\|false and true will always evaluate to false\\.$#" count: 1 @@ -295,26 +250,6 @@ parameters: count: 1 path: Editor/Join.php - - - message: "#^Parameter \\#3 \\$data of method DataTables\\\\Editor\\\\Join\\:\\:_validateFields\\(\\) expects array\\, string given\\.$#" - count: 1 - path: Editor/Join.php - - - - message: "#^Property DataTables\\\\Editor\\\\Join\\:\\:\\$_customOrder is never written, only read\\.$#" - count: 1 - path: Editor/Join.php - - - - message: "#^Property DataTables\\\\Editor\\\\Join\\:\\:\\$_table is never written, only read\\.$#" - count: 1 - path: Editor/Join.php - - - - message: "#^Property DataTables\\\\Editor\\\\Join\\:\\:\\$_type is never written, only read\\.$#" - count: 1 - path: Editor/Join.php - - message: "#^Variable \\$readField might not be defined\\.$#" count: 2 @@ -325,41 +260,6 @@ parameters: count: 1 path: Editor/Options.php - - - message: "#^Property DataTables\\\\Editor\\\\Options\\:\\:\\$_customFn is never written, only read\\.$#" - count: 1 - path: Editor/Options.php - - - - message: "#^Property DataTables\\\\Editor\\\\Options\\:\\:\\$_limit is never written, only read\\.$#" - count: 1 - path: Editor/Options.php - - - - message: "#^Property DataTables\\\\Editor\\\\Options\\:\\:\\$_renderer is never written, only read\\.$#" - count: 1 - path: Editor/Options.php - - - - message: "#^Property DataTables\\\\Editor\\\\Options\\:\\:\\$_table is never written, only read\\.$#" - count: 1 - path: Editor/Options.php - - - - message: "#^Property DataTables\\\\Editor\\\\Options\\:\\:\\$_value is never written, only read\\.$#" - count: 1 - path: Editor/Options.php - - - - message: "#^Property DataTables\\\\Editor\\\\Options\\:\\:\\$_where is never written, only read\\.$#" - count: 1 - path: Editor/Options.php - - - - message: "#^Cannot call method where\\(\\) on string\\.$#" - count: 1 - path: Editor/SearchBuilderOptions.php - - message: "#^Method DataTables\\\\Editor\\\\SearchBuilderOptions\\:\\:_get_where\\(\\) is unused\\.$#" count: 1 @@ -370,71 +270,16 @@ parameters: count: 1 path: Editor/SearchBuilderOptions.php - - - message: "#^Property DataTables\\\\Editor\\\\SearchBuilderOptions\\:\\:\\$_order is never written, only read\\.$#" - count: 1 - path: Editor/SearchBuilderOptions.php - - - - message: "#^Property DataTables\\\\Editor\\\\SearchBuilderOptions\\:\\:\\$_renderer is never written, only read\\.$#" - count: 1 - path: Editor/SearchBuilderOptions.php - - - - message: "#^Property DataTables\\\\Editor\\\\SearchBuilderOptions\\:\\:\\$_table is never written, only read\\.$#" - count: 1 - path: Editor/SearchBuilderOptions.php - - - - message: "#^Property DataTables\\\\Editor\\\\SearchBuilderOptions\\:\\:\\$_value is never written, only read\\.$#" - count: 1 - path: Editor/SearchBuilderOptions.php - - - - message: "#^Property DataTables\\\\Editor\\\\SearchBuilderOptions\\:\\:\\$_where is never written, only read\\.$#" - count: 1 - path: Editor/SearchBuilderOptions.php - - message: "#^Strict comparison using \\=\\=\\= between 'array' and 'array' will always evaluate to true\\.$#" count: 1 path: Editor/SearchBuilderOptions.php - - - message: "#^Cannot call method where\\(\\) on string\\.$#" - count: 1 - path: Editor/SearchPaneOptions.php - - message: "#^Method DataTables\\\\Editor\\\\SearchPaneOptions\\:\\:_get_where\\(\\) is unused\\.$#" count: 1 path: Editor/SearchPaneOptions.php - - - message: "#^Property DataTables\\\\Editor\\\\SearchPaneOptions\\:\\:\\$_order is never written, only read\\.$#" - count: 1 - path: Editor/SearchPaneOptions.php - - - - message: "#^Property DataTables\\\\Editor\\\\SearchPaneOptions\\:\\:\\$_renderer is never written, only read\\.$#" - count: 1 - path: Editor/SearchPaneOptions.php - - - - message: "#^Property DataTables\\\\Editor\\\\SearchPaneOptions\\:\\:\\$_table is never written, only read\\.$#" - count: 1 - path: Editor/SearchPaneOptions.php - - - - message: "#^Property DataTables\\\\Editor\\\\SearchPaneOptions\\:\\:\\$_value is never written, only read\\.$#" - count: 1 - path: Editor/SearchPaneOptions.php - - - - message: "#^Property DataTables\\\\Editor\\\\SearchPaneOptions\\:\\:\\$_where is never written, only read\\.$#" - count: 1 - path: Editor/SearchPaneOptions.php - - message: "#^Strict comparison using \\=\\=\\= between 'array' and 'array' will always evaluate to true\\.$#" count: 1 @@ -455,11 +300,6 @@ parameters: count: 1 path: Editor/Upload.php - - - message: "#^Method DataTables\\\\Editor\\\\Upload\\:\\:data\\(\\) should return array but returns null\\.$#" - count: 1 - path: Editor/Upload.php - - message: "#^Method DataTables\\\\Editor\\\\Upload\\:\\:exec\\(\\) should return int but returns false\\.$#" count: 4