From f367925ee94f89d3a3784d7b1b287f62fb58057d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sat, 8 Jun 2024 13:45:54 +0200 Subject: [PATCH 1/2] Fix CS --- Editor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Editor.php b/Editor.php index a54085a..7bdefc3 100644 --- a/Editor.php +++ b/Editor.php @@ -1673,7 +1673,7 @@ private function _ssp_sort($query, $http) // Paging makes little sense without an ordering clause, so if there is // no order to apply (possible in DT2 on the third click of a header) // we apply the primary key as the ordering value. - if (! isset($http['order']) || count($http['order']) === 0) { + if (!isset($http['order']) || count($http['order']) === 0) { $query->order($this->_pkey[0] . ' asc'); } } From a624a761ce61b8cc7c3a9a298c3c6364168d4e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sat, 8 Jun 2024 13:55:42 +0200 Subject: [PATCH 2/2] Fix PHPStan --- Editor/Join.php | 8 ++++---- Editor/Upload.php | 4 +--- phpstan-baseline.neon | 15 --------------- phpstan.neon.dist | 1 - 4 files changed, 5 insertions(+), 23 deletions(-) diff --git a/Editor/Join.php b/Editor/Join.php index 8c0e0ac..5c0696c 100644 --- a/Editor/Join.php +++ b/Editor/Join.php @@ -483,10 +483,10 @@ public function whereSet($_ = null) /** * Get data. * - * @param Editor $editor Host Editor instance - * @param string[] $data Data from the parent table's get and were we need - * to add out output. - * @param array $options options array for fields + * @param Editor $editor Host Editor instance + * @param mixed[] $data Data from the parent table's get and were we need + * to add out output. + * @param array $options options array for fields * * @internal */ diff --git a/Editor/Upload.php b/Editor/Upload.php index e77074d..81e93ff 100644 --- a/Editor/Upload.php +++ b/Editor/Upload.php @@ -699,10 +699,8 @@ private function _dbExec($upload, $db) $q->set($column, $webPath); } elseif ($type === self::DB_SYSTEM_PATH) { $q->set($column, $path); - } elseif (is_string($type)) { - $q->set($column, str_replace('__ID__', $id, $type)); } else { - $q->set($column, $type); + $q->set($column, str_replace('__ID__', $id, $type)); } } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 3e26622..51254da 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -340,26 +340,11 @@ parameters: count: 1 path: Editor/Join.php - - - message: "#^Offset 'DT_RowId' does not exist on string\\.$#" - count: 1 - path: Editor/Join.php - - message: "#^Parameter \\#1 \\$order of method DataTables\\\\Database\\\\Query\\:\\:order\\(\\) expects array\\\\|string, DataTables\\\\Editor\\\\Join given\\.$#" count: 1 path: Editor/Join.php - - - message: "#^Parameter \\#2 \\$data of method DataTables\\\\Ext\\:\\:_propExists\\(\\) expects array, string given\\.$#" - count: 2 - path: Editor/Join.php - - - - message: "#^Parameter \\#2 \\$data of method DataTables\\\\Ext\\:\\:_readProp\\(\\) expects array, string given\\.$#" - count: 1 - path: Editor/Join.php - - message: "#^Parameter \\#2 \\$val of method DataTables\\\\Database\\\\Query\\:\\:set\\(\\) expects string\\|null, int given\\.$#" count: 2 diff --git a/phpstan.neon.dist b/phpstan.neon.dist index cdaa241..f02b3bb 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -20,4 +20,3 @@ parameters: - '~has no return type specified~' - '~return type has no value type specified~' - '~no value type specified in iterable type array~' - - 'Call to function is_string() with non-falsy-string will always evaluate to true.' \ No newline at end of file